interface ITopic
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.SNS.ITopic |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awssns#ITopic |
Java | software.amazon.awscdk.services.sns.ITopic |
Python | aws_cdk.aws_sns.ITopic |
TypeScript (source) | aws-cdk-lib » aws_sns » ITopic |
Implemented by
Topic
Obtainable from
Topic
.fromTopicArn()
, Topic
.fromTopicAttributes()
Represents an SNS topic.
Properties
Name | Type | Description |
---|---|---|
content | boolean | Enables content-based deduplication for FIFO topics. |
env | Resource | The environment this resource belongs to. |
fifo | boolean | Whether this topic is an Amazon SNS FIFO queue. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
topic | string | The ARN of the topic. |
topic | string | The name of the topic. |
contentBasedDeduplication
Type:
boolean
Enables content-based deduplication for FIFO topics.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
fifo
Type:
boolean
Whether this topic is an Amazon SNS FIFO queue.
If false, this is a standard topic.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
topicArn
Type:
string
The ARN of the topic.
topicName
Type:
string
The name of the topic.
Methods
Name | Description |
---|---|
add | Subscribe some endpoint to this topic. |
add | Adds a statement to the IAM resource policy associated with this topic. |
apply | Apply the given removal policy to this resource. |
bind | Returns a target configuration for notification rule. |
grant | Grant topic publishing permissions to the given identity. |
grant | Grant topic subscribing permissions to the given identity. |
metric(metricName, props?) | Return the given named metric for this Topic. |
metric | The number of messages published to your Amazon SNS topics. |
metric | The number of messages successfully delivered from your Amazon SNS topics to subscribing endpoints. |
metric | The number of messages that Amazon SNS failed to deliver. |
metric | The number of messages that were rejected by subscription filter policies. |
metric | The number of messages that were rejected by subscription filter policies because the messages' attributes are invalid. |
metric | The number of messages that were rejected by subscription filter policies because the messages have no attributes. |
metric | Metric for the size of messages published through this topic. |
metric | The charges you have accrued since the start of the current calendar month for sending SMS messages. |
metric | The rate of successful SMS message deliveries. |
Subscription(subscription)
addpublic addSubscription(subscription: ITopicSubscription): Subscription
Parameters
- subscription
ITopic
Subscription
Returns
Subscribe some endpoint to this topic.
ToResourcePolicy(statement)
addpublic addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
Parameters
- statement
Policy
Statement
Returns
Adds a statement to the IAM resource policy associated with this topic.
If this topic was created in this stack (new Topic
), a topic policy
will be automatically created upon the first call to addToResourcePolicy
. If
the topic is imported (Topic.import
), then this is a no-op.
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
AsNotificationRuleTarget(scope)
bindpublic bindAsNotificationRuleTarget(scope: Construct): NotificationRuleTargetConfig
Parameters
- scope
Construct
Returns
Returns a target configuration for notification rule.
Publish(identity)
grantpublic grantPublish(identity: IGrantable): Grant
Parameters
- identity
IGrantable
Returns
Grant topic publishing permissions to the given identity.
Subscribe(identity)
grantpublic grantSubscribe(identity: IGrantable): Grant
Parameters
- identity
IGrantable
Returns
Grant topic subscribing permissions to the given identity.
metric(metricName, props?)
public metric(metricName: string, props?: MetricOptions): Metric
Parameters
- metricName
string
- props
Metric
Options
Returns
Return the given named metric for this Topic.
NumberOfMessagesPublished(props?)
metricpublic metricNumberOfMessagesPublished(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages published to your Amazon SNS topics.
Sum over 5 minutes
NumberOfNotificationsDelivered(props?)
metricpublic metricNumberOfNotificationsDelivered(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages successfully delivered from your Amazon SNS topics to subscribing endpoints.
Sum over 5 minutes
NumberOfNotificationsFailed(props?)
metricpublic metricNumberOfNotificationsFailed(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages that Amazon SNS failed to deliver.
Sum over 5 minutes
NumberOfNotificationsFilteredOut(props?)
metricpublic metricNumberOfNotificationsFilteredOut(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages that were rejected by subscription filter policies.
Sum over 5 minutes
NumberOfNotificationsFilteredOutInvalidAttributes(props?)
metricpublic metricNumberOfNotificationsFilteredOutInvalidAttributes(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages that were rejected by subscription filter policies because the messages' attributes are invalid.
Sum over 5 minutes
NumberOfNotificationsFilteredOutNoMessageAttributes(props?)
metricpublic metricNumberOfNotificationsFilteredOutNoMessageAttributes(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The number of messages that were rejected by subscription filter policies because the messages have no attributes.
Sum over 5 minutes
PublishSize(props?)
metricpublic metricPublishSize(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the size of messages published through this topic.
Average over 5 minutes
SMSMonthToDateSpentUSD(props?)
metricpublic metricSMSMonthToDateSpentUSD(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The charges you have accrued since the start of the current calendar month for sending SMS messages.
Maximum over 5 minutes
SMSSuccessRate(props?)
metricpublic metricSMSSuccessRate(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The rate of successful SMS message deliveries.
Sum over 5 minutes