updateBudget method

Future<void> updateBudget({
  1. required String budgetId,
  2. required String farmId,
  3. List<BudgetActionToAdd>? actionsToAdd,
  4. List<BudgetActionToRemove>? actionsToRemove,
  5. double? approximateDollarLimit,
  6. String? clientToken,
  7. String? description,
  8. String? displayName,
  9. BudgetSchedule? schedule,
  10. BudgetStatus? status,
})

Updates a budget that sets spending thresholds for rendering activity.

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

Parameter budgetId : The budget ID to update.

Parameter farmId : The farm ID of the budget to update.

Parameter actionsToAdd : The budget actions to add. Budget actions specify what happens when the budget runs out.

Parameter actionsToRemove : The budget actions to remove from the budget.

Parameter approximateDollarLimit : The dollar limit to update on the budget. Based on consumed usage.

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

Parameter description : The description of the budget to update.

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

Parameter schedule : The schedule to update.

Parameter status : Updates the status of the budget.

  • ACTIVE–The budget is being evaluated.
  • INACTIVE–The budget is inactive. This can include Expired, Canceled, or deleted Deleted statuses.

Implementation

Future<void> updateBudget({
  required String budgetId,
  required String farmId,
  List<BudgetActionToAdd>? actionsToAdd,
  List<BudgetActionToRemove>? actionsToRemove,
  double? approximateDollarLimit,
  String? clientToken,
  String? description,
  String? displayName,
  BudgetSchedule? schedule,
  BudgetStatus? status,
}) async {
  _s.validateNumRange(
    'approximateDollarLimit',
    approximateDollarLimit,
    0.01,
    1152921504606846976,
  );
  final headers = <String, String>{
    if (clientToken != null) 'X-Amz-Client-Token': clientToken.toString(),
  };
  final $payload = <String, dynamic>{
    if (actionsToAdd != null) 'actionsToAdd': actionsToAdd,
    if (actionsToRemove != null) 'actionsToRemove': actionsToRemove,
    if (approximateDollarLimit != null)
      'approximateDollarLimit': approximateDollarLimit,
    if (description != null) 'description': description,
    if (displayName != null) 'displayName': displayName,
    if (schedule != null) 'schedule': schedule,
    if (status != null) 'status': status.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/2023-10-12/farms/${Uri.encodeComponent(farmId)}/budgets/${Uri.encodeComponent(budgetId)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}