Skip to content

create_destination async

create_destination(
    name: DestinationName,
    expression_type: ExpressionType,
    expression: Expression,
    role_arn: RoleArn,
    *,
    config_overrides: Optional[AsyncIoTWirelessClientConfig] = None,
    description: Optional[Description] = None,
    tags: Optional[TagList] = None,
    client_request_token: Optional[ClientRequestToken] = None,
) -> CreateDestinationResponse

Creates a new destination that maps a device message to an AWS IoT rule.

Parameters:

  • name (DestinationName) –

    The name of the new resource.

  • expression_type (ExpressionType) –

    The type of value in Expression.

  • expression (Expression) –

    The rule name or topic rule to send messages to.

  • description (Optional[Description], default: None ) –

    The description of the new resource.

  • role_arn (RoleArn) –

    The ARN of the IAM Role that authorizes the destination.

  • tags (Optional[TagList], default: None ) –

    The tags to attach to the new destination. Tags are metadata that you can use to manage a resource.

  • client_request_token (Optional[ClientRequestToken], default: None ) –

    Each resource must have a unique client request token. The client token is used to implement idempotency. It ensures that the request completes no more than one time. If you retry a request with the same token and the same parameters, the request will complete successfully. However, if you try to create a new resource using the same token but different parameters, an HTTP 409 conflict occurs. If you omit this value, AWS SDKs will automatically generate a unique client request. For more information about idempotency, see Ensuring idempotency in Amazon EC2 API requests.

Raises:

Source code in docs_src/capo_iot_wireless/_services/async_io_t_wireless.py
async def create_destination(
    self,
    name: "capo_iot_wireless.types.destination_name.DestinationName",
    expression_type: "capo_iot_wireless.types.expression_type.ExpressionType",
    expression: "capo_iot_wireless.types.expression.Expression",
    role_arn: "capo_iot_wireless.types.role_arn.RoleArn",
    *,
    config_overrides: Optional[AsyncIoTWirelessClientConfig] = None,
    description: Optional["capo_iot_wireless.types.description.Description"] = None,
    tags: Optional["capo_iot_wireless.types.tag_list.TagList"] = None,
    client_request_token: Optional[
        "capo_iot_wireless.types.client_request_token.ClientRequestToken"
    ] = None,
) -> (
    "capo_iot_wireless.types.create_destination_response.CreateDestinationResponse"
):
    """<p>Creates a new destination that maps a device message to an AWS IoT rule.</p>

    Args:
        name: <p>The name of the new resource.</p>
        expression_type: <p>The type of value in <code>Expression</code>.</p>
        expression: <p>The rule name or topic rule to send messages to.</p>
        description: <p>The description of the new resource.</p>
        role_arn: <p>The ARN of the IAM Role that authorizes the destination.</p>
        tags: <p>The tags to attach to the new destination. Tags are metadata that you can use to manage a resource.</p>
        client_request_token: <p>Each resource must have a unique client request token. The client token is used to implement idempotency. It ensures that the request completes no more than one time. If you retry a request with the same token and the same parameters, the request will complete successfully. However, if you try to create a new resource using the same token but different parameters, an HTTP 409 conflict occurs. If you omit this value, AWS SDKs will automatically generate a unique client request. For more information about idempotency, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency in Amazon EC2 API requests</a>.</p>

    Raises:
        capo_iot_wireless.errors.access_denied_exception.AccessDeniedException: <p>User does not have permission to perform this action.</p>
        capo_iot_wireless.errors.conflict_exception.ConflictException: <p>Adding, updating, or deleting the resource can cause an inconsistent state.</p>
        capo_iot_wireless.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred while processing a request.</p>
        capo_iot_wireless.errors.resource_not_found_exception.ResourceNotFoundException: <p>Resource does not exist.</p>
        capo_iot_wireless.errors.throttling_exception.ThrottlingException: <p>The request was denied because it exceeded the allowed API request rate.</p>
        capo_iot_wireless.errors.validation_exception.ValidationException: <p>The input did not meet the specified constraints.</p>
        capo_iot_wireless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot_wireless.types.create_destination_request.CreateDestinationRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot_wireless.types.create_destination_response.CreateDestinationResponse"
    ]:
        import capo_iot_wireless._operations.iotwireless.create_destination

        (
            output,
            http_response,
        ) = await capo_iot_wireless._operations.iotwireless.create_destination.async_create_destination(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDestination")
    )
    input_: capo_iot_wireless.types.create_destination_request.CreateDestinationRequest = {
        "name": name,
        "expression_type": expression_type,
        "expression": expression,
        "role_arn": role_arn,
    }
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output