AwsSns
Service-level AWS SNS component.
Remarks
This is the primary component resource for the package. It can orchestrate creation of SNS topic, topic policy, topic subscription, and data protection policy capabilities through a single component boundary.
Naming:
- Type token:
${namespace}:aws:AwsSns. Capability literals aretopic,topic-policy,topic-subscription, anddata-protection-policy. Roots use${env}-${projectHash}-<capability>-<sanitised identity>throughbuildComponentLogicalName.args.topic.nameis shared logical/provider identity;args.topicPolicy.identity,args.topicSubscription.identity, andargs.dataProtectionPolicy.identityare logical-only. Raw identities retain non-canonical normalisation, including dots. - Every child is parented by
AwsSns.aws.sns.Topicusesargs.topic.name;aws.sns.TopicPolicyusesargs.topicPolicy.identity;aws.sns.TopicSubscriptionusesargs.topicSubscription.identity; andaws.sns.DataProtectionPolicyusesargs.dataProtectionPolicy.identity. Each ordered readable tuple contains only that raw root identity and renders${env}-${projectHash}-<sanitised identity>. aws.sns.Topic.nameusesstackAndPurposefromargs.topic.name:${env}-${projectHash}-${purpose}. FIFO topics append AWS-required.fifo. SNS permits 256 characters; the purpose is limited to 243 characters for standard topics and 238 characters for FIFO topics so the rendered provider name never exceeds that limit. Provider-name bytes remain unchanged for valid inputs.- Topic policy, subscription, and data-protection-policy have no component-controlled provider name. Their semantic ARN comes from
topicArn/topic, is trimmed and otherwise forwarded unchanged; the provider owns ARN validation. Logical-onlyidentityis never forwarded. - Lambda invoke permissions are owned by the referenced Lambda component. A managed Lambda subscription supplies only
args.topicSubscription.identityas its source-side relationship identity; the Lambda component separately adds the function identity andsnsservice discriminator.
Example
const topic = new AwsSns({
topic: {
name: 'applicationEvents',
displayName: 'application-events',
},
});
const topicWithProjectKey = new AwsSns({
topic: {
name: 'applicationEventsProjectKey',
displayName: 'application-events-project-key',
kmsKey: { identifier: 'alias/myproject/stage' },
},
});
const topicWithDefaultEncryption = new AwsSns({
topic: {
name: 'applicationEventsDefaultEncryption',
displayName: 'application-events-default-encryption',
},
});
const topicPolicy = new AwsSns({
topicPolicy: {
identity: 'applicationEventsPolicy',
topicArn: topic.topic!.arn,
policy: aws.iam.getPolicyDocumentOutput({
statements: [],
}).json,
},
});
const subscription = new AwsSns({
topicSubscription: {
identity: 'applicationEventsSubscription',
topic: topic.topic!.arn,
protocol: 'sqs',
endpoint: queue.arn,
},
});Constructors
new AwsSns(
args: AwsSnsArgs,
options?: ComponentResourceOptions,
): AwsSns
Parameters
args(AwsSnsArgs) — Service-level SNS capability inputs.The component logical name is derived from capability identity inputs.options(ComponentResourceOptions, optional) — Optional settings controlling resource behaviour.
Returns
AwsSns
Hierarchy
ComponentResourceAwsSns
Properties
dataProtectionPolicy: AwsSnsDataProtectionPolicy
Optional SNS data protection policy capability created by this component.
lambdaInvokePermission: Resource
Optional Lambda invoke permission created for a managed Lambda subscription.
topic: AwsSnsTopic
Optional SNS topic capability created by this component.
topicPolicy: AwsSnsTopicPolicy
Optional SNS topic policy capability created by this component.
topicSubscription: AwsSnsTopicSubscription
Optional SNS topic subscription capability created by this component.
urn: Output<string>
Inherited from urn
The stable logical URN used to distinctly address a resource, both before and after deployments.
Methods
getData(): Promise<any>
Inherited from getData
Retrieves the data produces by initialize. The data is immediately available in a derived class's constructor after the super(...) call to ComponentResource.
Returns
Promise<any>
getProvider(moduleMember: string): ProviderResource | undefined
Inherited from getProvider
Returns the provider for the given module member, if one exists.
Parameters
moduleMember(string)
Returns
ProviderResource | undefined
initialize(
args: Inputs,
opts?: ComponentResourceOptions,
name?: string,
type?: string,
): Promise<any>
Inherited from initialize
Can be overridden by a subclass to asynchronously initialize data for this component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use getData.
Parameters
args(Inputs)opts(ComponentResourceOptions, optional)name(string, optional)type(string, optional)
Returns
Promise<any>
registerOutputs(
outputs?: Inputs | Promise<Inputs> | Output<Inputs>,
): void
Inherited from registerOutputs
Registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
Component resources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.
Parameters
outputs(Inputs | Promise<Inputs> | Output<Inputs>, optional)
Returns
void
Static Methods
isInstance(obj: any): obj is ComponentResource<any>
Inherited from isInstance
Returns true if the given object is a CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
Parameters
obj(any)
Returns
obj is ComponentResource<any>