:doc:`ServiceDiscovery <../../servicediscovery>` / Client / tag_resource

************
tag_resource
************



.. py:method:: ServiceDiscovery.Client.tag_resource(**kwargs)

  

  Adds one or more tags to the specified resource.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/servicediscovery-2017-03-14/TagResource>`_  


  **Request Syntax**
  ::

    response = client.tag_resource(
        ResourceARN='string',
        Tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    )
    
  :type ResourceARN: string
  :param ResourceARN: **[REQUIRED]** 

    The Amazon Resource Name (ARN) of the resource that you want to retrieve tags for.

    

  
  :type Tags: list
  :param Tags: **[REQUIRED]** 

    The tags to add to the specified resource. Specifying the tag key is required. You can set the value of a tag to an empty string, but you can't set the value of a tag to null.

    

  
    - *(dict) --* 

      A custom key-value pair that's associated with a resource.

      

    
      - **Key** *(string) --* **[REQUIRED]** 

        The key identifier, or name, of the tag.

        

      
      - **Value** *(string) --* **[REQUIRED]** 

        The string value that's associated with the key of the tag. You can set the value of a tag to an empty string, but you can't set the value of a tag to null.

        

      
    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 
  
  **Exceptions**
  
  *   :py:class:`ServiceDiscovery.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`ServiceDiscovery.Client.exceptions.TooManyTagsException`

  
  *   :py:class:`ServiceDiscovery.Client.exceptions.InvalidInput`

  

  **Examples**

  This example adds "Department" and "Project" tags to a resource.
  ::

    response = client.tag_resource(
        ResourceARN='arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-ylexjili4cdxy3xm',
        Tags=[
            {
                'Key': 'Department',
                'Value': 'Engineering',
            },
            {
                'Key': 'Project',
                'Value': 'Zeta',
            },
        ],
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'ResponseMetadata': {
            '...': '...',
        },
    }

  