listPolicyVersions method

Future<ListPolicyVersionsResponse> listPolicyVersions({
  1. required String policyArn,
  2. int? maxResults,
  3. String? nextToken,
})

Returns a list of the versions for policies. Policies define the permissions for team resources.

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

Parameter policyArn : Amazon Resource Name (ARN) for the policy.

Parameter maxResults : The maximum number of items to return in the response. If more results exist than the specified MaxResults value, a token is included in the response so that you can retrieve the remaining results.

Parameter nextToken : If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a next call to the operation to get more output. You can repeat this until the NextToken response element returns null.

Implementation

Future<ListPolicyVersionsResponse> listPolicyVersions({
  required String policyArn,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    20,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'MaxResults': [maxResults.toString()],
    if (nextToken != null) 'NextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'POST',
    requestUri: '/policies/${Uri.encodeComponent(policyArn)}/?List',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListPolicyVersionsResponse.fromJson(response);
}