createBudget method
Creates a budget to set spending thresholds for your rendering activity.
May throw AccessDeniedException.
May throw InternalServerErrorException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter actions :
The budget actions to specify what happens when the budget runs out.
Parameter approximateDollarLimit :
The dollar limit based on consumed usage.
Parameter displayName :
The display name of the budget.
Parameter farmId :
The farm ID to include in this budget.
Parameter schedule :
The schedule to associate with this budget.
Parameter usageTrackingResource :
The queue ID provided to this budget to track usage.
Parameter clientToken :
The unique token which the server uses to recognize retries of the same
request.
Parameter description :
The description of the budget.
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<CreateBudgetResponse> createBudget({
required List<BudgetActionToAdd> actions,
required double approximateDollarLimit,
required String displayName,
required String farmId,
required BudgetSchedule schedule,
required UsageTrackingResource usageTrackingResource,
String? clientToken,
String? description,
Map<String, String>? tags,
}) async {
_s.validateNumRange(
'approximateDollarLimit',
approximateDollarLimit,
0.01,
1152921504606846976,
isRequired: true,
);
final headers = <String, String>{
if (clientToken != null) 'X-Amz-Client-Token': clientToken.toString(),
};
final $payload = <String, dynamic>{
'actions': actions,
'approximateDollarLimit': approximateDollarLimit,
'displayName': displayName,
'schedule': schedule,
'usageTrackingResource': usageTrackingResource,
if (description != null) 'description': description,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/2023-10-12/farms/${Uri.encodeComponent(farmId)}/budgets',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateBudgetResponse.fromJson(response);
}