getRegions method

Future<GetRegionsResult> getRegions({
  1. bool? includeAvailabilityZones,
  2. bool? includeRelationalDatabaseAvailabilityZones,
})

Returns a list of all valid regions for Amazon Lightsail. Use the include availability zones parameter to also return the Availability Zones in a region.

May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw AccountSetupInProgressException. May throw UnauthenticatedException.

Parameter includeAvailabilityZones : A Boolean value indicating whether to also include Availability Zones in your get regions request. Availability Zones are indicated with a letter: e.g., us-east-2a.

Parameter includeRelationalDatabaseAvailabilityZones : A Boolean value indicating whether to also include Availability Zones for databases in your get regions request. Availability Zones are indicated with a letter (e.g., us-east-2a).

Implementation

Future<GetRegionsResult> getRegions({
  bool? includeAvailabilityZones,
  bool? includeRelationalDatabaseAvailabilityZones,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.GetRegions'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (includeAvailabilityZones != null)
        'includeAvailabilityZones': includeAvailabilityZones,
      if (includeRelationalDatabaseAvailabilityZones != null)
        'includeRelationalDatabaseAvailabilityZones':
            includeRelationalDatabaseAvailabilityZones,
    },
  );

  return GetRegionsResult.fromJson(jsonResponse.body);
}