Bucket tag

Last updated: 2020-03-20 09:55:48

PDF

Note

This document provides an overview of API on Bucket tags and sample SDK code.

API Operation name pedagogical operation
PUT Bucket tagging Set Bucket tag Set the label for the existing Bucket
GET Bucket tagging Query Bucket tag Query the existing Bucket tags under the specified Bucket
DELETE Bucket tagging Delete Bucket tag Delete the specified Bucket tag

Set Bucket tag

Function description

PUT Bucket tagging is used to label the existing Bucket.

Method prototype

put_bucket_tagging(Bucket, Tagging={}, **kwargs)

Request Sample

response = client.put_bucket_tagging(
    Bucket='examplebucket-1250000000',
    Tagging={
        'TagSet': {
            'Tag': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ]
        }
    }
)

Parameter description

Parameter name Parameter description Type Required/Optional
Bucket Bucket is tagged in BucketName-APPID format. For more information, please see Naming convention String Yes
tag Collection of tags List Yes
Key The Key, length of the label is no more than 128 bytes, and supports English letters, numbers, spaces, plus sign, minus sign, underscore, equal sign, period, colon and slash String Yes
Value The Value, length of the label is no more than 256 bytes, and supports English letters, numbers, spaces, plus sign, minus sign, underscore, equal sign, period, colon and slash String Yes

Return result description

The return value of this method is None.

Query Bucket tag

Function description

GET Bucket tagging is used to query the existing Bucket tags under the specified Bucket.

Method prototype

get_bucket_tagging(Bucket, **kwargs)

Request Sample

response = client.get_bucket_tagging(
    Bucket='examplebucket-1250000000'
)

Parameter description |

Parameter name Parameter description Type Required/Optional
Bucket Query the tag Bucket in BucketName-APPID format. For more information, please see Naming convention String Yes

Return result description

The Bucket tag manages the list of type dict.

{
    'TagSet': {
        'Tag': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    }
}
Parameter name Parameter description Type
tag Collection of tags List
Key The Key, length of the label is no more than 128 bytes, and supports English letters, numbers, spaces, plus sign, minus sign, underscore, equal sign, period, colon and slash String
Value The Value, length of the label is no more than 256 bytes, and supports English letters, numbers, spaces, plus sign, minus sign, underscore, equal sign, period, colon and slash String

Delete Bucket tag

Function description

DELETE Bucket tagging is used to delete the existing Bucket tag under the specified Bucket.

Method prototype

delete_bucket_tagging(Bucket, **kwargs)

Request Sample

response = client.delete_bucket_tagging(
    Bucket='examplebucket-1250000000'
)

Parameter description

Parameter name Parameter description Type Required/Optional
Bucket Bucket with the deleted tag is in BucketName-APPID format. For more information, please see Naming convention String Yes

Return result description

The return value of this method is None.