

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# ドメインのタグ付け (AWS SDKs)
<a name="managedomains-awsresourcetagging-sdk"></a>

 AWS SDKs (Android および iOS SDKs を除く) は、、、`ListTags`および `RemoveTags`オペレーションを含む`AddTags`、[Amazon OpenSearch Service API リファレンス](https://docs.aws.amazon.com/opensearch-service/latest/APIReference/Welcome.html)で定義されているすべてのアクションをサポートします。 AWS SDKs[AWS 「 Software Development Kits](https://aws.amazon.com/code)」を参照してください。

## **Python**
<a name="pythonsample"></a>

この例では、 AWS SDK for Python (Boto) の [OpenSearchService](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/opensearch.html) 低レベル Python クライアントを使用して、ドメインにタグを追加し、ドメインにアタッチされたタグを一覧表示し、ドメインからタグを削除します。`DOMAIN_ARN`、`TAG_KEY` および `TAG_VALUE` の値を指定する必要があります。

```
import boto3
from botocore.config import Config  # import configuration

DOMAIN_ARN = ''  # ARN for the domain. i.e "arn:aws:es:us-east-1:123456789012:domain/my-domain
TAG_KEY = ''  # The name of the tag key. i.e 'Smileyface'
TAG_VALUE = ''  # The value assigned to the tag. i.e 'Practicetag'

# defines the configurations parameters such as region

my_config = Config(region_name='us-east-1')
client = boto3.client('opensearch', config=my_config)


# defines the client variable

def addTags():
    """Adds tags to the domain"""

    response = client.add_tags(ARN=DOMAIN_ARN,
                               TagList=[{'Key': TAG_KEY,
                                         'Value': TAG_VALUE}])

    print(response)


def listTags():
    """List tags that have been added to the domain"""

    response = client.list_tags(ARN=DOMAIN_ARN)
    print(response)


def removeTags():
    """Remove tags that have been added to the domain"""

    response = client.remove_tags(ARN=DOMAIN_ARN, TagKeys=[TAG_KEY])

    print('Tag removed')
    return response
```