list_resource_policies
¶
list_resource_policies(
secret_id: SecretIdType,
*,
config_overrides: Optional[SecretsManagerClientConfig] = None,
max_results: Optional[MaxResultsType] = None,
next_token: Optional[NextTokenType] = None,
) -> ListResourcePoliciesResponse
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.
Parameters:
-
secret_id(SecretIdType) –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.
-
max_results(Optional[MaxResultsType], default:None) –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, callListResourcePoliciesagain with the value fromNextToken. -
next_token(Optional[NextTokenType], default:None) –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
ListResourcePoliciesagain with this value.
Raises:
-
InternalServiceError–An error occurred on the server side.
-
InvalidNextTokenException–The
NextTokenvalue is invalid. -
InvalidParameterException–The parameter name or value is invalid.
-
InvalidRequestException–A parameter value is not valid for the current state of the resource.
Possible causes:
-
The secret is scheduled for deletion.
-
You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call.
-
The secret is managed by another service, and you must use that service to update it. For more information, see Secrets managed by other Amazon Web Services services.
-
-
ResourceNotFoundException–Secrets Manager can't find the resource that you asked for.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To list the resource-based policies attached to a secret The following example shows how to list the resource-based policies attached to a secret.
Source code in docs_src/capo_secrets_manager/_services/secrets_manager.py
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | |