startFleetActions method

Future<StartFleetActionsOutput> startFleetActions({
  1. required List<FleetAction> actions,
  2. required String fleetId,
  3. String? location,
})

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

Resumes certain types of activity on fleet instances that were suspended with StopFleetActions. For multi-location fleets, fleet actions are managed separately for each location. Currently, this operation is used to restart a fleet's auto-scaling activity.

This operation can be used in the following ways:

  • To restart actions on instances in the fleet's home Region, provide a fleet ID and the type of actions to resume.
  • To restart actions on instances in one of the fleet's remote locations, provide a fleet ID, a location name, and the type of actions to resume.
If successful, Amazon GameLift Servers once again initiates scaling events as triggered by the fleet's scaling policies. If actions on the fleet location were never stopped, this operation will have no effect.

Learn more

Setting up Amazon GameLift Servers fleets

May throw InternalServiceException. May throw InvalidRequestException. May throw NotFoundException. May throw UnauthorizedException. May throw UnsupportedRegionException.

Parameter actions : List of actions to restart on the fleet.

Parameter fleetId : A unique identifier for the fleet to restart actions on. You can use either the fleet ID or ARN value.

Parameter location : The fleet location to restart fleet actions for. Specify a location in the form of an Amazon Web Services Region code, such as us-west-2.

Implementation

Future<StartFleetActionsOutput> startFleetActions({
  required List<FleetAction> actions,
  required String fleetId,
  String? location,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.StartFleetActions'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Actions': actions.map((e) => e.value).toList(),
      'FleetId': fleetId,
      if (location != null) 'Location': location,
    },
  );

  return StartFleetActionsOutput.fromJson(jsonResponse.body);
}