registerCompute method
This API works with the following fleet types: Anywhere, Container
Registers a compute resource in an Amazon GameLift Servers Anywhere fleet.
For an Anywhere fleet that's running the Amazon GameLift Servers Agent, the Agent handles all compute registry tasks for you. For an Anywhere fleet that doesn't use the Agent, call this operation to register fleet computes.
To register a compute, give the compute a name (must be unique within the fleet) and specify the compute resource's DNS name or IP address. Provide a fleet ID and a fleet location to associate with the compute being registered. You can optionally include the path to a TLS certificate on the compute resource.
If successful, this operation returns compute details, including an Amazon
GameLift Servers SDK endpoint or Agent endpoint. Game server processes
running on the compute can use this endpoint to communicate with the
Amazon GameLift Servers service. Each server process includes the SDK
endpoint in its call to the Amazon GameLift Servers server SDK action
InitSDK().
To view compute details, call DescribeCompute with the compute name.
Learn more
- Create an Anywhere fleet
- Test your integration
- Server SDK reference guides (for version 5.x)
May throw ConflictException.
May throw InternalServiceException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw NotReadyException.
May throw UnauthorizedException.
Parameter computeName :
A descriptive label for the compute resource.
Parameter fleetId :
A unique identifier for the fleet to register the compute to. You can use
either the fleet ID or ARN value.
Parameter certificatePath :
The path to a TLS certificate on your compute resource. Amazon GameLift
Servers doesn't validate the path and certificate.
Parameter dnsName :
The DNS name of the compute resource. Amazon GameLift Servers requires
either a DNS name or IP address.
Parameter ipAddress :
The IP address of the compute resource. Amazon GameLift Servers requires
either a DNS name or IP address. When registering an Anywhere fleet, an IP
address is required.
Parameter location :
The name of a custom location to associate with the compute resource being
registered. This parameter is required when registering a compute for an
Anywhere fleet.
Implementation
Future<RegisterComputeOutput> registerCompute({
required String computeName,
required String fleetId,
String? certificatePath,
String? dnsName,
String? ipAddress,
String? location,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'GameLift.RegisterCompute'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ComputeName': computeName,
'FleetId': fleetId,
if (certificatePath != null) 'CertificatePath': certificatePath,
if (dnsName != null) 'DnsName': dnsName,
if (ipAddress != null) 'IpAddress': ipAddress,
if (location != null) 'Location': location,
},
);
return RegisterComputeOutput.fromJson(jsonResponse.body);
}