Skip to content

return_savings_plan async

return_savings_plan(
    savings_plan_id: SavingsPlanId,
    *,
    config_overrides: Optional[AsyncsavingsplansClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> ReturnSavingsPlanResponse

Returns the specified Savings Plan.

Parameters:

  • savings_plan_id (SavingsPlanId) –

    The ID of the Savings Plan.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Raises:

Source code in docs_src/capo_savingsplans/_services/async_savingsplans.py
async def return_savings_plan(
    self,
    savings_plan_id: "capo_savingsplans.types.savings_plan_id.SavingsPlanId",
    *,
    config_overrides: Optional[AsyncsavingsplansClientConfig] = None,
    client_token: Optional[
        "capo_savingsplans.types.client_token.ClientToken"
    ] = None,
) -> (
    "capo_savingsplans.types.return_savings_plan_response.ReturnSavingsPlanResponse"
):
    """<p>Returns the specified Savings Plan.</p>

    Args:
        savings_plan_id: <p>The ID of the Savings Plan.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>

    Raises:
        capo_savingsplans.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred.</p>
        capo_savingsplans.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_savingsplans.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>A service quota has been exceeded.</p>
        capo_savingsplans.errors.validation_exception.ValidationException: <p>One of the input parameters is not valid.</p>
        capo_savingsplans.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_savingsplans.types.return_savings_plan_request.ReturnSavingsPlanRequest]",
    ) -> AsyncOperationResponse[
        "capo_savingsplans.types.return_savings_plan_response.ReturnSavingsPlanResponse"
    ]:
        import capo_savingsplans._operations.aws_savings_plan.return_savings_plan

        (
            output,
            http_response,
        ) = await capo_savingsplans._operations.aws_savings_plan.return_savings_plan.async_return_savings_plan(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ReturnSavingsPlan")
    )
    input_: capo_savingsplans.types.return_savings_plan_request.ReturnSavingsPlanRequest = {
        "savings_plan_id": savings_plan_id
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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