deregisterGameServer method

Future<void> deregisterGameServer({
  1. required String gameServerGroupName,
  2. required String gameServerId,
})

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

Removes the game server from a game server group. As a result of this operation, the deregistered game server can no longer be claimed and will not be returned in a list of active game servers.

To deregister a game server, specify the game server group and game server ID. If successful, this operation emits a CloudWatch event with termination timestamp and reason.

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 where the game server is running. Use either the GameServerGroup name or ARN value.

Parameter gameServerId : A custom string that uniquely identifies the game server to deregister.

Implementation

Future<void> deregisterGameServer({
  required String gameServerGroupName,
  required String gameServerId,
}) async {
  ArgumentError.checkNotNull(gameServerGroupName, 'gameServerGroupName');
  _s.validateStringLength(
    'gameServerGroupName',
    gameServerGroupName,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(gameServerId, 'gameServerId');
  _s.validateStringLength(
    'gameServerId',
    gameServerId,
    3,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.DeregisterGameServer'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'GameServerGroupName': gameServerGroupName,
      'GameServerId': gameServerId,
    },
  );
}