suspendGameServerGroup method

Future<SuspendGameServerGroupOutput> suspendGameServerGroup({
  1. required String gameServerGroupName,
  2. required List<GameServerGroupAction> suspendActions,
})

This operation is used with the Amazon GameLift FleetIQ solution and game server groups.

Temporarily stops activity on a game server group without terminating instances or the game server group. You can restart activity by calling ResumeGameServerGroup. You can suspend the following activity:

  • Instance type replacement - This activity evaluates the current game hosting viability of all Spot instance types that are defined for the game server group. It updates the Auto Scaling group to remove nonviable Spot Instance types, which have a higher chance of game server interruptions. It then balances capacity across the remaining viable Spot Instance types. When this activity is suspended, the Auto Scaling group continues with its current balance, regardless of viability. Instance protection, utilization metrics, and capacity scaling activities continue to be active.
To suspend activity, specify a game server group ARN and the type of activity to be suspended. If successful, a GameServerGroup object is returned showing that the activity is listed in SuspendedActions.

Learn more

GameLift FleetIQ Guide

Related operations

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

Parameter gameServerGroupName : A unique identifier for the game server group. Use either the GameServerGroup name or ARN value.

Parameter suspendActions : The activity to suspend for this game server group.

Implementation

Future<SuspendGameServerGroupOutput> suspendGameServerGroup({
  required String gameServerGroupName,
  required List<GameServerGroupAction> suspendActions,
}) async {
  ArgumentError.checkNotNull(gameServerGroupName, 'gameServerGroupName');
  _s.validateStringLength(
    'gameServerGroupName',
    gameServerGroupName,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(suspendActions, 'suspendActions');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.SuspendGameServerGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'GameServerGroupName': gameServerGroupName,
      'SuspendActions': suspendActions.map((e) => e.toValue()).toList(),
    },
  );

  return SuspendGameServerGroupOutput.fromJson(jsonResponse.body);
}