Skip to content

tag_resource

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

Adds or overwrites only the specified tags for the specified resource. When you specify an existing tag key, the value is overwritten with the new value.

Parameters:

  • resource_arn (Arn) –

    The Amazon Resource Name (ARN) of the resource to tag.

  • tags (TagList) –

    The tags to add to the resource.

Raises:

Source code in docs_src/capo_socialmessaging/_services/social_messaging.py
def tag_resource(
    self,
    resource_arn: "capo_socialmessaging.types.arn.Arn",
    tags: "capo_socialmessaging.types.tag_list.TagList",
    *,
    config_overrides: Optional[SocialMessagingClientConfig] = None,
) -> "capo_socialmessaging.types.tag_resource_output.TagResourceOutput":
    """<p>Adds or overwrites only the specified tags for the specified resource. When you specify an existing tag key, the value is overwritten with the new value.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource to tag.</p>
        tags: <p>The tags to add to the resource.</p>

    Raises:
        capo_socialmessaging.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_socialmessaging.errors.validation_exception.ValidationException: <p>The request contains an invalid parameter value. </p>
        capo_socialmessaging.errors.internal_service_exception.InternalServiceException: <p>The request processing has failed because of an unknown error, exception, or failure.</p>
        capo_socialmessaging.errors.invalid_parameters_exception.InvalidParametersException: <p>One or more parameters provided to the action are not valid.</p>
        capo_socialmessaging.errors.throttled_request_exception.ThrottledRequestException: <p>The request was denied due to request throttling.</p>
        capo_socialmessaging.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_socialmessaging._operations.social_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_socialmessaging.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