java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IResource, INotificationRuleTarget, ITopic, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:38.198Z") @Stability(Stable) public class Topic extends TopicBase
A new SNS topic.

Example:

 import software.amazon.awscdk.services.sns.*;
 Topic topic = new Topic(this, "MyTopic");
 TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
         .sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'"))
         .actions(List.of(
             SnsTopicAction.Builder.create(topic)
                     .messageFormat(SnsActionMessageFormat.JSON)
                     .build()))
         .build();
 
  • Constructor Details

    • Topic

      protected Topic(software.amazon.jsii.JsiiObjectRef objRef)
    • Topic

      protected Topic(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Topic

      @Stability(Stable) public Topic(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable TopicProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • Topic

      @Stability(Stable) public Topic(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromTopicArn

      @Stability(Stable) @NotNull public static ITopic fromTopicArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String topicArn)
      Import an existing SNS topic provided an ARN.

      Parameters:
      scope - The parent creating construct. This parameter is required.
      id - The construct's name. This parameter is required.
      topicArn - topic ARN (i.e. arn:aws:sns:us-east-2:444455556666:MyTopic). This parameter is required.
    • getAutoCreatePolicy

      @Stability(Stable) @NotNull protected Boolean getAutoCreatePolicy()
      Controls automatic creation of policy objects.

      Set by subclasses.

      Specified by:
      getAutoCreatePolicy in class TopicBase
    • getFifo

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

      If false, this is a standard topic.

      Specified by:
      getFifo in interface ITopic
      Specified by:
      getFifo in class TopicBase
    • getTopicArn

      @Stability(Stable) @NotNull public String getTopicArn()
      The ARN of the topic.
      Specified by:
      getTopicArn in interface ITopic
      Specified by:
      getTopicArn in class TopicBase
    • getTopicName

      @Stability(Stable) @NotNull public String getTopicName()
      The name of the topic.
      Specified by:
      getTopicName in interface ITopic
      Specified by:
      getTopicName in class TopicBase