Experimental
@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
HttpsAction Class
The action to send data from an MQTT message to a web application or service.
| Stability | Experimental |
|---|---|
| Source | lib/https-action.ts |
Example
ts
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.HttpsAction('https://example.com/endpoint', {
confirmationUrl: 'https://example.com',
headers: [
{ key: 'key0', value: 'value0' },
{ key: 'key1', value: 'value1' },
],
auth: { serviceName: 'serviceName', signingRegion: 'us-east-1' },
}),
);
python
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.HttpsAction("https://example.com/endpoint",
confirmation_url="https://example.com",
headers=[actions.HttpActionHeader(key="key0", value="value0"), actions.HttpActionHeader(key="key1", value="value1")
],
auth=actions.HttpActionSigV4Auth(service_name="serviceName", signing_region="us-east-1")
))
java
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(
HttpsAction.Builder.create("https://example.com/endpoint")
.confirmationUrl("https://example.com")
.headers(List.of(HttpActionHeader.builder().key("key0").value("value0").build(), HttpActionHeader.builder().key("key1").value("value1").build()))
.auth(HttpActionSigV4Auth.builder().serviceName("serviceName").signingRegion("us-east-1").build())
.build());
csharp
// Install: dotnet add package Amazon.CDK.AWS.IoT.Actions.Alpha
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 HttpsAction("https://example.com/endpoint", new HttpsActionProps {
ConfirmationUrl = "https://example.com",
Headers = new [] { new HttpActionHeader { Key = "key0", Value = "value0" }, new HttpActionHeader { Key = "key1", Value = "value1" } },
Auth = new HttpActionSigV4Auth { ServiceName = "serviceName", SigningRegion = "us-east-1" }
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2
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.NewHttpsAction(jsii.String("https://example.com/endpoint"), &HttpsActionProps{
ConfirmationUrl: jsii.String("https://example.com"),
Headers: []HttpActionHeader{
&HttpActionHeader{
Key: jsii.String("key0"),
Value: jsii.String("value0"),
},
&HttpActionHeader{
Key: jsii.String("key1"),
Value: jsii.String("value1"),
},
},
Auth: &HttpActionSigV4Auth{
ServiceName: jsii.String("serviceName"),
SigningRegion: jsii.String("us-east-1"),
},
}))
Initializer
ts
new HttpsAction(url: string, props?: HttpsActionProps)
python
HttpsAction(url: str, props: typing.Optional[HttpsActionProps] = None)
java
new HttpsAction(String url, HttpsActionProps props)
csharp
new HttpsAction(string url, HttpsActionProps? props = null)
go
NewHttpsAction(Url *string, Props HttpsActionProps)