Skip to content

tag_resource

tag_resource(
    resource_arn: TNBResourceArn,
    tags: TagMap,
    *,
    config_overrides: Optional[tnbClientConfig] = None,
) -> TagResourceOutput

Tags an AWS TNB resource.

A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key and an optional value. You can use tags to search and filter your resources or track your Amazon Web Services costs.

Parameters:

  • resource_arn (TNBResourceArn) –

    Resource ARN.

  • tags (TagMap) –

    A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key and an optional value. You can use tags to search and filter your resources or track your Amazon Web Services costs.

Raises:

Source code in docs_src/capo_tnb/_services/tnb.py
def tag_resource(
    self,
    resource_arn: "capo_tnb.types.tnb_resource_arn.TNBResourceArn",
    tags: "capo_tnb.types.tag_map.TagMap",
    *,
    config_overrides: Optional[tnbClientConfig] = None,
) -> "capo_tnb.types.tag_resource_output.TagResourceOutput":
    """<p>Tags an AWS TNB resource.</p> <p>A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key and an optional value. You can use tags to search and filter your resources or track your Amazon Web Services costs.</p>

    Args:
        resource_arn: <p>Resource ARN.</p>
        tags: <p>A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key and an optional value. You can use tags to search and filter your resources or track your Amazon Web Services costs.</p>

    Raises:
        capo_tnb.errors.access_denied_exception.AccessDeniedException: <p>Insufficient permissions to make request.</p>
        capo_tnb.errors.internal_server_exception.InternalServerException: <p>Unexpected error occurred. Problem on the server.</p>
        capo_tnb.errors.resource_not_found_exception.ResourceNotFoundException: <p>Request references a resource that doesn't exist.</p>
        capo_tnb.errors.throttling_exception.ThrottlingException: <p>Exception caused by throttling.</p>
        capo_tnb.errors.validation_exception.ValidationException: <p>Unable to process the request because the client provided input failed to satisfy request constraints.</p>
        capo_tnb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = capo_tnb._operations.tnb.tag_resource.tag_resource(
            req.options, req.input
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_tnb.types.tag_resource_input.TagResourceInput",
    ) -> dict[str, Any]:
        import capo_tnb.types.tag_resource_input

        return capo_tnb.types.tag_resource_input.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("TagResource", redact_input=_redact_input),
    )
    input_: capo_tnb.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