

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

# Marcação de domínios (AWS SDKs)
<a name="managedomains-awsresourcetagging-sdk"></a>

O AWS SDKs (exceto o Android e o iOS SDKs) suporta todas as ações definidas na [Amazon OpenSearch Service API Reference](https://docs.aws.amazon.com/opensearch-service/latest/APIReference/Welcome.html)`AddTags`, incluindo as `RemoveTags` operações`ListTags`, e. Para obter mais informações sobre como instalar e usar o AWS SDKs, consulte [Kits AWS de desenvolvimento de software](https://aws.amazon.com/code). 

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

Este exemplo usa o cliente Python de [OpenSearchService](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/opensearch.html)baixo nível AWS do SDK para Python (Boto) para adicionar uma tag a um domínio, listar a tag anexada ao domínio e remover uma tag do domínio. É necessário fornecer valores para `DOMAIN_ARN`, `TAG_KEY` e `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
```