TopicRuleArgs

data class TopicRuleArgs(val cloudwatchAlarm: Output<TopicRuleCloudwatchAlarmArgs>? = null, val cloudwatchLogs: Output<List<TopicRuleCloudwatchLogArgs>>? = null, val cloudwatchMetric: Output<TopicRuleCloudwatchMetricArgs>? = null, val description: Output<String>? = null, val dynamodb: Output<TopicRuleDynamodbArgs>? = null, val dynamodbv2s: Output<List<TopicRuleDynamodbv2Args>>? = null, val elasticsearch: Output<TopicRuleElasticsearchArgs>? = null, val enabled: Output<Boolean>? = null, val errorAction: Output<TopicRuleErrorActionArgs>? = null, val firehose: Output<TopicRuleFirehoseArgs>? = null, val https: Output<List<TopicRuleHttpArgs>>? = null, val iotAnalytics: Output<List<TopicRuleIotAnalyticArgs>>? = null, val iotEvents: Output<List<TopicRuleIotEventArgs>>? = null, val kafkas: Output<List<TopicRuleKafkaArgs>>? = null, val kinesis: Output<TopicRuleKinesisArgs>? = null, val lambda: Output<TopicRuleLambdaArgs>? = null, val name: Output<String>? = null, val republish: Output<TopicRuleRepublishArgs>? = null, val s3: Output<TopicRuleS3Args>? = null, val sns: Output<TopicRuleSnsArgs>? = null, val sql: Output<String>? = null, val sqlVersion: Output<String>? = null, val sqs: Output<TopicRuleSqsArgs>? = null, val stepFunctions: Output<List<TopicRuleStepFunctionArgs>>? = null, val tags: Output<Map<String, String>>? = null, val timestreams: Output<List<TopicRuleTimestreamArgs>>? = null) : ConvertibleToJava<TopicRuleArgs>

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iot.TopicRule;
import com.pulumi.aws.iot.TopicRuleArgs;
import com.pulumi.aws.iot.inputs.TopicRuleSnsArgs;
import com.pulumi.aws.iot.inputs.TopicRuleErrorActionArgs;
import com.pulumi.aws.iot.inputs.TopicRuleErrorActionSnsArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var mytopic = new Topic("mytopic");
var myerrortopic = new Topic("myerrortopic");
final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("iot.amazonaws.com")
.build())
.actions("sts:AssumeRole")
.build())
.build());
var role = new Role("role", RoleArgs.builder()
.assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var rule = new TopicRule("rule", TopicRuleArgs.builder()
.description("Example rule")
.enabled(true)
.sql("SELECT * FROM 'topic/test'")
.sqlVersion("2016-03-23")
.sns(TopicRuleSnsArgs.builder()
.messageFormat("RAW")
.roleArn(role.arn())
.targetArn(mytopic.arn())
.build())
.errorAction(TopicRuleErrorActionArgs.builder()
.sns(TopicRuleErrorActionSnsArgs.builder()
.messageFormat("RAW")
.roleArn(role.arn())
.targetArn(myerrortopic.arn())
.build())
.build())
.build());
final var iamPolicyForLambdaPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("sns:Publish")
.resources(mytopic.arn())
.build())
.build());
var iamPolicyForLambdaRolePolicy = new RolePolicy("iamPolicyForLambdaRolePolicy", RolePolicyArgs.builder()
.role(role.id())
.policy(iamPolicyForLambdaPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(iamPolicyForLambdaPolicyDocument -> iamPolicyForLambdaPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
.build());
}
}

Import

IoT Topic Rules can be imported using the name, e.g.,

$ pulumi import aws:iot/topicRule:TopicRule rule <name>

Constructors

Link copied to clipboard
constructor(cloudwatchAlarm: Output<TopicRuleCloudwatchAlarmArgs>? = null, cloudwatchLogs: Output<List<TopicRuleCloudwatchLogArgs>>? = null, cloudwatchMetric: Output<TopicRuleCloudwatchMetricArgs>? = null, description: Output<String>? = null, dynamodb: Output<TopicRuleDynamodbArgs>? = null, dynamodbv2s: Output<List<TopicRuleDynamodbv2Args>>? = null, elasticsearch: Output<TopicRuleElasticsearchArgs>? = null, enabled: Output<Boolean>? = null, errorAction: Output<TopicRuleErrorActionArgs>? = null, firehose: Output<TopicRuleFirehoseArgs>? = null, https: Output<List<TopicRuleHttpArgs>>? = null, iotAnalytics: Output<List<TopicRuleIotAnalyticArgs>>? = null, iotEvents: Output<List<TopicRuleIotEventArgs>>? = null, kafkas: Output<List<TopicRuleKafkaArgs>>? = null, kinesis: Output<TopicRuleKinesisArgs>? = null, lambda: Output<TopicRuleLambdaArgs>? = null, name: Output<String>? = null, republish: Output<TopicRuleRepublishArgs>? = null, s3: Output<TopicRuleS3Args>? = null, sns: Output<TopicRuleSnsArgs>? = null, sql: Output<String>? = null, sqlVersion: Output<String>? = null, sqs: Output<TopicRuleSqsArgs>? = null, stepFunctions: Output<List<TopicRuleStepFunctionArgs>>? = null, tags: Output<Map<String, String>>? = null, timestreams: Output<List<TopicRuleTimestreamArgs>>? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val description: Output<String>? = null

The description of the rule.

Link copied to clipboard
val dynamodb: Output<TopicRuleDynamodbArgs>? = null
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val enabled: Output<Boolean>? = null

Specifies whether the rule is enabled.

Link copied to clipboard

Configuration block with error action to be associated with the rule. See the documentation for cloudwatch_alarm, cloudwatch_logs, cloudwatch_metric, dynamodb, dynamodbv2, elasticsearch, firehose, http, iot_analytics, iot_events, kafka, kinesis, lambda, republish, s3, sns, sqs, step_functions, timestream configuration blocks for further configuration details.

Link copied to clipboard
val firehose: Output<TopicRuleFirehoseArgs>? = null
Link copied to clipboard
val https: Output<List<TopicRuleHttpArgs>>? = null
Link copied to clipboard
Link copied to clipboard
val iotEvents: Output<List<TopicRuleIotEventArgs>>? = null
Link copied to clipboard
val kafkas: Output<List<TopicRuleKafkaArgs>>? = null
Link copied to clipboard
val kinesis: Output<TopicRuleKinesisArgs>? = null
Link copied to clipboard
val lambda: Output<TopicRuleLambdaArgs>? = null
Link copied to clipboard
val name: Output<String>? = null

The name of the rule.

Link copied to clipboard
val republish: Output<TopicRuleRepublishArgs>? = null
Link copied to clipboard
val s3: Output<TopicRuleS3Args>? = null
Link copied to clipboard
val sns: Output<TopicRuleSnsArgs>? = null
Link copied to clipboard
val sql: Output<String>? = null

The SQL statement used to query the topic. For more information, see AWS IoT SQL Reference (http://docs.aws.amazon.com/iot/latest/developerguide/iot-rules.html#aws-iot-sql-reference) in the AWS IoT Developer Guide.

Link copied to clipboard
val sqlVersion: Output<String>? = null

The version of the SQL rules engine to use when evaluating the rule.

Link copied to clipboard
val sqs: Output<TopicRuleSqsArgs>? = null
Link copied to clipboard
Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun toJava(): TopicRuleArgs