createFleet method

Future<CreateFleetResponse> createFleet({
  1. required FleetConfiguration configuration,
  2. required String displayName,
  3. required String farmId,
  4. required int maxWorkerCount,
  5. required String roleArn,
  6. String? clientToken,
  7. String? description,
  8. HostConfiguration? hostConfiguration,
  9. int? minWorkerCount,
  10. Map<String, String>? tags,
})

Creates a fleet. Fleets gather information relating to compute, or capacity, for renders within your farms. You can choose to manage your own capacity or opt to have fleets fully managed by Deadline Cloud.

May throw AccessDeniedException. May throw InternalServerErrorException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter configuration : The configuration settings for the fleet. Customer managed fleets are self-managed. Service managed Amazon EC2 fleets are managed by Deadline Cloud.

Parameter displayName : The display name of the fleet.

Parameter farmId : The farm ID of the farm to connect to the fleet.

Parameter maxWorkerCount : The maximum number of workers for the fleet.

Deadline Cloud limits the number of workers to less than or equal to the fleet's maximum worker count. The service maintains eventual consistency for the worker count. If you make multiple rapid calls to CreateWorker before the field updates, you might exceed your fleet's maximum worker count. For example, if your maxWorkerCount is 10 and you currently have 9 workers, making two quick CreateWorker calls might successfully create 2 workers instead of 1, resulting in 11 total workers.

Parameter roleArn : The IAM role ARN for the role that the fleet's workers will use.

Parameter clientToken : The unique token which the server uses to recognize retries of the same request.

Parameter description : The description of the fleet.

Parameter hostConfiguration : Provides a script that runs as a worker is starting up that you can use to provide additional configuration for workers in your fleet.

Parameter minWorkerCount : The minimum number of workers for the fleet.

Parameter tags : Each tag consists of a tag key and a tag value. Tag keys and values are both required, but tag values can be empty strings.

Implementation

Future<CreateFleetResponse> createFleet({
  required FleetConfiguration configuration,
  required String displayName,
  required String farmId,
  required int maxWorkerCount,
  required String roleArn,
  String? clientToken,
  String? description,
  HostConfiguration? hostConfiguration,
  int? minWorkerCount,
  Map<String, String>? tags,
}) async {
  _s.validateNumRange(
    'maxWorkerCount',
    maxWorkerCount,
    0,
    2147483647,
    isRequired: true,
  );
  _s.validateNumRange(
    'minWorkerCount',
    minWorkerCount,
    0,
    2147483647,
  );
  final headers = <String, String>{
    if (clientToken != null) 'X-Amz-Client-Token': clientToken.toString(),
  };
  final $payload = <String, dynamic>{
    'configuration': configuration,
    'displayName': displayName,
    'maxWorkerCount': maxWorkerCount,
    'roleArn': roleArn,
    if (description != null) 'description': description,
    if (hostConfiguration != null) 'hostConfiguration': hostConfiguration,
    if (minWorkerCount != null) 'minWorkerCount': minWorkerCount,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/2023-10-12/farms/${Uri.encodeComponent(farmId)}/fleets',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateFleetResponse.fromJson(response);
}