:doc:`AppConfig <../../appconfig>` / Client / list_environments

*****************
list_environments
*****************



.. py:method:: AppConfig.Client.list_environments(**kwargs)

  

  Lists the environments for an application.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/appconfig-2019-10-09/ListEnvironments>`_  


  **Request Syntax**
  ::

    response = client.list_environments(
        ApplicationId='string',
        MaxResults=123,
        NextToken='string'
    )
    
  :type ApplicationId: string
  :param ApplicationId: **[REQUIRED]** 

    The application ID.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

    

  
  :type NextToken: string
  :param NextToken: 

    A token to start the list. Use this token to get the next set of results.

    

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

    
    ::

      {
          'Items': [
              {
                  'ApplicationId': 'string',
                  'Id': 'string',
                  'Name': 'string',
                  'Description': 'string',
                  'State': 'READY_FOR_DEPLOYMENT'|'DEPLOYING'|'ROLLING_BACK'|'ROLLED_BACK'|'REVERTED',
                  'Monitors': [
                      {
                          'AlarmArn': 'string',
                          'AlarmRoleArn': 'string'
                      },
                  ]
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Items** *(list) --* 

        The elements from this collection.

        
        

        - *(dict) --* 
          

          - **ApplicationId** *(string) --* 

            The application ID.

            
          

          - **Id** *(string) --* 

            The environment ID.

            
          

          - **Name** *(string) --* 

            The name of the environment.

            
          

          - **Description** *(string) --* 

            The description of the environment.

            
          

          - **State** *(string) --* 

            The state of the environment. An environment can be in one of the following states: ``READY_FOR_DEPLOYMENT``, ``DEPLOYING``, ``ROLLING_BACK``, or ``ROLLED_BACK``

            
          

          - **Monitors** *(list) --* 

            Amazon CloudWatch alarms monitored during the deployment.

            
            

            - *(dict) --* 

              Amazon CloudWatch alarms to monitor during the deployment process.

              
              

              - **AlarmArn** *(string) --* 

                Amazon Resource Name (ARN) of the Amazon CloudWatch alarm.

                
              

              - **AlarmRoleArn** *(string) --* 

                ARN of an Identity and Access Management (IAM) role for AppConfig to monitor ``AlarmArn``.

                
          
        
      
    
      

      - **NextToken** *(string) --* 

        The token for the next set of items to return. Use this token to get the next set of results.

        
  
  **Exceptions**
  
  *   :py:class:`AppConfig.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`AppConfig.Client.exceptions.InternalServerException`

  
  *   :py:class:`AppConfig.Client.exceptions.BadRequestException`

  

  **Examples**

  The following list-environments example lists the available environments in your AWS account for the specified application.
  ::

    response = client.list_environments(
        ApplicationId='339ohji',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'Items': [
            {
                'ApplicationId': '339ohji',
                'Id': '54j1r29',
                'Name': 'Example-Environment',
                'State': 'READY_FOR_DEPLOYMENT',
            },
        ],
        'ResponseMetadata': {
            '...': '...',
        },
    }

  