listRegions method

Future<ListRegionsResponse> listRegions({
  1. required String instanceArn,
  2. int? maxResults,
  3. String? nextToken,
})

Lists all enabled Regions of an IAM Identity Center instance, including those that are being added or removed. This operation returns Regions with ACTIVE, ADDING, or REMOVING status.

The following actions are related to ListRegions:

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

Parameter instanceArn : The Amazon Resource Name (ARN) of the IAM Identity Center instance.

Parameter maxResults : The maximum number of results to return in a single call. Default is 100.

Parameter nextToken : The pagination token for the list API. Initially the value is null. Use the output of previous API calls to make subsequent calls.

Implementation

Future<ListRegionsResponse> listRegions({
  required String instanceArn,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SWBExternalService.ListRegions'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InstanceArn': instanceArn,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListRegionsResponse.fromJson(jsonResponse.body);
}