Skip to content

tag_resource

tag_resource(
    resource_arn: AmazonResourceName,
    tags: TagList,
    *,
    config_overrides: Optional[EndUserMessagingClientConfig] = None,
) -> TagResourceOutput

Adds or overwrites the tags on a resource.

Parameters:

  • resource_arn (AmazonResourceName) –

    The Amazon Resource Name (ARN) of the resource.

  • tags (TagList) –

    An array of key and value pair tags that are associated with the resource.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • InternalServerException –

    An unexpected error occurred during the processing of the request.

  • ResourceNotFoundException –

    The request references a resource that does not exist. Verify that the resource identifier is correct and try your request again.

  • ServiceQuotaExceededException –

    The request would exceed a service quota for your account.

  • ThrottlingException –

    The request was denied because it exceeded the allowed request rate.

  • ValidationException –

    A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Tag a resource

>>> client.tag_resource(resource_arn='arn:aws:end-user-messaging:us-east-1:123456789012:brand-profile/bp-abc12345678901234', tags=[{'key': 'Environment', 'value': 'Production'}])
Source code in docs_src/capo_endusermessaging/_services/end_user_messaging.py
def tag_resource(
    self,
    resource_arn: "capo_endusermessaging.types.amazon_resource_name.AmazonResourceName",
    tags: "capo_endusermessaging.types.tag_list.TagList",
    *,
    config_overrides: Optional[EndUserMessagingClientConfig] = None,
) -> "capo_endusermessaging.types.tag_resource_output.TagResourceOutput":
    """<p>Adds or overwrites the tags on a resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource.</p>
        tags: <p>An array of key and value pair tags that are associated with the resource.</p>

    Raises:
        capo_endusermessaging.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_endusermessaging.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_endusermessaging.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist. Verify that the resource identifier is correct and try your request again.</p>
        capo_endusermessaging.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota for your account.</p>
        capo_endusermessaging.errors.throttling_exception.ThrottlingException: <p>The request was denied because it exceeded the allowed request rate.</p>
        capo_endusermessaging.errors.validation_exception.ValidationException: A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
        capo_endusermessaging.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Tag a resource

        >>> client.tag_resource(resource_arn='arn:aws:end-user-messaging:us-east-1:123456789012:brand-profile/bp-abc12345678901234', tags=[{'key': 'Environment', 'value': 'Production'}])
    """

    def _handler(
        req: "OperationRequest[capo_endusermessaging.types.tag_resource_input.TagResourceInput]",
    ) -> OperationResponse[
        "capo_endusermessaging.types.tag_resource_output.TagResourceOutput"
    ]:
        import capo_endusermessaging._operations.end_user_messaging.tag_resource

        output, http_response = (
            capo_endusermessaging._operations.end_user_messaging.tag_resource.tag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TagResource")
    )
    input_: capo_endusermessaging.types.tag_resource_input.TagResourceInput = {
        "resource_arn": resource_arn,
        "tags": tags,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output