Skip to content

tag_resource

tag_resource(
    resource_arn: Arn,
    tags: TagMap,
    *,
    config_overrides: Optional[resiliencehubClientConfig] = None,
) -> TagResourceResponse

Applies one or more tags to a resource.

Parameters:

  • resource_arn (Arn) –

    Amazon Resource Name (ARN) of the resource.

  • tags (TagMap) –

    The tags to assign to the resource. Each tag consists of a key/value pair.

Raises:

  • AccessDeniedException –

    You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions.

  • InternalServerException –

    This exception occurs when there is an internal failure in the Resilience Hub service.

  • ResourceNotFoundException –

    This exception occurs when the specified resource could not be found.

  • ThrottlingException –

    This exception occurs when you have exceeded the limit on the number of requests per second.

  • ValidationException –

    This exception occurs when a request is not valid.

  • UnknownServiceError –

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

Source code in docs_src/capo_resiliencehub/_services/resiliencehub.py
def tag_resource(
    self,
    resource_arn: "capo_resiliencehub.types.arn.Arn",
    tags: "capo_resiliencehub.types.tag_map.TagMap",
    *,
    config_overrides: Optional[resiliencehubClientConfig] = None,
) -> "capo_resiliencehub.types.tag_resource_response.TagResourceResponse":
    """<p>Applies one or more tags to a resource.</p>

    Args:
        resource_arn: <p>Amazon Resource Name (ARN) of the resource. </p>
        tags: <p>The tags to assign to the resource. Each tag consists of a key/value pair.</p>

    Raises:
        capo_resiliencehub.errors.access_denied_exception.AccessDeniedException: <p>You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions.</p>
        capo_resiliencehub.errors.internal_server_exception.InternalServerException: <p>This exception occurs when there is an internal failure in the Resilience Hub service.</p>
        capo_resiliencehub.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception occurs when the specified resource could not be found.</p>
        capo_resiliencehub.errors.throttling_exception.ThrottlingException: <p>This exception occurs when you have exceeded the limit on the number of requests per second.</p>
        capo_resiliencehub.errors.validation_exception.ValidationException: <p>This exception occurs when a request is not valid.</p>
        capo_resiliencehub.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_resiliencehub.types.tag_resource_request.TagResourceRequest]",
    ) -> OperationResponse[
        "capo_resiliencehub.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_resiliencehub._operations.aws_resilience_hub.tag_resource

        output, http_response = (
            capo_resiliencehub._operations.aws_resilience_hub.tag_resource.tag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_resiliencehub.types.tag_resource_request.TagResourceRequest",
    ) -> dict[str, Any]:
        import capo_resiliencehub.types.tag_resource_request

        return capo_resiliencehub.types.tag_resource_request.redact_sensitive(
            input_
        )

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