Class CfnTopicRule

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-04-10T22:22:29.172Z") @Stability(Stable) public class CfnTopicRule extends CfnResource implements IInspectable, ITaggable
Use the AWS::IoT::TopicRule resource to declare an AWS IoT rule.

For information about working with AWS IoT rules, see Rules for AWS IoT in the AWS IoT Developer Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.iot.*;
 CfnTopicRule cfnTopicRule = CfnTopicRule.Builder.create(this, "MyCfnTopicRule")
         .topicRulePayload(TopicRulePayloadProperty.builder()
                 .actions(List.of(ActionProperty.builder()
                         .cloudwatchAlarm(CloudwatchAlarmActionProperty.builder()
                                 .alarmName("alarmName")
                                 .roleArn("roleArn")
                                 .stateReason("stateReason")
                                 .stateValue("stateValue")
                                 .build())
                         .cloudwatchLogs(CloudwatchLogsActionProperty.builder()
                                 .logGroupName("logGroupName")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .batchMode(false)
                                 .build())
                         .cloudwatchMetric(CloudwatchMetricActionProperty.builder()
                                 .metricName("metricName")
                                 .metricNamespace("metricNamespace")
                                 .metricUnit("metricUnit")
                                 .metricValue("metricValue")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .metricTimestamp("metricTimestamp")
                                 .build())
                         .dynamoDb(DynamoDBActionProperty.builder()
                                 .hashKeyField("hashKeyField")
                                 .hashKeyValue("hashKeyValue")
                                 .roleArn("roleArn")
                                 .tableName("tableName")
                                 // the properties below are optional
                                 .hashKeyType("hashKeyType")
                                 .payloadField("payloadField")
                                 .rangeKeyField("rangeKeyField")
                                 .rangeKeyType("rangeKeyType")
                                 .rangeKeyValue("rangeKeyValue")
                                 .build())
                         .dynamoDBv2(DynamoDBv2ActionProperty.builder()
                                 .putItem(PutItemInputProperty.builder()
                                         .tableName("tableName")
                                         .build())
                                 .roleArn("roleArn")
                                 .build())
                         .elasticsearch(ElasticsearchActionProperty.builder()
                                 .endpoint("endpoint")
                                 .id("id")
                                 .index("index")
                                 .roleArn("roleArn")
                                 .type("type")
                                 .build())
                         .firehose(FirehoseActionProperty.builder()
                                 .deliveryStreamName("deliveryStreamName")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .batchMode(false)
                                 .separator("separator")
                                 .build())
                         .http(HttpActionProperty.builder()
                                 .url("url")
                                 // the properties below are optional
                                 .auth(HttpAuthorizationProperty.builder()
                                         .sigv4(SigV4AuthorizationProperty.builder()
                                                 .roleArn("roleArn")
                                                 .serviceName("serviceName")
                                                 .signingRegion("signingRegion")
                                                 .build())
                                         .build())
                                 .confirmationUrl("confirmationUrl")
                                 .headers(List.of(HttpActionHeaderProperty.builder()
                                         .key("key")
                                         .value("value")
                                         .build()))
                                 .build())
                         .iotAnalytics(IotAnalyticsActionProperty.builder()
                                 .channelName("channelName")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .batchMode(false)
                                 .build())
                         .iotEvents(IotEventsActionProperty.builder()
                                 .inputName("inputName")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .batchMode(false)
                                 .messageId("messageId")
                                 .build())
                         .iotSiteWise(IotSiteWiseActionProperty.builder()
                                 .putAssetPropertyValueEntries(List.of(PutAssetPropertyValueEntryProperty.builder()
                                         .propertyValues(List.of(AssetPropertyValueProperty.builder()
                                                 .timestamp(AssetPropertyTimestampProperty.builder()
                                                         .timeInSeconds("timeInSeconds")
                                                         // the properties below are optional
                                                         .offsetInNanos("offsetInNanos")
                                                         .build())
                                                 .value(AssetPropertyVariantProperty.builder()
                                                         .booleanValue("booleanValue")
                                                         .doubleValue("doubleValue")
                                                         .integerValue("integerValue")
                                                         .stringValue("stringValue")
                                                         .build())
                                                 // the properties below are optional
                                                 .quality("quality")
                                                 .build()))
                                         // the properties below are optional
                                         .assetId("assetId")
                                         .entryId("entryId")
                                         .propertyAlias("propertyAlias")
                                         .propertyId("propertyId")
                                         .build()))
                                 .roleArn("roleArn")
                                 .build())
                         .kafka(KafkaActionProperty.builder()
                                 .clientProperties(Map.of(
                                         "clientPropertiesKey", "clientProperties"))
                                 .destinationArn("destinationArn")
                                 .topic("topic")
                                 // the properties below are optional
                                 .headers(List.of(KafkaActionHeaderProperty.builder()
                                         .key("key")
                                         .value("value")
                                         .build()))
                                 .key("key")
                                 .partition("partition")
                                 .build())
                         .kinesis(KinesisActionProperty.builder()
                                 .roleArn("roleArn")
                                 .streamName("streamName")
                                 // the properties below are optional
                                 .partitionKey("partitionKey")
                                 .build())
                         .lambda(LambdaActionProperty.builder()
                                 .functionArn("functionArn")
                                 .build())
                         .location(LocationActionProperty.builder()
                                 .deviceId("deviceId")
                                 .latitude("latitude")
                                 .longitude("longitude")
                                 .roleArn("roleArn")
                                 .trackerName("trackerName")
                                 // the properties below are optional
                                 .timestamp(TimestampProperty.builder()
                                         .value("value")
                                         // the properties below are optional
                                         .unit("unit")
                                         .build())
                                 .build())
                         .openSearch(OpenSearchActionProperty.builder()
                                 .endpoint("endpoint")
                                 .id("id")
                                 .index("index")
                                 .roleArn("roleArn")
                                 .type("type")
                                 .build())
                         .republish(RepublishActionProperty.builder()
                                 .roleArn("roleArn")
                                 .topic("topic")
                                 // the properties below are optional
                                 .headers(RepublishActionHeadersProperty.builder()
                                         .contentType("contentType")
                                         .correlationData("correlationData")
                                         .messageExpiry("messageExpiry")
                                         .payloadFormatIndicator("payloadFormatIndicator")
                                         .responseTopic("responseTopic")
                                         .userProperties(List.of(UserPropertyProperty.builder()
                                                 .key("key")
                                                 .value("value")
                                                 .build()))
                                         .build())
                                 .qos(123)
                                 .build())
                         .s3(S3ActionProperty.builder()
                                 .bucketName("bucketName")
                                 .key("key")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .cannedAcl("cannedAcl")
                                 .build())
                         .sns(SnsActionProperty.builder()
                                 .roleArn("roleArn")
                                 .targetArn("targetArn")
                                 // the properties below are optional
                                 .messageFormat("messageFormat")
                                 .build())
                         .sqs(SqsActionProperty.builder()
                                 .queueUrl("queueUrl")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .useBase64(false)
                                 .build())
                         .stepFunctions(StepFunctionsActionProperty.builder()
                                 .roleArn("roleArn")
                                 .stateMachineName("stateMachineName")
                                 // the properties below are optional
                                 .executionNamePrefix("executionNamePrefix")
                                 .build())
                         .timestream(TimestreamActionProperty.builder()
                                 .databaseName("databaseName")
                                 .dimensions(List.of(TimestreamDimensionProperty.builder()
                                         .name("name")
                                         .value("value")
                                         .build()))
                                 .roleArn("roleArn")
                                 .tableName("tableName")
                                 // the properties below are optional
                                 .timestamp(TimestreamTimestampProperty.builder()
                                         .unit("unit")
                                         .value("value")
                                         .build())
                                 .build())
                         .build()))
                 .sql("sql")
                 // the properties below are optional
                 .awsIotSqlVersion("awsIotSqlVersion")
                 .description("description")
                 .errorAction(ActionProperty.builder()
                         .cloudwatchAlarm(CloudwatchAlarmActionProperty.builder()
                                 .alarmName("alarmName")
                                 .roleArn("roleArn")
                                 .stateReason("stateReason")
                                 .stateValue("stateValue")
                                 .build())
                         .cloudwatchLogs(CloudwatchLogsActionProperty.builder()
                                 .logGroupName("logGroupName")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .batchMode(false)
                                 .build())
                         .cloudwatchMetric(CloudwatchMetricActionProperty.builder()
                                 .metricName("metricName")
                                 .metricNamespace("metricNamespace")
                                 .metricUnit("metricUnit")
                                 .metricValue("metricValue")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .metricTimestamp("metricTimestamp")
                                 .build())
                         .dynamoDb(DynamoDBActionProperty.builder()
                                 .hashKeyField("hashKeyField")
                                 .hashKeyValue("hashKeyValue")
                                 .roleArn("roleArn")
                                 .tableName("tableName")
                                 // the properties below are optional
                                 .hashKeyType("hashKeyType")
                                 .payloadField("payloadField")
                                 .rangeKeyField("rangeKeyField")
                                 .rangeKeyType("rangeKeyType")
                                 .rangeKeyValue("rangeKeyValue")
                                 .build())
                         .dynamoDBv2(DynamoDBv2ActionProperty.builder()
                                 .putItem(PutItemInputProperty.builder()
                                         .tableName("tableName")
                                         .build())
                                 .roleArn("roleArn")
                                 .build())
                         .elasticsearch(ElasticsearchActionProperty.builder()
                                 .endpoint("endpoint")
                                 .id("id")
                                 .index("index")
                                 .roleArn("roleArn")
                                 .type("type")
                                 .build())
                         .firehose(FirehoseActionProperty.builder()
                                 .deliveryStreamName("deliveryStreamName")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .batchMode(false)
                                 .separator("separator")
                                 .build())
                         .http(HttpActionProperty.builder()
                                 .url("url")
                                 // the properties below are optional
                                 .auth(HttpAuthorizationProperty.builder()
                                         .sigv4(SigV4AuthorizationProperty.builder()
                                                 .roleArn("roleArn")
                                                 .serviceName("serviceName")
                                                 .signingRegion("signingRegion")
                                                 .build())
                                         .build())
                                 .confirmationUrl("confirmationUrl")
                                 .headers(List.of(HttpActionHeaderProperty.builder()
                                         .key("key")
                                         .value("value")
                                         .build()))
                                 .build())
                         .iotAnalytics(IotAnalyticsActionProperty.builder()
                                 .channelName("channelName")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .batchMode(false)
                                 .build())
                         .iotEvents(IotEventsActionProperty.builder()
                                 .inputName("inputName")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .batchMode(false)
                                 .messageId("messageId")
                                 .build())
                         .iotSiteWise(IotSiteWiseActionProperty.builder()
                                 .putAssetPropertyValueEntries(List.of(PutAssetPropertyValueEntryProperty.builder()
                                         .propertyValues(List.of(AssetPropertyValueProperty.builder()
                                                 .timestamp(AssetPropertyTimestampProperty.builder()
                                                         .timeInSeconds("timeInSeconds")
                                                         // the properties below are optional
                                                         .offsetInNanos("offsetInNanos")
                                                         .build())
                                                 .value(AssetPropertyVariantProperty.builder()
                                                         .booleanValue("booleanValue")
                                                         .doubleValue("doubleValue")
                                                         .integerValue("integerValue")
                                                         .stringValue("stringValue")
                                                         .build())
                                                 // the properties below are optional
                                                 .quality("quality")
                                                 .build()))
                                         // the properties below are optional
                                         .assetId("assetId")
                                         .entryId("entryId")
                                         .propertyAlias("propertyAlias")
                                         .propertyId("propertyId")
                                         .build()))
                                 .roleArn("roleArn")
                                 .build())
                         .kafka(KafkaActionProperty.builder()
                                 .clientProperties(Map.of(
                                         "clientPropertiesKey", "clientProperties"))
                                 .destinationArn("destinationArn")
                                 .topic("topic")
                                 // the properties below are optional
                                 .headers(List.of(KafkaActionHeaderProperty.builder()
                                         .key("key")
                                         .value("value")
                                         .build()))
                                 .key("key")
                                 .partition("partition")
                                 .build())
                         .kinesis(KinesisActionProperty.builder()
                                 .roleArn("roleArn")
                                 .streamName("streamName")
                                 // the properties below are optional
                                 .partitionKey("partitionKey")
                                 .build())
                         .lambda(LambdaActionProperty.builder()
                                 .functionArn("functionArn")
                                 .build())
                         .location(LocationActionProperty.builder()
                                 .deviceId("deviceId")
                                 .latitude("latitude")
                                 .longitude("longitude")
                                 .roleArn("roleArn")
                                 .trackerName("trackerName")
                                 // the properties below are optional
                                 .timestamp(TimestampProperty.builder()
                                         .value("value")
                                         // the properties below are optional
                                         .unit("unit")
                                         .build())
                                 .build())
                         .openSearch(OpenSearchActionProperty.builder()
                                 .endpoint("endpoint")
                                 .id("id")
                                 .index("index")
                                 .roleArn("roleArn")
                                 .type("type")
                                 .build())
                         .republish(RepublishActionProperty.builder()
                                 .roleArn("roleArn")
                                 .topic("topic")
                                 // the properties below are optional
                                 .headers(RepublishActionHeadersProperty.builder()
                                         .contentType("contentType")
                                         .correlationData("correlationData")
                                         .messageExpiry("messageExpiry")
                                         .payloadFormatIndicator("payloadFormatIndicator")
                                         .responseTopic("responseTopic")
                                         .userProperties(List.of(UserPropertyProperty.builder()
                                                 .key("key")
                                                 .value("value")
                                                 .build()))
                                         .build())
                                 .qos(123)
                                 .build())
                         .s3(S3ActionProperty.builder()
                                 .bucketName("bucketName")
                                 .key("key")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .cannedAcl("cannedAcl")
                                 .build())
                         .sns(SnsActionProperty.builder()
                                 .roleArn("roleArn")
                                 .targetArn("targetArn")
                                 // the properties below are optional
                                 .messageFormat("messageFormat")
                                 .build())
                         .sqs(SqsActionProperty.builder()
                                 .queueUrl("queueUrl")
                                 .roleArn("roleArn")
                                 // the properties below are optional
                                 .useBase64(false)
                                 .build())
                         .stepFunctions(StepFunctionsActionProperty.builder()
                                 .roleArn("roleArn")
                                 .stateMachineName("stateMachineName")
                                 // the properties below are optional
                                 .executionNamePrefix("executionNamePrefix")
                                 .build())
                         .timestream(TimestreamActionProperty.builder()
                                 .databaseName("databaseName")
                                 .dimensions(List.of(TimestreamDimensionProperty.builder()
                                         .name("name")
                                         .value("value")
                                         .build()))
                                 .roleArn("roleArn")
                                 .tableName("tableName")
                                 // the properties below are optional
                                 .timestamp(TimestreamTimestampProperty.builder()
                                         .unit("unit")
                                         .value("value")
                                         .build())
                                 .build())
                         .build())
                 .ruleDisabled(false)
                 .build())
         // the properties below are optional
         .ruleName("ruleName")
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnTopicRule

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

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

      @Stability(Stable) public CfnTopicRule(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnTopicRuleProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The Amazon Resource Name (ARN) of the AWS IoT rule, such as arn:aws:iot:us-east-2:123456789012:rule/MyIoTRule .
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getTopicRulePayload

      @Stability(Stable) @NotNull public Object getTopicRulePayload()
      The rule payload.
    • setTopicRulePayload

      @Stability(Stable) public void setTopicRulePayload(@NotNull IResolvable value)
      The rule payload.
    • setTopicRulePayload

      @Stability(Stable) public void setTopicRulePayload(@NotNull CfnTopicRule.TopicRulePayloadProperty value)
      The rule payload.
    • getRuleName

      @Stability(Stable) @Nullable public String getRuleName()
      The name of the rule.
    • setRuleName

      @Stability(Stable) public void setRuleName(@Nullable String value)
      The name of the rule.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      Metadata which can be used to manage the topic rule.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      Metadata which can be used to manage the topic rule.