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.
Parameters:
-
rule_name
(RuleName)
–
-
topic_rule_payload
(TopicRulePayload)
–
-
tags
(Optional[String], default:
None
)
–
Metadata 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..."
Raises:
Source code in docs_src/capo_iot/_services/async_io_t.py
| async def create_topic_rule(
self,
rule_name: "capo_iot.types.rule_name.RuleName",
topic_rule_payload: "capo_iot.types.topic_rule_payload.TopicRulePayload",
*,
config_overrides: Optional[AsyncIoTClientConfig] = None,
tags: Optional["capo_iot.types.string.String"] = None,
) -> None:
"""<p>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.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateTopicRule</a> action.</p>
Args:
rule_name: <p>The name of the rule.</p>
topic_rule_payload: <p>The rule payload.</p>
tags: <p>Metadata which can be used to manage the topic rule.</p> <note> <p>For URI Request parameters use format: ...key1=value1&key2=value2...</p> <p>For the CLI command-line parameter use format: --tags "key1=value1&key2=value2..."</p> <p>For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."</p> </note>
Raises:
capo_iot.errors.conflicting_resource_update_exception.ConflictingResourceUpdateException: <p>A conflicting resource update exception. This exception is thrown when two pending updates cause a conflict.</p>
capo_iot.errors.internal_exception.InternalException: <p>An unexpected error has occurred.</p>
capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
capo_iot.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource already exists.</p>
capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
capo_iot.errors.sql_parse_exception.SqlParseException: <p>The Rule-SQL expression can't be parsed correctly.</p>
capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_iot.types.create_topic_rule_request.CreateTopicRuleRequest]",
) -> AsyncOperationResponse[None]:
import capo_iot._operations.aws_iot_service.create_topic_rule
(
output,
http_response,
) = await capo_iot._operations.aws_iot_service.create_topic_rule.async_create_topic_rule(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateTopicRule")
)
input_: capo_iot.types.create_topic_rule_request.CreateTopicRuleRequest = {
"rule_name": rule_name,
"topic_rule_payload": topic_rule_payload,
}
if tags is not None:
input_["tags"] = tags
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|