deregisterGameServer method

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

This API works with the following fleet types: EC2 (FleetIQ)

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

Amazon GameLift Servers FleetIQ Guide

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

Parameter gameServerGroupName : A unique identifier for the game server group where the game server is running.

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

Implementation

Future<void> deregisterGameServer({
  required String gameServerGroupName,
  required String gameServerId,
}) async {
  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,
    },
  );
}