SecretsManager / Client / list_resource_policies

list_resource_policies

SecretsManager.Client.list_resource_policies(**kwargs)

Lists the resource-based policies attached to a secret. The response contains only the names of the policies, not their contents. Secrets Manager lists default first, followed by any other policies in alphabetical order. To get the contents of a policy, use GetResourcePolicy. You can modify only the default policy.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see Logging Secrets Manager events with CloudTrail.

Required permissions: secretsmanager:ListResourcePolicies. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.

See also: AWS API Documentation

Request Syntax

response = client.list_resource_policies(
    SecretId='string',
    MaxResults=123,
    NextToken='string'
)
Parameters:
  • SecretId (string) –

    [REQUIRED]

    The ARN or name of the secret.

    For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.

  • MaxResults (integer) –

    The number of results to include in the response. If you don’t specify this value, the service returns up to 100 results.

    If there are more results available, in the response, Secrets Manager includes NextToken. To get the next results, call ListResourcePolicies again with the value from NextToken.

  • NextToken (string) – A token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call ListResourcePolicies again with this value.

Return type:

dict

Returns:

Response Syntax

{
    'ResourcePolicies': [
        {
            'PolicyName': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • ResourcePolicies (list) –

      A list of the resource policies attached to the secret.

      • (dict) –

        A structure that contains details about a resource policy attached to a secret. It does not contain the contents of the resource policy. To view the contents of the policy, use GetResourcePolicy .

        • PolicyName (string) –

          The name of the resource policy.

    • NextToken (string) –

      Secrets Manager includes this value if there’s more output available than what is included in the current response. To get the next results, call ListResourcePolicies again with this value.

Exceptions