updateFarm method

Future<void> updateFarm({
  1. required String farmId,
  2. double? costScaleFactor,
  3. String? description,
  4. String? displayName,
})

Updates a farm.

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

Parameter farmId : The farm ID to update.

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.

Parameter description : The description of the farm to update.

Parameter displayName : The display name of the farm to update.

Implementation

Future<void> updateFarm({
  required String farmId,
  double? costScaleFactor,
  String? description,
  String? displayName,
}) async {
  _s.validateNumRange(
    'costScaleFactor',
    costScaleFactor,
    0,
    100,
  );
  final $payload = <String, dynamic>{
    if (costScaleFactor != null) 'costScaleFactor': costScaleFactor,
    if (description != null) 'description': description,
    if (displayName != null) 'displayName': displayName,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/2023-10-12/farms/${Uri.encodeComponent(farmId)}',
    exceptionFnMap: _exceptionFns,
  );
}