:doc:`Batch <../../batch>` / Client / tag_resource

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



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

  

  Associates the specified tags to a resource with the specified ``resourceArn``. If existing tags on a resource aren't specified in the request parameters, they aren't changed. When a resource is deleted, the tags that are associated with that resource are deleted as well. Batch resources that support tags are compute environments, jobs, job definitions, job queues, and scheduling policies. ARNs for child jobs of array and multi-node parallel (MNP) jobs aren't supported.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/TagResource>`_  


  **Request Syntax**
  ::

    response = client.tag_resource(
        resourceArn='string',
        tags={
            'string': 'string'
        }
    )
    
  :type resourceArn: string
  :param resourceArn: **[REQUIRED]** 

    The Amazon Resource Name (ARN) of the resource that tags are added to. Batch resources that support tags are compute environments, jobs, job definitions, job queues, and scheduling policies. ARNs for child jobs of array and multi-node parallel (MNP) jobs aren't supported.

    

  
  :type tags: dict
  :param tags: **[REQUIRED]** 

    The tags that you apply to the resource to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see `Tagging Amazon Web Services Resources <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html>`__ in *Amazon Web Services General Reference*.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


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

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 
  
  **Exceptions**
  
  *   :py:class:`Batch.Client.exceptions.ClientException`

  
  *   :py:class:`Batch.Client.exceptions.ServerException`

  

  **Examples**

  This demonstrates calling the TagResource action.
  ::

    response = client.tag_resource(
        resourceArn='arn:aws:batch:us-east-1:123456789012:job-definition/sleep30:1',
        tags={
            'Stage': 'Alpha',
        },
    )
    
    print(response)

  
  Expected Output:
  ::

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

  