Skip to content

tag_resource

tag_resource(
    resource_arn: AmazonResourceName,
    tags: TagList,
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
) -> TagResourceResponse

Assigns one or more tags to a resource.

Parameters:

  • resource_arn (AmazonResourceName) –

    The Amazon Resource Name (ARN) of the resource to tag.

  • tags (TagList) –

    The map of the key-value pairs used to tag the resource.

Raises:

Source code in docs_src/capo_redshift_serverless/_services/redshift_serverless.py
def tag_resource(
    self,
    resource_arn: "capo_redshift_serverless.types.amazon_resource_name.AmazonResourceName",
    tags: "capo_redshift_serverless.types.tag_list.TagList",
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
) -> "capo_redshift_serverless.types.tag_resource_response.TagResourceResponse":
    """<p>Assigns one or more tags to a resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource to tag.</p>
        tags: <p>The map of the key-value pairs used to tag the resource.</p>

    Raises:
        capo_redshift_serverless.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_redshift_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_redshift_serverless.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_redshift_serverless.errors.too_many_tags_exception.TooManyTagsException: <p>The request exceeded the number of tags allowed for a resource.</p>
        capo_redshift_serverless.errors.validation_exception.ValidationException: <p>The input failed to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_redshift_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_redshift_serverless._operations.redshift_serverless.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_redshift_serverless.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