Skip to content

tag_resource

tag_resource(
    resource_arn: Arn,
    tags: TagList,
    *,
    config_overrides: Optional[codeartifactClientConfig] = None,
) -> TagResourceResult

Adds or updates tags for a resource in CodeArtifact.

Parameters:

  • resource_arn (Arn) –

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

  • tags (TagList) –

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

Raises:

  • AccessDeniedException –

    The operation did not succeed because of an unauthorized access attempt.

  • ResourceNotFoundException –

    The operation did not succeed because the resource requested is not found in the service.

  • ServiceQuotaExceededException –

    The operation did not succeed because it would have exceeded a service limit for your account.

  • ThrottlingException –

    The operation did not succeed because too many requests are sent to the service.

  • ValidationException –

    The operation did not succeed because a parameter in the request was sent with an invalid value.

  • UnknownServiceError –

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

Source code in docs_src/capo_codeartifact/_services/codeartifact.py
def tag_resource(
    self,
    resource_arn: "capo_codeartifact.types.arn.Arn",
    tags: "capo_codeartifact.types.tag_list.TagList",
    *,
    config_overrides: Optional[codeartifactClientConfig] = None,
) -> "capo_codeartifact.types.tag_resource_result.TagResourceResult":
    """<p>Adds or updates tags for a resource in CodeArtifact.</p>

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

    Raises:
        capo_codeartifact.errors.access_denied_exception.AccessDeniedException: <p> The operation did not succeed because of an unauthorized access attempt. </p>
        capo_codeartifact.errors.resource_not_found_exception.ResourceNotFoundException: <p> The operation did not succeed because the resource requested is not found in the service. </p>
        capo_codeartifact.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> The operation did not succeed because it would have exceeded a service limit for your account. </p>
        capo_codeartifact.errors.throttling_exception.ThrottlingException: <p> The operation did not succeed because too many requests are sent to the service. </p>
        capo_codeartifact.errors.validation_exception.ValidationException: <p> The operation did not succeed because a parameter in the request was sent with an invalid value. </p>
        capo_codeartifact.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codeartifact.types.tag_resource_request.TagResourceRequest]",
    ) -> OperationResponse[
        "capo_codeartifact.types.tag_resource_result.TagResourceResult"
    ]:
        import capo_codeartifact._operations.code_artifact_control_plane_service.tag_resource

        output, http_response = (
            capo_codeartifact._operations.code_artifact_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_codeartifact.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