list_policy_versions

list_policy_versions(**kwargs)

Lists information about the versions of the specified managed policy, including the version that is currently set as the policy's default version.

For more information about managed policies, see Managed policies and inline policies in the IAM User Guide .

See also: AWS API Documentation

Request Syntax

response = client.list_policy_versions(
    PolicyArn='string',
    Marker='string',
    MaxItems=123
)
Parameters
  • PolicyArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the IAM policy for which you want the versions.

    For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference .

  • Marker (string) -- Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.
  • MaxItems (integer) --

    Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true .

    If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true , and Marker contains a value to include in the subsequent call that tells the service where to continue from.

Return type

dict

Returns

Response Syntax

{
    'Versions': [
        {
            'Document': 'string',
            'VersionId': 'string',
            'IsDefaultVersion': True|False,
            'CreateDate': datetime(2015, 1, 1)
        },
    ],
    'IsTruncated': True|False,
    'Marker': 'string'
}

Response Structure

  • (dict) --

    Contains the response to a successful ListPolicyVersions request.

    • Versions (list) --

      A list of policy versions.

      For more information about managed policy versions, see Versioning for managed policies in the IAM User Guide .

      • (dict) --

        Contains information about a version of a managed policy.

        This data type is used as a response element in the CreatePolicyVersion, GetPolicyVersion, ListPolicyVersions, and GetAccountAuthorizationDetails operations.

        For more information about managed policies, refer to Managed policies and inline policies in the IAM User Guide .

        • Document (string) --

          The policy document.

          The policy document is returned in the response to the GetPolicyVersion and GetAccountAuthorizationDetails operations. It is not returned in the response to the CreatePolicyVersion or ListPolicyVersions operations.

          The policy document returned in this structure is URL-encoded compliant with RFC 3986. You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the decode method of the java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs provide similar functionality.

        • VersionId (string) --

          The identifier for the policy version.

          Policy version identifiers always begin with v (always lowercase). When a policy is created, the first policy version is v1 .

        • IsDefaultVersion (boolean) --

          Specifies whether the policy version is set as the policy's default version.

        • CreateDate (datetime) --

          The date and time, in ISO 8601 date-time format, when the policy version was created.

    • IsTruncated (boolean) --

      A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the Marker request parameter to retrieve more items. Note that IAM might return fewer than the MaxItems number of results even when there are more results available. We recommend that you check IsTruncated after every call to ensure that you receive all your results.

    • Marker (string) --

      When IsTruncated is true , this element is present and contains the value to use for the Marker parameter in a subsequent pagination request.

Exceptions

  • IAM.Client.exceptions.NoSuchEntityException
  • IAM.Client.exceptions.InvalidInputException
  • IAM.Client.exceptions.ServiceFailureException