Skip to content

create_tags async

create_tags(
    *,
    config_overrides: Optional[AsyncRedshiftClientConfig] = None,
    resource_name: Optional[String] = None,
    tags: Optional[TagList] = None,
) -> None

Adds tags to a cluster.

A resource can have up to 50 tags. If you try to create more than 50 tags for a resource, you will receive an error and the attempt will fail.

If you specify a key that already exists for the resource, the value for that key will be updated with the new value.

Parameters:

  • resource_name (Optional[String], default: None ) –

    The Amazon Resource Name (ARN) to which you want to add the tag or tags. For example, arn:aws:redshift:us-east-2:123456789:cluster:t1.

  • tags (Optional[TagList], default: None ) –

    One or more name/value pairs to add as tags to the specified resource. Each tag name is passed in with the parameter Key and the corresponding value is passed in with the parameter Value. The Key and Value parameters are separated by a comma (,). Separate multiple tags with a space. For example, --tags "Key"="owner","Value"="admin" "Key"="environment","Value"="test" "Key"="version","Value"="1.0".

Raises:

Source code in docs_src/capo_redshift/_services/async_redshift.py
async def create_tags(
    self,
    *,
    config_overrides: Optional[AsyncRedshiftClientConfig] = None,
    resource_name: Optional["capo_redshift.types.string.String"] = None,
    tags: Optional["capo_redshift.types.tag_list.TagList"] = None,
) -> None:
    """<p>Adds tags to a cluster.</p> <p>A resource can have up to 50 tags. If you try to create more than 50 tags for a resource, you will receive an error and the attempt will fail.</p> <p>If you specify a key that already exists for the resource, the value for that key will be updated with the new value.</p>

    Args:
        resource_name: <p>The Amazon Resource Name (ARN) to which you want to add the tag or tags. For example, <code>arn:aws:redshift:us-east-2:123456789:cluster:t1</code>. </p>
        tags: <p>One or more name/value pairs to add as tags to the specified resource. Each tag name is passed in with the parameter <code>Key</code> and the corresponding value is passed in with the parameter <code>Value</code>. The <code>Key</code> and <code>Value</code> parameters are separated by a comma (,). Separate multiple tags with a space. For example, <code>--tags "Key"="owner","Value"="admin" "Key"="environment","Value"="test" "Key"="version","Value"="1.0"</code>. </p>

    Raises:
        capo_redshift.errors.invalid_cluster_state_fault.InvalidClusterStateFault: <p>The specified cluster is not in the <code>available</code> state. </p>
        capo_redshift.errors.invalid_tag_fault.InvalidTagFault: <p>The tag is invalid.</p>
        capo_redshift.errors.resource_not_found_fault.ResourceNotFoundFault: <p>The resource could not be found.</p>
        capo_redshift.errors.tag_limit_exceeded_fault.TagLimitExceededFault: <p>You have exceeded the number of tags allowed.</p>
        capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_redshift.types.create_tags_message.CreateTagsMessage]",
    ) -> AsyncOperationResponse[None]:
        import capo_redshift._operations.redshift_service_version20121201.create_tags

        (
            output,
            http_response,
        ) = await capo_redshift._operations.redshift_service_version20121201.create_tags.async_create_tags(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTags")
    )
    input_: capo_redshift.types.create_tags_message.CreateTagsMessage = {}
    if resource_name is not None:
        input_["resource_name"] = resource_name
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output