createFarm method

Future<CreateFarmResponse> createFarm({
  1. required String displayName,
  2. String? clientToken,
  3. double? costScaleFactor,
  4. String? description,
  5. String? kmsKeyArn,
  6. Map<String, String>? tags,
})

Creates a farm to allow space for queues and fleets. Farms are the space where the components of your renders gather and are pieced together in the cloud. Farms contain budgets and allow you to enforce permissions. Deadline Cloud farms are a useful container for large projects.

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

Parameter displayName : The display name of the farm.

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

Parameter costScaleFactor : A multiplier applied to the farm's calculated costs for usage data and budget tracking. A value less than 1 represents a discount, a value greater than 1 represents a premium, and a value of 1 represents no adjustment. The default value is 1.

Parameter description : The description of the farm.

Parameter kmsKeyArn : The ARN of the KMS key to use on the farm.

Parameter tags : The tags to add to your farm. 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<CreateFarmResponse> createFarm({
  required String displayName,
  String? clientToken,
  double? costScaleFactor,
  String? description,
  String? kmsKeyArn,
  Map<String, String>? tags,
}) async {
  _s.validateNumRange(
    'costScaleFactor',
    costScaleFactor,
    0,
    100,
  );
  final headers = <String, String>{
    if (clientToken != null) 'X-Amz-Client-Token': clientToken.toString(),
  };
  final $payload = <String, dynamic>{
    'displayName': displayName,
    if (costScaleFactor != null) 'costScaleFactor': costScaleFactor,
    if (description != null) 'description': description,
    if (kmsKeyArn != null) 'kmsKeyArn': kmsKeyArn,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/2023-10-12/farms',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateFarmResponse.fromJson(response);
}