updateContainerFleet method

Future<UpdateContainerFleetOutput> updateContainerFleet({
  1. required String fleetId,
  2. DeploymentConfiguration? deploymentConfiguration,
  3. String? description,
  4. String? gameServerContainerGroupDefinitionName,
  5. int? gameServerContainerGroupsPerInstance,
  6. GameSessionCreationLimitPolicy? gameSessionCreationLimitPolicy,
  7. ConnectionPortRange? instanceConnectionPortRange,
  8. List<IpPermission>? instanceInboundPermissionAuthorizations,
  9. List<IpPermission>? instanceInboundPermissionRevocations,
  10. LogConfiguration? logConfiguration,
  11. List<String>? metricGroups,
  12. ProtectionPolicy? newGameSessionProtectionPolicy,
  13. String? perInstanceContainerGroupDefinitionName,
  14. List<ContainerFleetRemoveAttribute>? removeAttributes,
})

This API works with the following fleet types: Container

Updates the properties of a managed container fleet. Depending on the properties being updated, this operation might initiate a fleet deployment. You can track deployments for a fleet using https://docs.aws.amazon.com/gamelift/latest/apireference/API_DescribeFleetDeployment.html. Request options

As with CreateContainerFleet, many fleet properties use common defaults or are calculated based on the fleet's container group definitions.

  • Update fleet properties that result in a fleet deployment. Include only those properties that you want to change. Specify deployment configuration settings.
  • Update fleet properties that don't result in a fleet deployment. Include only those properties that you want to change.
Changes to the following properties initiate a fleet deployment:
  • GameServerContainerGroupDefinition
  • PerInstanceContainerGroupDefinition
  • GameServerContainerGroupsPerInstance
  • InstanceInboundPermissions
  • InstanceConnectionPortRange
  • LogConfiguration
Results

If successful, this operation updates the container fleet resource, and might initiate a new deployment of fleet resources using the deployment configuration provided. A deployment replaces existing fleet instances with new instances that are deployed with the updated fleet properties. The fleet is placed in UPDATING status until the deployment is complete, then return to ACTIVE.

You can have only one update deployment active at a time for a fleet. If a second update request initiates a deployment while another deployment is in progress, the first deployment is cancelled.

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

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

Parameter deploymentConfiguration : Instructions for how to deploy updates to a container fleet, if the fleet update initiates a deployment. The deployment configuration lets you determine how to replace fleet instances and what actions to take if the deployment fails.

Parameter description : A meaningful description of the container fleet.

Parameter gameServerContainerGroupDefinitionName : The name or ARN value of a new game server container group definition to deploy on the fleet. If you're updating the fleet to a specific version of a container group definition, use the ARN value and include the version number. If you're updating the fleet to the latest version of a container group definition, you can use the name value. You can't remove a fleet's game server container group definition, you can only update or replace it with another definition.

Update a container group definition by calling UpdateContainerGroupDefinition. This operation creates a ContainerGroupDefinition resource with an incremented version.

Parameter gameServerContainerGroupsPerInstance : The number of times to replicate the game server container group on each fleet instance. By default, Amazon GameLift Servers calculates the maximum number of game server container groups that can fit on each instance. You can remove this property value to use the calculated value, or set it manually. If you set this number manually, Amazon GameLift Servers uses your value as long as it's less than the calculated maximum.

Parameter gameSessionCreationLimitPolicy : A policy that limits the number of game sessions that each individual player can create on instances in this fleet. The limit applies for a specified span of time.

Parameter instanceConnectionPortRange : A revised set of port numbers to open on each fleet instance. By default, Amazon GameLift Servers calculates an optimal port range based on your fleet configuration. If you previously set this parameter manually, you can't reset this to use the calculated settings.

The port range must not overlap with the Amazon GameLift Servers reserved port range 4092-4191. This range is reserved for internal Amazon GameLift Servers services.

Parameter instanceInboundPermissionAuthorizations : A set of ports to add to the container fleet's inbound permissions.

