list_policies
async
¶
list_policies(
policy_store_id: PolicyStoreId,
*,
config_overrides: Optional[AsyncVerifiedPermissionsClientConfig] = None,
next_token: Optional[NextToken] = None,
max_results: Optional[MaxResults] = None,
filter: Optional[PolicyFilter] = None,
) -> ListPoliciesOutput
Returns a paginated list of all policies stored in the specified policy store.
Parameters:
-
policy_store_id(PolicyStoreId) –Specifies the ID of the policy store you want to list policies from.
To specify a policy store, use its ID or alias name. When using an alias name, prefix it with
policy-store-alias/. For example:-
ID:
PSEXAMPLEabcdefg111111 -
Alias name:
policy-store-alias/example-policy-store
To view aliases, use ListPolicyStoreAliases.
-
-
next_token(Optional[NextToken], default:None) –Specifies that you want to receive the next page of results. Valid only if you received a
NextTokenresponse in the previous request. If you did, it indicates that more output is available. Set this parameter to the value provided by the previous call'sNextTokenresponse to request the next page of results. -
max_results(Optional[MaxResults], default:None) –Specifies the total number of results that you want included in each response. If additional items exist beyond the number you specify, the
NextTokenresponse element is returned with a value (not null). Include the specified value as theNextTokenrequest parameter in the next call to the operation to get the next set of results. Note that the service might return fewer results than the maximum even when there are more results available. You should checkNextTokenafter every operation to ensure that you receive all of the results.If you do not specify this parameter, the operation defaults to 10 policies per response. You can specify a maximum of 50 policies per response.
-
filter(Optional[PolicyFilter], default:None) –Specifies a filter that limits the response to only policies that match the specified criteria. For example, you list only the policies that reference a specified principal.
Raises:
-
AccessDeniedException–You don't have sufficient access to perform this action.
-
InternalServerException–The request failed because of an internal error. Try your request again later
-
ThrottlingException–The request failed because it exceeded a throttling quota.
-
ValidationException–The request failed because one or more input parameters don't satisfy their constraint requirements. The output is provided as a list of fields and a reason for each field that isn't valid.
The possible reasons include the following:
-
UnrecognizedEntityType
The policy includes an entity type that isn't found in the schema.
-
UnrecognizedActionId
The policy includes an action id that isn't found in the schema.
-
InvalidActionApplication
The policy includes an action that, according to the schema, doesn't support the specified principal and resource.
-
UnexpectedType
The policy included an operand that isn't a valid type for the specified operation.
-
IncompatibleTypes
The types of elements included in a
set, or the types of expressions used in anif...then...elseclause aren't compatible in this context. -
MissingAttribute
The policy attempts to access a record or entity attribute that isn't specified in the schema. Test for the existence of the attribute first before attempting to access its value. For more information, see the has (presence of attribute test) operator in the Cedar Policy Language Guide.
-
UnsafeOptionalAttributeAccess
The policy attempts to access a record or entity attribute that is optional and isn't guaranteed to be present. Test for the existence of the attribute first before attempting to access its value. For more information, see the has (presence of attribute test) operator in the Cedar Policy Language Guide.
-
ImpossiblePolicy
Cedar has determined that a policy condition always evaluates to false. If the policy is always false, it can never apply to any query, and so it can never affect an authorization decision.
-
WrongNumberArguments
The policy references an extension type with the wrong number of arguments.
-
FunctionArgumentValidationError
Cedar couldn't parse the argument passed to an extension type. For example, a string that is to be parsed as an IPv4 address can contain only digits and the period character.
-
-
ResourceNotFoundException–The request failed because it references a resource that doesn't exist.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
ListPolicies - Example 1 The following example lists all policies in the policy store.
>>> await client.list_policies(policy_store_id='C7v5xMplfFH3i3e4Jrzb1a')
ListPolicies - Example 2
The following example lists all policies for a specified principal.
>>> await client.list_policies(policy_store_id='C7v5xMplfFH3i3e4Jrzb1a', filter={'principal': {'identifier': {'entityType': 'User', 'entityId': 'alice'}}})
ListPolicies - Example 3
The following example uses the Filter parameter to list only the template-linked policies in the specified policy store.
>>> await client.list_policies(policy_store_id='C7v5xMplfFH3i3e4Jrzb1a', filter={'policyType': 'TEMPLATE_LINKED'})
Source code in docs_src/capo_verifiedpermissions/_services/async_verified_permissions.py
2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 | |