Skip to main content

topic_rules

Creates, updates, deletes, gets or lists a topic_rules resource.

Overview​

Nametopic_rules
TypeResource
Idaws.iot.topic_rules

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
ruleobjectThe rule.
rule_arnstringThe rule ARN.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_topic_ruleselectrule_name, regionGets information about the rule. Requires permission to access the GetTopicRule action.
list_topic_rulesselectregiontopic, maxResults, nextToken, ruleDisabledLists the rules for the specific topic. Requires permission to access the ListTopicRules action.
create_topic_ruleinsertrule_name, region, topicRulePayloadx-amz-taggingCreates a rule. Creating rules is an administrator-level action. Any user who has permission to create rules will be able to access data processed by the rule. Requires permission to access the CreateTopicRule action.
replace_topic_rulereplacerule_name, region, topicRulePayloadReplaces the rule. You must specify all parameters for the new rule. Creating rules is an administrator-level action. Any user who has permission to create rules will be able to access data processed by the rule. Requires permission to access the ReplaceTopicRule action.
delete_topic_ruledeleterule_name, regionDeletes the rule. Requires permission to access the DeleteTopicRule action.
confirm_topic_rule_destinationexecconfirmation_token, regionConfirms a topic rule destination. When you create a rule requiring a destination, IoT sends a confirmation message to the endpoint or base address you specify. The message includes a token which you pass back when calling ConfirmTopicRuleDestination to confirm that you own or have access to the endpoint. Requires permission to access the ConfirmTopicRuleDestination action.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
confirmation_tokenstringThe token used to confirm ownership or access to the topic rule confirmation URL.
regionstringAWS region (default: us-east-1)
rule_namestringThe name of the rule.
maxResultsintegerThe maximum number of results to return.
nextTokenstringTo retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.
ruleDisabledbooleanSpecifies whether the rule is disabled.
topicstringThe topic.
x-amz-taggingstringMetadata which can be used to manage the topic rule. For URI Request parameters use format: ...key1=value1&key2=value2... For the CLI command-line parameter use format: --tags "key1=value1&key2=value2..." For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."

SELECT examples​

Gets information about the rule. Requires permission to access the GetTopicRule action.

SELECT
rule,
rule_arn
FROM aws.iot.topic_rules
WHERE rule_name = '{{ rule_name }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples​

Creates a rule. Creating rules is an administrator-level action. Any user who has permission to create rules will be able to access data processed by the rule. Requires permission to access the CreateTopicRule action.

INSERT INTO aws.iot.topic_rules (
topicRulePayload,
rule_name,
region,
`x-amz-tagging`
)
SELECT
'{{ topicRulePayload }}' /* required */,
'{{ rule_name }}',
'{{ region }}',
'{{ x-amz-tagging }}'
;

REPLACE examples​

Replaces the rule. You must specify all parameters for the new rule. Creating rules is an administrator-level action. Any user who has permission to create rules will be able to access data processed by the rule. Requires permission to access the ReplaceTopicRule action.

REPLACE aws.iot.topic_rules
SET
topicRulePayload = '{{ topicRulePayload }}'
WHERE
rule_name = '{{ rule_name }}' --required
AND region = '{{ region }}' --required
AND topicRulePayload = '{{ topicRulePayload }}' --required;

DELETE examples​

Deletes the rule. Requires permission to access the DeleteTopicRule action.

DELETE FROM aws.iot.topic_rules
WHERE rule_name = '{{ rule_name }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods​

Confirms a topic rule destination. When you create a rule requiring a destination, IoT sends a confirmation message to the endpoint or base address you specify. The message includes a token which you pass back when calling ConfirmTopicRuleDestination to confirm that you own or have access to the endpoint. Requires permission to access the ConfirmTopicRuleDestination action.

EXEC aws.iot.topic_rules.confirm_topic_rule_destination
@confirmation_token='{{ confirmation_token }}' --required,
@region='{{ region }}' --required
;