Skip to content
v2.278.0

Experimental

@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

OpenSearchActionProps Struct ​

Configuration properties of an action for Open Search.

Example ​

ts
import * as opensearch from 'aws-cdk-lib/aws-opensearchservice';
declare const domain: opensearch.Domain;

const topicRule = new iot.TopicRule(this, 'TopicRule', {
  sql: iot.IotSql.fromStringAsVer20160323(
    "SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'",
  ),
});

topicRule.addAction(new actions.OpenSearchAction(domain, {
  id: 'my-id',
  index: 'my-index',
  type: 'my-type',
}));
python
import aws_cdk.aws_opensearchservice as opensearch
# domain: opensearch.Domain


topic_rule = iot.TopicRule(self, "TopicRule",
    sql=iot.IotSql.from_string_as_ver20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'")
)

topic_rule.add_action(actions.OpenSearchAction(domain,
    id="my-id",
    index="my-index",
    type="my-type"
))
java
import software.amazon.awscdk.services.opensearchservice.*;
Domain domain;


TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
        .sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'"))
        .build();

topicRule.addAction(OpenSearchAction.Builder.create(domain)
        .id("my-id")
        .index("my-index")
        .type("my-type")
        .build());
csharp
// Install: dotnet add package Amazon.CDK.AWS.IoT.Actions.Alpha
using Amazon.CDK.AWS.OpenSearchService;
Domain domain;


var topicRule = new TopicRule(this, "TopicRule", new TopicRuleProps {
    Sql = IotSql.FromStringAsVer20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'")
});

topicRule.AddAction(new OpenSearchAction(domain, new OpenSearchActionProps {
    Id = "my-id",
    Index = "my-index",
    Type = "my-type"
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2
import opensearch "github.com/aws/aws-cdk-go/awscdk"
var domain Domain


topicRule := iot.NewTopicRule(this, jsii.String("TopicRule"), &TopicRuleProps{
	Sql: iot.IotSql_FromStringAsVer20160323(jsii.String("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'")),
})

topicRule.AddAction(actions.NewOpenSearchAction(domain, &OpenSearchActionProps{
	Id: jsii.String("my-id"),
	Index: jsii.String("my-index"),
	Type: jsii.String("my-type"),
}))

Properties ​

idstringidstridStringIdstringId*string required #
The unique identifier for the document you are storing.
indexstringindexstrindexStringIndexstringIndex*string required #
The OpenSearch index where you want to store your data.
roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole #
The IAM role that allows access to AWS service.

Default: a new role will be created

typestringtypestrtypeStringTypestringType*string required #
The type of document you are storing.