Interface ITopic

All Superinterfaces:
software.constructs.IConstruct, software.constructs.IDependable, IEnvironmentAware, INotificationRuleTarget, IResource, ITopicRef, software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
ITopic.Jsii$Default
All Known Implementing Classes:
ITopic.Jsii$Proxy, Topic, TopicBase

@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)", date="2025-12-05T10:47:30.379Z") @Stability(Stable) public interface ITopic extends software.amazon.jsii.JsiiSerializable, IResource, INotificationRuleTarget, ITopicRef
Represents an SNS topic.
  • Method Details

    • getContentBasedDeduplication

      @Stability(Stable) @NotNull Boolean getContentBasedDeduplication()
      Enables content-based deduplication for FIFO topics.
    • getFifo

      @Stability(Stable) @NotNull Boolean getFifo()
      Whether this topic is an Amazon SNS FIFO queue.

      If false, this is a standard topic.

    • getTopicArn

      @Stability(Stable) @NotNull String getTopicArn()
      The ARN of the topic.
    • getTopicName

      @Stability(Stable) @NotNull String getTopicName()
      The name of the topic.
    • getMasterKey

      @Stability(Stable) @Nullable default IKey getMasterKey()
      A KMS Key, either managed by this CDK app, or imported.

      This property applies only to server-side encryption.

      Default: None

      See Also:
    • addSubscription

      @Stability(Stable) @NotNull Subscription addSubscription(@NotNull ITopicSubscription subscription)
      Subscribe some endpoint to this topic.

      Parameters:
      subscription - This parameter is required.
    • addToResourcePolicy

      @Stability(Stable) @NotNull AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement statement)
      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.

      Parameters:
      statement - This parameter is required.
    • grantPublish

      @Stability(Stable) @NotNull Grant grantPublish(@NotNull IGrantable identity)
      Grant topic publishing permissions to the given identity.

      Parameters:
      identity - This parameter is required.
    • grantSubscribe

      @Stability(Stable) @NotNull Grant grantSubscribe(@NotNull IGrantable identity)
      Grant topic subscribing permissions to the given identity.

      Parameters:
      identity - This parameter is required.
    • metric

      @Stability(Stable) @NotNull Metric metric(@NotNull String metricName, @Nullable MetricOptions props)
      Return the given named metric for this Topic.

      Parameters:
      metricName - This parameter is required.
      props -
    • metric

      @Stability(Stable) @NotNull Metric metric(@NotNull String metricName)
      Return the given named metric for this Topic.

      Parameters:
      metricName - This parameter is required.
    • metricNumberOfMessagesPublished

      @Stability(Stable) @NotNull Metric metricNumberOfMessagesPublished(@Nullable MetricOptions props)
      The number of messages published to your Amazon SNS topics.

      Sum over 5 minutes

      Parameters:
      props -
    • metricNumberOfMessagesPublished

      @Stability(Stable) @NotNull Metric metricNumberOfMessagesPublished()
      The number of messages published to your Amazon SNS topics.

      Sum over 5 minutes

    • metricNumberOfNotificationsDelivered

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsDelivered(@Nullable MetricOptions props)
      The number of messages successfully delivered from your Amazon SNS topics to subscribing endpoints.

      Sum over 5 minutes

      Parameters:
      props -
    • metricNumberOfNotificationsDelivered

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsDelivered()
      The number of messages successfully delivered from your Amazon SNS topics to subscribing endpoints.

      Sum over 5 minutes

    • metricNumberOfNotificationsFailed

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsFailed(@Nullable MetricOptions props)
      The number of messages that Amazon SNS failed to deliver.

      Sum over 5 minutes

      Parameters:
      props -
    • metricNumberOfNotificationsFailed

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsFailed()
      The number of messages that Amazon SNS failed to deliver.

      Sum over 5 minutes

    • metricNumberOfNotificationsFilteredOut

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsFilteredOut(@Nullable MetricOptions props)
      The number of messages that were rejected by subscription filter policies.

      Sum over 5 minutes

      Parameters:
      props -
    • metricNumberOfNotificationsFilteredOut

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsFilteredOut()
      The number of messages that were rejected by subscription filter policies.

      Sum over 5 minutes

    • metricNumberOfNotificationsFilteredOutInvalidAttributes

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsFilteredOutInvalidAttributes(@Nullable MetricOptions props)
      The number of messages that were rejected by subscription filter policies because the messages' attributes are invalid.

      Sum over 5 minutes

      Parameters:
      props -
    • metricNumberOfNotificationsFilteredOutInvalidAttributes

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsFilteredOutInvalidAttributes()
      The number of messages that were rejected by subscription filter policies because the messages' attributes are invalid.

      Sum over 5 minutes

    • metricNumberOfNotificationsFilteredOutNoMessageAttributes

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsFilteredOutNoMessageAttributes(@Nullable MetricOptions props)
      The number of messages that were rejected by subscription filter policies because the messages have no attributes.

      Sum over 5 minutes

      Parameters:
      props -
    • metricNumberOfNotificationsFilteredOutNoMessageAttributes

      @Stability(Stable) @NotNull Metric metricNumberOfNotificationsFilteredOutNoMessageAttributes()
      The number of messages that were rejected by subscription filter policies because the messages have no attributes.

      Sum over 5 minutes

    • metricPublishSize

      @Stability(Stable) @NotNull Metric metricPublishSize(@Nullable MetricOptions props)
      Metric for the size of messages published through this topic.

      Average over 5 minutes

      Parameters:
      props -
    • metricPublishSize

      @Stability(Stable) @NotNull Metric metricPublishSize()
      Metric for the size of messages published through this topic.

      Average over 5 minutes

    • metricSMSMonthToDateSpentUSD

      @Stability(Stable) @NotNull Metric metricSMSMonthToDateSpentUSD(@Nullable MetricOptions props)
      The charges you have accrued since the start of the current calendar month for sending SMS messages.

      Maximum over 5 minutes

      Parameters:
      props -
    • metricSMSMonthToDateSpentUSD

      @Stability(Stable) @NotNull Metric metricSMSMonthToDateSpentUSD()
      The charges you have accrued since the start of the current calendar month for sending SMS messages.

      Maximum over 5 minutes

    • metricSMSSuccessRate

      @Stability(Stable) @NotNull Metric metricSMSSuccessRate(@Nullable MetricOptions props)
      The rate of successful SMS message deliveries.

      Sum over 5 minutes

      Parameters:
      props -
    • metricSMSSuccessRate

      @Stability(Stable) @NotNull Metric metricSMSSuccessRate()
      The rate of successful SMS message deliveries.

      Sum over 5 minutes

    • getNode

      @Stability(Stable) @NotNull software.constructs.Node getNode()
      The tree node.
      Specified by:
      getNode in interface software.constructs.IConstruct
    • getEnv

      @Stability(Stable) @NotNull ResourceEnvironment getEnv()
      The environment this resource belongs to.

      For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

      For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

      Specified by:
      getEnv in interface IEnvironmentAware