Skip to content

update_spending_limit async

update_spending_limit(
    spending_limit_arn: SpendingLimitArn,
    client_token: String64,
    *,
    config_overrides: Optional[AsyncBraketClientConfig] = None,
    spending_limit: Optional[str] = None,
    time_period: Optional[TimePeriod] = None,
) -> UpdateSpendingLimitResponse

Updates an existing spending limit. You can modify the spending amount or time period. Changes take effect immediately.

Parameters:

  • spending_limit_arn (SpendingLimitArn) –

    The Amazon Resource Name (ARN) of the spending limit to update.

  • client_token (String64) –

    A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, Amazon Braket ignores the request, but does not return an error.

  • spending_limit (Optional[str], default: None ) –

    The new maximum amount that can be spent on the specified device, in USD.

  • time_period (Optional[TimePeriod], default: None ) –

    The new time period during which the spending limit is active, including start and end dates.

Raises:

Source code in docs_src/capo_braket/_services/async_braket.py
async def update_spending_limit(
    self,
    spending_limit_arn: "capo_braket.types.spending_limit_arn.SpendingLimitArn",
    client_token: "capo_braket.types.string64.String64",
    *,
    config_overrides: Optional[AsyncBraketClientConfig] = None,
    spending_limit: Optional[str] = None,
    time_period: Optional["capo_braket.types.time_period.TimePeriod"] = None,
) -> "capo_braket.types.update_spending_limit_response.UpdateSpendingLimitResponse":
    """<p>Updates an existing spending limit. You can modify the spending amount or time period. Changes take effect immediately.</p>

    Args:
        spending_limit_arn: <p>The Amazon Resource Name (ARN) of the spending limit to update.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, Amazon Braket ignores the request, but does not return an error.</p>
        spending_limit: <p>The new maximum amount that can be spent on the specified device, in USD.</p>
        time_period: <p>The new time period during which the spending limit is active, including start and end dates.</p>

    Raises:
        capo_braket.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_braket.errors.internal_service_exception.InternalServiceException: <p>The request failed because of an unknown error.</p>
        capo_braket.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_braket.errors.throttling_exception.ThrottlingException: <p>The API throttling rate limit is exceeded.</p>
        capo_braket.errors.validation_exception.ValidationException: <p>The input request failed to satisfy constraints expected by Amazon Braket.</p>
        capo_braket.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_braket.types.update_spending_limit_request.UpdateSpendingLimitRequest]",
    ) -> AsyncOperationResponse[
        "capo_braket.types.update_spending_limit_response.UpdateSpendingLimitResponse"
    ]:
        import capo_braket._operations.braket.update_spending_limit

        (
            output,
            http_response,
        ) = await capo_braket._operations.braket.update_spending_limit.async_update_spending_limit(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateSpendingLimit")
    )
    input_: capo_braket.types.update_spending_limit_request.UpdateSpendingLimitRequest = {
        "spending_limit_arn": spending_limit_arn,
        "client_token": client_token,
    }
    if spending_limit is not None:
        input_["spending_limit"] = spending_limit
    if time_period is not None:
        input_["time_period"] = time_period

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output