Redeems an Amazon Web Services promotional credit code on behalf of the calling account. On success, a new credit is added to the account's credit ledger with the amount, validity period, and applicable products defined by the promotion. The credit is then automatically applied to subsequent bills according to the standard credit application order.
Parameters:
-
promo_code
(PromoCode)
–
The promotional credit code to redeem.
Raises:
Source code in docs_src/capo_billing/_services/async_billing.py
| async def redeem_credits(
self,
promo_code: "capo_billing.types.promo_code.PromoCode",
*,
config_overrides: Optional[AsyncBillingClientConfig] = None,
) -> "capo_billing.types.redeem_credits_response.RedeemCreditsResponse":
"""<p>Redeems an Amazon Web Services promotional credit code on behalf of the calling account. On success, a new credit is added to the account's credit ledger with the amount, validity period, and applicable products defined by the promotion. The credit is then automatically applied to subsequent bills according to the standard credit application order.</p>
Args:
promo_code: <p>The promotional credit code to redeem.</p>
Raises:
capo_billing.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
capo_billing.errors.internal_server_exception.InternalServerException: <p>The request processing failed because of an unknown error, exception, or failure. </p>
capo_billing.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. </p>
capo_billing.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service. </p>
capo_billing.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_billing.types.redeem_credits_request.RedeemCreditsRequest]",
) -> AsyncOperationResponse[
"capo_billing.types.redeem_credits_response.RedeemCreditsResponse"
]:
import capo_billing._operations.aws_billing.redeem_credits
(
output,
http_response,
) = await capo_billing._operations.aws_billing.redeem_credits.async_redeem_credits(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("RedeemCredits")
)
input_: capo_billing.types.redeem_credits_request.RedeemCreditsRequest = {
"promo_code": promo_code
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|