Skip to content

tag_resource

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

Adds one or more tags to the specified resource.

Parameters:

  • resource_arn (Arn) –

    The Amazon Resource Name (ARN) of the resource.

  • tags (TagMap) –

    The tags to add to the resource.

Raises:

Source code in docs_src/capo_m2/_services/m2.py
def tag_resource(
    self,
    resource_arn: "capo_m2.types.arn.Arn",
    tags: "capo_m2.types.tag_map.TagMap",
    *,
    config_overrides: Optional[m2ClientConfig] = None,
) -> "capo_m2.types.tag_resource_response.TagResourceResponse":
    """<p>Adds one or more tags to the specified resource.</p>

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

    Raises:
        capo_m2.errors.access_denied_exception.AccessDeniedException: <p>The account or role doesn't have the right permissions to make the request.</p>
        capo_m2.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_m2.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_m2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>One or more quotas for Amazon Web Services Mainframe Modernization exceeds the limit.</p>
        capo_m2.errors.throttling_exception.ThrottlingException: <p>The number of requests made exceeds the limit.</p>
        capo_m2.errors.validation_exception.ValidationException: <p>One or more parameters provided in the request is not valid.</p>
        capo_m2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_m2._operations.aws_supernova_control_plane_service.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_m2.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