:doc:`ECS <../../ecs>` / Client / list_attributes

***************
list_attributes
***************



.. py:method:: ECS.Client.list_attributes(**kwargs)

  

  Lists the attributes for Amazon ECS resources within a specified target type and cluster. When you specify a target type and cluster, ``ListAttributes`` returns a list of attribute objects, one for each attribute on each resource. You can filter the list of results to a single attribute name to only return results that have that name. You can also filter the results by attribute name and value. You can do this, for example, to see which container instances in a cluster are running a Linux AMI ( ``ecs.os-type=linux``).

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListAttributes>`_  


  **Request Syntax**
  ::

    response = client.list_attributes(
        cluster='string',
        targetType='container-instance',
        attributeName='string',
        attributeValue='string',
        nextToken='string',
        maxResults=123
    )
    
  :type cluster: string
  :param cluster: 

    The short name or full Amazon Resource Name (ARN) of the cluster to list attributes. If you do not specify a cluster, the default cluster is assumed.

    

  
  :type targetType: string
  :param targetType: **[REQUIRED]** 

    The type of the target to list attributes with.

    

  
  :type attributeName: string
  :param attributeName: 

    The name of the attribute to filter the results with.

    

  
  :type attributeValue: string
  :param attributeValue: 

    The value of the attribute to filter results with. You must also specify an attribute name to use this parameter.

    

  
  :type nextToken: string
  :param nextToken: 

    The ``nextToken`` value returned from a ``ListAttributes`` request indicating that more results are available to fulfill the request and further calls are needed. If ``maxResults`` was provided, it's possible the number of results to be fewer than ``maxResults``.

     

    .. note::

      

      This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.

      

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of cluster results that ``ListAttributes`` returned in paginated output. When this parameter is used, ``ListAttributes`` only returns ``maxResults`` results in a single page along with a ``nextToken`` response element. The remaining results of the initial request can be seen by sending another ``ListAttributes`` request with the returned ``nextToken`` value. This value can be between 1 and 100. If this parameter isn't used, then ``ListAttributes`` returns up to 100 results and a ``nextToken`` value if applicable.

    

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

    
    ::

      {
          'attributes': [
              {
                  'name': 'string',
                  'value': 'string',
                  'targetType': 'container-instance',
                  'targetId': 'string'
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **attributes** *(list) --* 

        A list of attribute objects that meet the criteria of the request.

        
        

        - *(dict) --* 

          An attribute is a name-value pair that's associated with an Amazon ECS object. Use attributes to extend the Amazon ECS data model by adding custom metadata to your resources. For more information, see `Attributes <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html#attributes>`__ in the *Amazon Elastic Container Service Developer Guide*.

          
          

          - **name** *(string) --* 

            The name of the attribute. The ``name`` must contain between 1 and 128 characters. The name may contain letters (uppercase and lowercase), numbers, hyphens (-), underscores (_), forward slashes (/), back slashes (\), or periods (.).

            
          

          - **value** *(string) --* 

            The value of the attribute. The ``value`` must contain between 1 and 128 characters. It can contain letters (uppercase and lowercase), numbers, hyphens (-), underscores (_), periods (.), at signs (@), forward slashes (/), back slashes (\), colons (:), or spaces. The value can't start or end with a space.

            
          

          - **targetType** *(string) --* 

            The type of the target to attach the attribute with. This parameter is required if you use the short form ID for a resource instead of the full ARN.

            
          

          - **targetId** *(string) --* 

            The ID of the target. You can specify the short form ID for a resource or the full Amazon Resource Name (ARN).

            
      
    
      

      - **nextToken** *(string) --* 

        The ``nextToken`` value to include in a future ``ListAttributes`` request. When the results of a ``ListAttributes`` request exceed ``maxResults``, this value can be used to retrieve the next page of results. This value is ``null`` when there are no more results to return.

        
  
  **Exceptions**
  
  *   :py:class:`ECS.Client.exceptions.ClusterNotFoundException`

  
  *   :py:class:`ECS.Client.exceptions.InvalidParameterException`

  