StorageGateway / Client / add_tags_to_resource

add_tags_to_resource#

StorageGateway.Client.add_tags_to_resource(**kwargs)#

Adds one or more tags to the specified resource. You use tags to add metadata to resources, which you can use to categorize these resources. For example, you can categorize resources by purpose, owner, environment, or team. Each tag consists of a key and a value, which you define. You can add tags to the following Storage Gateway resources:

  • Storage gateways of all types

  • Storage volumes

  • Virtual tapes

  • NFS and SMB file shares

  • File System associations

You can create a maximum of 50 tags for each resource. Virtual tapes and storage volumes that are recovered to a new gateway maintain their tags.

See also: AWS API Documentation

Request Syntax

response = client.add_tags_to_resource(
    ResourceARN='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
Parameters:
  • ResourceARN (string) –

    [REQUIRED]

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

  • Tags (list) –

    [REQUIRED]

    The key-value pair that represents the tag you want to add to the resource. The value can be an empty string.

    Note

    Valid characters for key and value are letters, spaces, and numbers representable in UTF-8 format, and the following special characters: + - = . _ : / @. The maximum length of a tag’s key is 128 characters, and the maximum length for a tag’s value is 256.

    • (dict) –

      A key-value pair that helps you manage, filter, and search for your resource. Allowed characters: letters, white space, and numbers, representable in UTF-8, and the following characters: + - = . _ : /.

      • Key (string) – [REQUIRED]

        Tag key. The key can’t start with aws:.

      • Value (string) – [REQUIRED]

        Value of the tag key.

Return type:

dict

Returns:

Response Syntax

{
    'ResourceARN': 'string'
}

Response Structure

  • (dict) –

    AddTagsToResourceOutput

    • ResourceARN (string) –

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

Exceptions

Examples

Adds one or more tags to the specified resource.

response = client.add_tags_to_resource(
    ResourceARN='arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B',
    Tags=[
        {
            'Key': 'Dev Gatgeway Region',
            'Value': 'East Coast',
        },
    ],
)

print(response)

Expected Output:

{
    'ResourceARN': 'arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-11A2222B',
    'ResponseMetadata': {
        '...': '...',
    },
}