Skip to content

tag_resource

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

Adds to or modifies the tags of the given resource. Tags are metadata that can be used to manage a resource.

Parameters:

  • resource_arn (ResourceArn) –

    The Amazon Resource Name (ARN) of the resource you want to add tags to.

  • tags (TagList) –

    The tags you want to modify or add to the resource.

Raises:

Source code in docs_src/capo_codepipeline/_services/code_pipeline.py
def tag_resource(
    self,
    resource_arn: "capo_codepipeline.types.resource_arn.ResourceArn",
    tags: "capo_codepipeline.types.tag_list.TagList",
    *,
    config_overrides: Optional[CodePipelineClientConfig] = None,
) -> "capo_codepipeline.types.tag_resource_output.TagResourceOutput":
    """<p>Adds to or modifies the tags of the given resource. Tags are metadata that can be used to manage a resource. </p>

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

    Raises:
        capo_codepipeline.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Unable to modify the tag due to a simultaneous update request.</p>
        capo_codepipeline.errors.invalid_arn_exception.InvalidArnException: <p>The specified resource ARN is invalid.</p>
        capo_codepipeline.errors.invalid_tags_exception.InvalidTagsException: <p>The specified resource tags are invalid.</p>
        capo_codepipeline.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource was specified in an invalid format.</p>
        capo_codepipeline.errors.too_many_tags_exception.TooManyTagsException: <p>The tags limit for a resource has been exceeded.</p>
        capo_codepipeline.errors.validation_exception.ValidationException: <p>The validation was specified in an invalid format.</p>
        capo_codepipeline.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_codepipeline._operations.code_pipeline_20150709.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_codepipeline.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