list_roots

Organizations.Client.list_roots(**kwargs)

Lists the roots that are defined in the current organization.

Note

Always check the NextToken response parameter for a null value when calling a List* operation. These operations can occasionally return an empty set of results even when there are more results available. The NextToken response parameter value is null only when there are no more results to display.

This operation can be called only from the organization's management account or by a member account that is a delegated administrator for an Amazon Web Services service.

Note

Policy types can be enabled and disabled in roots. This is distinct from whether they're available in the organization. When you enable all features, you make policy types available for use in that organization. Individual policy types can then be enabled and disabled in a root. To see the availability of a policy type in an organization, use DescribeOrganization.

See also: AWS API Documentation

Request Syntax

response = client.list_roots(
    NextToken='string',
    MaxResults=123
)
Parameters
  • NextToken (string) -- The parameter for receiving additional results if you receive a NextToken response in a previous request. A NextToken response indicates that more output is available. Set this parameter to the value of the previous call's NextToken response to indicate where the output should continue from.
  • MaxResults (integer) -- The total number of results that you want included on each page of the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.
Return type

dict

Returns

Response Syntax

{
    'Roots': [
        {
            'Id': 'string',
            'Arn': 'string',
            'Name': 'string',
            'PolicyTypes': [
                {
                    'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY'|'BACKUP_POLICY'|'AISERVICES_OPT_OUT_POLICY',
                    'Status': 'ENABLED'|'PENDING_ENABLE'|'PENDING_DISABLE'
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Roots (list) --

      A list of roots that are defined in an organization.

      • (dict) --

        Contains details about a root. A root is a top-level parent node in the hierarchy of an organization that can contain organizational units (OUs) and accounts. The root contains every Amazon Web Services account in the organization.

        • Id (string) --

          The unique identifier (ID) for the root.

          The regex pattern for a root ID string requires "r-" followed by from 4 to 32 lowercase letters or digits.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the root.

          For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the Amazon Web Services Service Authorization Reference .

        • Name (string) --

          The friendly name of the root.

          The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

        • PolicyTypes (list) --

          The types of policies that are currently enabled for the root and therefore can be attached to the root or to its OUs or accounts.

          Note

          Even if a policy type is shown as available in the organization, you can separately enable and disable them at the root level by using EnablePolicyType and DisablePolicyType. Use DescribeOrganization to see the availability of the policy types in that organization.

          • (dict) --

            Contains information about a policy type and its status in the associated root.

            • Type (string) --

              The name of the policy type.

            • Status (string) --

              The status of the policy type as it relates to the associated root. To attach a policy of the specified type to a root or to an OU or account in that root, it must be available in the organization and enabled for that root.

    • NextToken (string) --

      If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a subsequent call to the operation to get the next part of the output. You should repeat this until the NextToken response element comes back as null .

Exceptions

  • Organizations.Client.exceptions.AccessDeniedException
  • Organizations.Client.exceptions.AWSOrganizationsNotInUseException
  • Organizations.Client.exceptions.InvalidInputException
  • Organizations.Client.exceptions.ServiceException
  • Organizations.Client.exceptions.TooManyRequestsException

Examples

The following example shows how to get the list of the roots in the current organization:/n/n

response = client.list_roots(
)

print(response)

Expected Output:

{
    'Roots': [
        {
            'Arn': 'arn:aws:organizations::111111111111:root/o-exampleorgid/r-examplerootid111',
            'Id': 'r-examplerootid111',
            'Name': 'Root',
            'PolicyTypes': [
                {
                    'Status': 'ENABLED',
                    'Type': 'SERVICE_CONTROL_POLICY',
                },
            ],
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}