:doc:`DirectoryServiceData <../../ds-data>` / Client / list_groups

***********
list_groups
***********



.. py:method:: DirectoryServiceData.Client.list_groups(**kwargs)

  

  Returns group information for the specified directory.

   

  This operation supports pagination with the use of the ``NextToken`` request and response parameters. If more results are available, the ``ListGroups.NextToken`` member contains a token that you pass in the next call to ``ListGroups``. This retrieves the next set of items.

   

  You can also specify a maximum number of return results with the ``MaxResults`` parameter.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/directory-service-data-2023-05-31/ListGroups>`_  


  **Request Syntax**
  ::

    response = client.list_groups(
        DirectoryId='string',
        MaxResults=123,
        NextToken='string',
        Realm='string'
    )
    
  :type DirectoryId: string
  :param DirectoryId: **[REQUIRED]** 

    The identifier (ID) of the directory that's associated with the group.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of results to be returned per request.

    

  
  :type NextToken: string
  :param NextToken: 

    An encoded paging token for paginated calls that can be passed back to retrieve the next page.

    

  
  :type Realm: string
  :param Realm: 

    The domain name associated with the directory.

     

    .. note::

      

      This parameter is optional, so you can return groups outside of your Managed Microsoft AD domain. When no value is defined, only your Managed Microsoft AD groups are returned.

       

      This value is case insensitive.

      

    

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

    
    ::

      {
          'DirectoryId': 'string',
          'Groups': [
              {
                  'GroupScope': 'DomainLocal'|'Global'|'Universal'|'BuiltinLocal',
                  'GroupType': 'Distribution'|'Security',
                  'SAMAccountName': 'string',
                  'SID': 'string'
              },
          ],
          'NextToken': 'string',
          'Realm': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **DirectoryId** *(string) --* 

        The identifier (ID) of the directory that's associated with the group.

        
      

      - **Groups** *(list) --* 

        The group information that the request returns.

        
        

        - *(dict) --* 

          A structure containing a subset of fields of a group object from a directory.

          
          

          - **GroupScope** *(string) --* 

            The scope of the AD group. For details, see `Active Directory security groups <https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-groups#group-scope>`__.

            
          

          - **GroupType** *(string) --* 

            The AD group type. For details, see `Active Directory security group type <https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-groups#how-active-directory-security-groups-work>`__.

            
          

          - **SAMAccountName** *(string) --* 

            The name of the group.

            
          

          - **SID** *(string) --* 

            The unique security identifier (SID) of the group.

            
      
    
      

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

        An encoded paging token for paginated calls that can be passed back to retrieve the next page.

        
      

      - **Realm** *(string) --* 

        The domain name associated with the group.

        
  
  **Exceptions**
  
  *   :py:class:`DirectoryServiceData.Client.exceptions.AccessDeniedException`

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

  
  *   :py:class:`DirectoryServiceData.Client.exceptions.ValidationException`

  
  *   :py:class:`DirectoryServiceData.Client.exceptions.DirectoryUnavailableException`

  
  *   :py:class:`DirectoryServiceData.Client.exceptions.ThrottlingException`

  