Skip to content

tag_resource

tag_resource(
    resource_arn: LongStringAttribute,
    tags: TagsMap,
    *,
    config_overrides: Optional[ArtifactClientConfig] = None,
) -> TagResourceResponse

Add tags to a resource.

Parameters:

  • resource_arn (LongStringAttribute) –

    The Amazon Resource Name (ARN) of the resource.

  • tags (TagsMap) –

    Tags to add to the resource.

Raises:

Source code in docs_src/capo_artifact/_services/artifact.py
def tag_resource(
    self,
    resource_arn: "capo_artifact.types.long_string_attribute.LongStringAttribute",
    tags: "capo_artifact.types.tags_map.TagsMap",
    *,
    config_overrides: Optional[ArtifactClientConfig] = None,
) -> "capo_artifact.types.tag_resource_response.TagResourceResponse":
    """<p>Add tags to a resource.</p>

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

    Raises:
        capo_artifact.errors.access_denied_exception.AccessDeniedException: <p>User does not have sufficient access to perform this action.</p>
        capo_artifact.errors.internal_server_exception.InternalServerException: <p>An unknown server exception has occurred.</p>
        capo_artifact.errors.resource_not_found_exception.ResourceNotFoundException: <p>Request references a resource which does not exist.</p>
        capo_artifact.errors.throttling_exception.ThrottlingException: <p>Request was denied due to request throttling.</p>
        capo_artifact.errors.validation_exception.ValidationException: <p>Request fails to satisfy the constraints specified by an AWS service.</p>
        capo_artifact.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_artifact._operations.artifact.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_artifact.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