Skip to content

tag_resource

tag_resource(
    resource_arn: ARN,
    tags: TagsMap,
    *,
    config_overrides: Optional[drsClientConfig] = None,
) -> None

Adds or overwrites only the specified tags for the specified Elastic Disaster Recovery resource or resources. When you specify an existing tag key, the value is overwritten with the new value. Each resource can have a maximum of 50 tags. Each tag consists of a key and optional value.

Parameters:

  • resource_arn (ARN) –

    ARN of the resource for which tags are to be added or updated.

  • tags (TagsMap) –

    Array of tags to be added or updated.

Raises:

Source code in docs_src/capo_drs/_services/drs.py
def tag_resource(
    self,
    resource_arn: "capo_drs.types.arn.ARN",
    tags: "capo_drs.types.tags_map.TagsMap",
    *,
    config_overrides: Optional[drsClientConfig] = None,
) -> None:
    """<p>Adds or overwrites only the specified tags for the specified Elastic Disaster Recovery resource or resources. When you specify an existing tag key, the value is overwritten with the new value. Each resource can have a maximum of 50 tags. Each tag consists of a key and optional value.</p>

    Args:
        resource_arn: <p>ARN of the resource for which tags are to be added or updated.</p>
        tags: <p>Array of tags to be added or updated.</p>

    Raises:
        capo_drs.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_drs.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_drs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource for this operation was not found.</p>
        capo_drs.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_drs.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the AWS service.</p>
        capo_drs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_drs.types.tag_resource_request.TagResourceRequest]",
    ) -> OperationResponse[None]:
        import capo_drs._operations.elastic_disaster_recovery_service.tag_resource

        output, http_response = (
            capo_drs._operations.elastic_disaster_recovery_service.tag_resource.tag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_drs.types.tag_resource_request.redact_sensitive(input_)

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