updateFleetAttributes method

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

Updates fleet properties, including name and description, for a fleet. To update metadata, specify the fleet ID and the property values that you want to change. If successful, the fleet ID for the updated fleet is returned.

Learn more

Setting up GameLift Fleets

Related operations

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

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

Parameter description : Human-readable description of a fleet.

Parameter metricGroups : Names of metric groups to include this fleet in. Amazon CloudWatch uses a fleet metric group is to aggregate metrics from multiple fleets. Use an existing metric group name to add this fleet to the group. Or use a new name to create a new metric group. A fleet can only be included 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 : Game session protection policy to apply to all new instances created in this fleet. Instances that already exist are not affected. You can set protection for individual instances 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 that limits the number of game sessions an individual player can create over a span of time.

Implementation

Future<UpdateFleetAttributesOutput> updateFleetAttributes({
  required String fleetId,
  String? description,
  List<String>? metricGroups,
  String? name,
  ProtectionPolicy? newGameSessionProtectionPolicy,
  ResourceCreationLimitPolicy? resourceCreationLimitPolicy,
}) async {
  ArgumentError.checkNotNull(fleetId, 'fleetId');
  _s.validateStringLength(
    'description',
    description,
    1,
    1024,
  );
  _s.validateStringLength(
    'name',
    name,
    1,
    1024,
  );
  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 (description != null) 'Description': description,
      if (metricGroups != null) 'MetricGroups': metricGroups,
      if (name != null) 'Name': name,
      if (newGameSessionProtectionPolicy != null)
        'NewGameSessionProtectionPolicy':
            newGameSessionProtectionPolicy.toValue(),
      if (resourceCreationLimitPolicy != null)
        'ResourceCreationLimitPolicy': resourceCreationLimitPolicy,
    },
  );

  return UpdateFleetAttributesOutput.fromJson(jsonResponse.body);
}