getComputeAccess method

Future<GetComputeAccessOutput> getComputeAccess({
  1. required String computeName,
  2. required String fleetId,
})

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

Requests authorization to remotely connect to a hosting resource in a Amazon GameLift Servers managed fleet. This operation is not used with Amazon GameLift Servers Anywhere fleets.

Request options

Provide the fleet ID and compute name. The compute name varies depending on the type of fleet.

  • For a compute in a managed EC2 fleet, provide an instance ID. Each instance in the fleet is a compute.
  • For a compute in a managed container fleet, provide a compute name. In a container fleet, each game server container group on a fleet instance is assigned a compute name.
Results

If successful, this operation returns a set of temporary Amazon Web Services credentials, including a two-part access key and a session token.

  • With a managed EC2 fleet (where compute type is EC2), use these credentials with Amazon EC2 Systems Manager (SSM) to start a session with the compute. For more details, see Starting a session (CLI) in the Amazon EC2 Systems Manager User Guide.

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

Parameter computeName : A unique identifier for the compute resource that you want to connect to. For an EC2 fleet, use an instance ID. For a managed container fleet, use a compute name. You can retrieve a fleet's compute names by calling ListCompute.

Parameter fleetId : A unique identifier for the fleet that holds the compute resource that you want to connect to. You can use either the fleet ID or ARN value.

Implementation

Future<GetComputeAccessOutput> getComputeAccess({
  required String computeName,
  required String fleetId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.GetComputeAccess'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ComputeName': computeName,
      'FleetId': fleetId,
    },
  );

  return GetComputeAccessOutput.fromJson(jsonResponse.body);
}