The port range must not overlap with the Amazon GameLift Servers reserved port range 4092-4191. This range is reserved for internal Amazon GameLift Servers services.

Parameter instanceInboundPermissionRevocations : A set of ports to remove from the container fleet's inbound permissions.

Parameter logConfiguration : The method for collecting container logs for the fleet.

Parameter metricGroups : The name of an Amazon Web Services CloudWatch metric group to add this fleet to.

Parameter newGameSessionProtectionPolicy : The game session protection policy to apply to all new game sessions that are started in this fleet. Game sessions that already exist are not affected.

Parameter perInstanceContainerGroupDefinitionName : The name or ARN value of a new per-instance container group definition to deploy on the fleet. If you're updating the fleet to a specific version of a container group definition, use the ARN value and include the version number. If you're updating the fleet to the latest version of a container group definition, you can use the name value.

Update a container group definition by calling UpdateContainerGroupDefinition. This operation creates a ContainerGroupDefinition resource with an incremented version.

To remove a fleet's per-instance container group definition, leave this parameter empty and use the parameter RemoveAttributes.

Parameter removeAttributes : If set, this update removes a fleet's per-instance container group definition. You can't remove a fleet's game server container group definition.

Implementation

Future<UpdateContainerFleetOutput> updateContainerFleet({
  required String fleetId,
  DeploymentConfiguration? deploymentConfiguration,
  String? description,
  String? gameServerContainerGroupDefinitionName,
  int? gameServerContainerGroupsPerInstance,
  GameSessionCreationLimitPolicy? gameSessionCreationLimitPolicy,
  ConnectionPortRange? instanceConnectionPortRange,
  List<IpPermission>? instanceInboundPermissionAuthorizations,
  List<IpPermission>? instanceInboundPermissionRevocations,
  LogConfiguration? logConfiguration,
  List<String>? metricGroups,
  ProtectionPolicy? newGameSessionProtectionPolicy,
  String? perInstanceContainerGroupDefinitionName,
  List<ContainerFleetRemoveAttribute>? removeAttributes,
}) async {
  _s.validateNumRange(
    'gameServerContainerGroupsPerInstance',
    gameServerContainerGroupsPerInstance,
    1,
    5000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.UpdateContainerFleet'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FleetId': fleetId,
      if (deploymentConfiguration != null)
        'DeploymentConfiguration': deploymentConfiguration,
      if (description != null) 'Description': description,
      if (gameServerContainerGroupDefinitionName != null)
        'GameServerContainerGroupDefinitionName':
            gameServerContainerGroupDefinitionName,
      if (gameServerContainerGroupsPerInstance != null)
        'GameServerContainerGroupsPerInstance':
            gameServerContainerGroupsPerInstance,
      if (gameSessionCreationLimitPolicy != null)
        'GameSessionCreationLimitPolicy': gameSessionCreationLimitPolicy,
      if (instanceConnectionPortRange != null)
        'InstanceConnectionPortRange': instanceConnectionPortRange,
      if (instanceInboundPermissionAuthorizations != null)
        'InstanceInboundPermissionAuthorizations':
            instanceInboundPermissionAuthorizations,
      if (instanceInboundPermissionRevocations != null)
        'InstanceInboundPermissionRevocations':
            instanceInboundPermissionRevocations,
      if (logConfiguration != null) 'LogConfiguration': logConfiguration,
      if (metricGroups != null) 'MetricGroups': metricGroups,
      if (newGameSessionProtectionPolicy != null)
        'NewGameSessionProtectionPolicy':
            newGameSessionProtectionPolicy.value,
      if (perInstanceContainerGroupDefinitionName != null)
        'PerInstanceContainerGroupDefinitionName':
            perInstanceContainerGroupDefinitionName,
      if (removeAttributes != null)
        'RemoveAttributes': removeAttributes.map((e) => e.value).toList(),
    },
  );

  return UpdateContainerFleetOutput.fromJson(jsonResponse.body);
}