createLocation method

Future<CreateLocationOutput> createLocation({
  1. required String locationName,
  2. List<Tag>? tags,
})

This API works with the following fleet types: Anywhere

Creates a custom location for use in an Anywhere fleet.

May throw ConflictException. May throw InternalServiceException. May throw InvalidRequestException. May throw LimitExceededException. May throw TaggingFailedException. May throw UnauthorizedException.

Parameter locationName : A descriptive name for the custom location.

Parameter tags : A list of labels to assign to the new resource. Tags are developer-defined key-value pairs. Tagging Amazon Web Services resources are useful for resource management, access management, and cost allocation. For more information, see Tagging Amazon Web Services Resources in the Amazon Web Services General Rareference.

Implementation

Future<CreateLocationOutput> createLocation({
  required String locationName,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.CreateLocation'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LocationName': locationName,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateLocationOutput.fromJson(jsonResponse.body);
}