updateFleetAttributes method

Future<UpdateFleetAttributesOutput> updateFleetAttributes({
  1. required String fleetId,
  2. AnywhereConfiguration? anywhereConfiguration,
  3. String? description,
  4. List<String>? metricGroups,
  5. String? name,
  6. ProtectionPolicy? newGameSessionProtectionPolicy,
  7. ResourceCreationLimitPolicy? resourceCreationLimitPolicy,
})

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

Updates a fleet's mutable attributes, such as game session protection and resource creation limits.

To update fleet attributes, specify the fleet ID and the property values that you want to change. If successful, Amazon GameLift Servers returns the identifiers for the updated fleet. Learn more

Setting up Amazon GameLift Servers fleets

May throw ConflictException. May throw InternalServiceException. May throw InvalidFleetStatusException. May throw InvalidRequestException. May throw LimitExceededException. May throw NotFoundException. May throw UnauthorizedException.

Parameter fleetId : A unique identifier for the fleet to update attribute metadata for. You can use either the fleet ID or ARN value.

Parameter anywhereConfiguration : Amazon GameLift Servers Anywhere configuration options.

Parameter description : A human-readable description of a fleet.

Parameter metricGroups : The name of a metric group to add this fleet to. Use a metric group in Amazon CloudWatch to aggregate the metrics from multiple fleets. Provide an existing metric group name, or create a new metric group by providing a new name. A fleet can only be in one metric group at a time.

Parameter name : A descriptive label that is associated with a fleet. Fleet names do not need to be unique.

Parameter newGameSessionProtectionPolicy : The game session protection policy to apply to all new game sessions created in this fleet. Game sessions that already exist are not affected. You can set protection for individual game sessions using UpdateGameSession .

  • NoProtection -- The game session can be terminated during a scale-down event.
  • FullProtection -- If the game session is in an ACTIVE status, it cannot be terminated during a scale-down event.

Parameter resourceCreationLimitPolicy : Policy settings that limit the number of game sessions an individual player can create over a span of time.

Implementation

Future<UpdateFleetAttributesOutput> updateFleetAttributes({
  required String fleetId,
  AnywhereConfiguration? anywhereConfiguration,
  String? description,
  List<String>? metricGroups,
  String? name,
  ProtectionPolicy? newGameSessionProtectionPolicy,
  ResourceCreationLimitPolicy? resourceCreationLimitPolicy,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.UpdateFleetAttributes'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FleetId': fleetId,
      if (anywhereConfiguration != null)
        'AnywhereConfiguration': anywhereConfiguration,
      if (description != null) 'Description': description,
      if (metricGroups != null) 'MetricGroups': metricGroups,
      if (name != null) 'Name': name,
      if (newGameSessionProtectionPolicy != null)
        'NewGameSessionProtectionPolicy':
            newGameSessionProtectionPolicy.value,
      if (resourceCreationLimitPolicy != null)
        'ResourceCreationLimitPolicy': resourceCreationLimitPolicy,
    },
  );

  return UpdateFleetAttributesOutput.fromJson(jsonResponse.body);
}