listPolicyGrants method

Future<ListPolicyGrantsOutput> listPolicyGrants({
  1. required String domainIdentifier,
  2. required String entityIdentifier,
  3. required TargetEntityType entityType,
  4. required ManagedPolicyType policyType,
  5. int? maxResults,
  6. String? nextToken,
})

Lists policy grants.

May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter domainIdentifier : The ID of the domain where you want to list policy grants.

Parameter entityIdentifier : The ID of the entity for which you want to list policy grants.

Parameter entityType : The type of entity for which you want to list policy grants.

Parameter policyType : The type of policy that you want to list.

Parameter maxResults : The maximum number of grants to return in a single call to ListPolicyGrants. When the number of grants to be listed is greater than the value of MaxResults, the response contains a NextToken value that you can use in a subsequent call to ListPolicyGrants to list the next set of grants.

Parameter nextToken : When the number of grants is greater than the default value for the MaxResults parameter, or if you explicitly specify a value for MaxResults that is less than the number of grants, the response includes a pagination token named NextToken. You can specify this NextToken value in a subsequent call to ListPolicyGrants to list the next set of grants.

Implementation

Future<ListPolicyGrantsOutput> listPolicyGrants({
  required String domainIdentifier,
  required String entityIdentifier,
  required TargetEntityType entityType,
  required ManagedPolicyType policyType,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    25,
  );
  final $query = <String, List<String>>{
    'policyType': [policyType.value],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/v2/domains/${Uri.encodeComponent(domainIdentifier)}/policies/managed/${Uri.encodeComponent(entityType.value)}/${Uri.encodeComponent(entityIdentifier)}/grants',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListPolicyGrantsOutput.fromJson(response);
}