createFleetLocations method

Future<CreateFleetLocationsOutput> createFleetLocations({
  1. required String fleetId,
  2. required List<LocationConfiguration> locations,
})

This API works with the following fleet types: EC2, Anywhere, Container

Adds remote locations to an EC2 and begins populating the new locations with instances. The new instances conform to the fleet's instance type, auto-scaling, and other configuration settings. To add fleet locations, specify the fleet to be updated and provide a list of one or more locations.

If successful, this operation returns the list of added locations with their status set to NEW. Amazon GameLift Servers initiates the process of starting an instance in each added location. You can track the status of each new location by monitoring location creation events using DescribeFleetEvents.

Learn more

Setting up fleets

Update fleet locations

Amazon GameLift Servers service locations for managed hosting.

May throw ConflictException. May throw InternalServiceException. May throw InvalidFleetStatusException. May throw InvalidRequestException. May throw LimitExceededException. May throw NotFoundException. May throw NotReadyException. May throw UnauthorizedException. May throw UnsupportedRegionException.

Parameter fleetId : A unique identifier for the fleet to add locations to. You can use either the fleet ID or ARN value.

Parameter locations : A list of locations to deploy additional instances to and manage as part of the fleet. You can add any Amazon GameLift Servers-supported Amazon Web Services Region as a remote location, in the form of an Amazon Web Services Region code such as us-west-2.

Implementation

Future<CreateFleetLocationsOutput> createFleetLocations({
  required String fleetId,
  required List<LocationConfiguration> locations,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.CreateFleetLocations'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FleetId': fleetId,
      'Locations': locations,
    },
  );

  return CreateFleetLocationsOutput.fromJson(jsonResponse.body);
}