listAccountRoles method

Future<ListAccountRolesResponse> listAccountRoles({
  1. required String accessToken,
  2. required String accountId,
  3. int? maxResults,
  4. String? nextToken,
})

Lists all roles that are assigned to the user for a given AWS account.

May throw InvalidRequestException. May throw ResourceNotFoundException. May throw TooManyRequestsException. May throw UnauthorizedException.

Parameter accessToken : The token issued by the CreateToken API call. For more information, see CreateToken in the IAM Identity Center OIDC API Reference Guide.

Parameter accountId : The identifier for the AWS account that is assigned to the user.

Parameter maxResults : The number of items that clients can request per page.

Parameter nextToken : The page token from the previous response output when you request subsequent pages.

Implementation

Future<ListAccountRolesResponse> listAccountRoles({
  required String accessToken,
  required String accountId,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'x-amz-sso_bearer_token': accessToken.toString(),
  };
  final $query = <String, List<String>>{
    'account_id': [accountId],
    if (maxResults != null) 'max_result': [maxResults.toString()],
    if (nextToken != null) 'next_token': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/assignment/roles',
    signed: false,
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return ListAccountRolesResponse.fromJson(response);
}