Updates a budget. You can change every part of a budget except for the budgetName and the calculatedSpend. When you modify a budget, the calculatedSpend drops to zero until Amazon Web Services has new usage data to use for forecasting.
Only one of BudgetLimit or PlannedBudgetLimits can be present in the syntax at one time. Use the syntax that matches your case. The Request Syntax section shows the BudgetLimit syntax. For PlannedBudgetLimits, see the Examples section.
Similarly, only one set of filter and metric selections can be present in the syntax at one time. Either FilterExpression and Metrics or CostFilters and CostTypes, not both or a different combination. We recommend using FilterExpression and Metrics as they provide more flexible and powerful filtering capabilities. The Request Syntax section shows the FilterExpression/Metrics syntax.
Parameters:
-
account_id
(AccountId)
–
The accountId that is associated with the budget that you want to update.
-
new_budget
(Budget)
–
The budget that you want to update your budget to.
Raises:
Source code in docs_src/capo_budgets/_services/async_budgets.py
| async def update_budget(
self,
account_id: "capo_budgets.types.account_id.AccountId",
new_budget: "capo_budgets.types.budget.Budget",
*,
config_overrides: Optional[AsyncBudgetsClientConfig] = None,
) -> "capo_budgets.types.update_budget_response.UpdateBudgetResponse":
"""<p>Updates a budget. You can change every part of a budget except for the <code>budgetName</code> and the <code>calculatedSpend</code>. When you modify a budget, the <code>calculatedSpend</code> drops to zero until Amazon Web Services has new usage data to use for forecasting.</p> <important> <p>Only one of <code>BudgetLimit</code> or <code>PlannedBudgetLimits</code> can be present in the syntax at one time. Use the syntax that matches your case. The Request Syntax section shows the <code>BudgetLimit</code> syntax. For <code>PlannedBudgetLimits</code>, see the <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_UpdateBudget.html#API_UpdateBudget_Examples">Examples</a> section.</p> <p>Similarly, only one set of filter and metric selections can be present in the syntax at one time. Either <code>FilterExpression</code> and <code>Metrics</code> or <code>CostFilters</code> and <code>CostTypes</code>, not both or a different combination. We recommend using <code>FilterExpression</code> and <code>Metrics</code> as they provide more flexible and powerful filtering capabilities. The Request Syntax section shows the <code>FilterExpression</code>/<code>Metrics</code> syntax.</p> </important>
Args:
account_id: <p>The <code>accountId</code> that is associated with the budget that you want to update.</p>
new_budget: <p>The budget that you want to update your budget to.</p>
Raises:
capo_budgets.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to use this operation with the given parameters.</p>
capo_budgets.errors.billing_view_health_status_exception.BillingViewHealthStatusException: <p> The billing view status must be HEALTHY to perform this action. Try again when the status is HEALTHY. </p>
capo_budgets.errors.internal_error_exception.InternalErrorException: <p>An error on the server occurred during the processing of your request. Try again later.</p>
capo_budgets.errors.invalid_parameter_exception.InvalidParameterException: <p>An error on the client occurred. Typically, the cause is an invalid input value.</p>
capo_budgets.errors.not_found_exception.NotFoundException: <p>We can’t locate the resource that you specified.</p>
capo_budgets.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You've reached a Service Quota limit on this resource.</p>
capo_budgets.errors.throttling_exception.ThrottlingException: <p>The number of API requests has exceeded the maximum allowed API request throttling limit for the account.</p>
capo_budgets.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_budgets.types.update_budget_request.UpdateBudgetRequest]",
) -> AsyncOperationResponse[
"capo_budgets.types.update_budget_response.UpdateBudgetResponse"
]:
import capo_budgets._operations.aws_budget_service_gateway.update_budget
(
output,
http_response,
) = await capo_budgets._operations.aws_budget_service_gateway.update_budget.async_update_budget(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateBudget")
)
input_: capo_budgets.types.update_budget_request.UpdateBudgetRequest = {
"account_id": account_id,
"new_budget": new_budget,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|