Skip to content

get_savings_plans_purchase_recommendation async

get_savings_plans_purchase_recommendation(
    savings_plans_type: SupportedSavingsPlansType,
    term_in_years: TermInYears,
    payment_option: PaymentOption,
    lookback_period_in_days: LookbackPeriodInDays,
    *,
    config_overrides: Optional[AsyncCostExplorerClientConfig] = None,
    account_scope: Optional[AccountScope] = None,
    next_page_token: Optional[NextPageToken] = None,
    page_size: Optional[RecommendationsPageSize] = None,
    filter: Optional[Expression] = None,
) -> GetSavingsPlansPurchaseRecommendationResponse

Retrieves the Savings Plans recommendations for your account. First use StartSavingsPlansPurchaseRecommendationGeneration to generate a new set of recommendations, and then use GetSavingsPlansPurchaseRecommendation to retrieve them.

Parameters:

  • savings_plans_type (SupportedSavingsPlansType) –

    The Savings Plans recommendation type that's requested.

  • term_in_years (TermInYears) –

    The savings plan recommendation term that's used to generate these recommendations.

  • payment_option (PaymentOption) –

    The payment option that's used to generate these recommendations.

  • account_scope (Optional[AccountScope], default: None ) –

    The account scope that you want your recommendations for. Amazon Web Services calculates recommendations including the management account and member accounts if the value is set to PAYER. If the value is LINKED, recommendations are calculated for individual member accounts only.

  • next_page_token (Optional[NextPageToken], default: None ) –

    The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

  • page_size (Optional[RecommendationsPageSize], default: None ) –

    The number of recommendations that you want returned in a single response object.

  • lookback_period_in_days (LookbackPeriodInDays) –

    The lookback period that's used to generate the recommendation.

  • filter (Optional[Expression], default: None ) –

    You can filter your recommendations by Account ID with the LINKED_ACCOUNT dimension. To filter your recommendations by Account ID, specify Key as LINKED_ACCOUNT and Value as the comma-separated Acount ID(s) that you want to see Savings Plans purchase recommendations for.

    For GetSavingsPlansPurchaseRecommendation, the Filter doesn't include CostCategories or Tags. It only includes Dimensions. With Dimensions, Key must be LINKED_ACCOUNT and Value can be a single Account ID or multiple comma-separated Account IDs that you want to see Savings Plans Purchase Recommendations for. AND and OR operators are not supported.

Raises:

Source code in docs_src/capo_cost_explorer/_services/async_cost_explorer.py
async def get_savings_plans_purchase_recommendation(
    self,
    savings_plans_type: "capo_cost_explorer.types.supported_savings_plans_type.SupportedSavingsPlansType",
    term_in_years: "capo_cost_explorer.types.term_in_years.TermInYears",
    payment_option: "capo_cost_explorer.types.payment_option.PaymentOption",
    lookback_period_in_days: "capo_cost_explorer.types.lookback_period_in_days.LookbackPeriodInDays",
    *,
    config_overrides: Optional[AsyncCostExplorerClientConfig] = None,
    account_scope: Optional[
        "capo_cost_explorer.types.account_scope.AccountScope"
    ] = None,
    next_page_token: Optional[
        "capo_cost_explorer.types.next_page_token.NextPageToken"
    ] = None,
    page_size: Optional[
        "capo_cost_explorer.types.recommendations_page_size.RecommendationsPageSize"
    ] = None,
    filter: Optional["capo_cost_explorer.types.expression.Expression"] = None,
) -> "capo_cost_explorer.types.get_savings_plans_purchase_recommendation_response.GetSavingsPlansPurchaseRecommendationResponse":
    """<p>Retrieves the Savings Plans recommendations for your account. First use <code>StartSavingsPlansPurchaseRecommendationGeneration</code> to generate a new set of recommendations, and then use <code>GetSavingsPlansPurchaseRecommendation</code> to retrieve them.</p>

    Args:
        savings_plans_type: <p>The Savings Plans recommendation type that's requested.</p>
        term_in_years: <p>The savings plan recommendation term that's used to generate these recommendations.</p>
        payment_option: <p>The payment option that's used to generate these recommendations.</p>
        account_scope: <p>The account scope that you want your recommendations for. Amazon Web Services calculates recommendations including the management account and member accounts if the value is set to <code>PAYER</code>. If the value is <code>LINKED</code>, recommendations are calculated for individual member accounts only.</p>
        next_page_token: <p>The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.</p>
        page_size: <p>The number of recommendations that you want returned in a single response object.</p>
        lookback_period_in_days: <p>The lookback period that's used to generate the recommendation.</p>
        filter: <p>You can filter your recommendations by Account ID with the <code>LINKED_ACCOUNT</code> dimension. To filter your recommendations by Account ID, specify <code>Key</code> as <code>LINKED_ACCOUNT</code> and <code>Value</code> as the comma-separated Acount ID(s) that you want to see Savings Plans purchase recommendations for.</p> <p>For GetSavingsPlansPurchaseRecommendation, the <code>Filter</code> doesn't include <code>CostCategories</code> or <code>Tags</code>. It only includes <code>Dimensions</code>. With <code>Dimensions</code>, <code>Key</code> must be <code>LINKED_ACCOUNT</code> and <code>Value</code> can be a single Account ID or multiple comma-separated Account IDs that you want to see Savings Plans Purchase Recommendations for. <code>AND</code> and <code>OR</code> operators are not supported.</p>

    Raises:
        capo_cost_explorer.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The pagination token is invalid. Try again without a pagination token.</p>
        capo_cost_explorer.errors.limit_exceeded_exception.LimitExceededException: <p>You made too many calls in a short period of time. Try again later.</p>
        capo_cost_explorer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cost_explorer.types.get_savings_plans_purchase_recommendation_request.GetSavingsPlansPurchaseRecommendationRequest]",
    ) -> AsyncOperationResponse[
        "capo_cost_explorer.types.get_savings_plans_purchase_recommendation_response.GetSavingsPlansPurchaseRecommendationResponse"
    ]:
        import capo_cost_explorer._operations.aws_insights_index_service.get_savings_plans_purchase_recommendation

        (
            output,
            http_response,
        ) = await capo_cost_explorer._operations.aws_insights_index_service.get_savings_plans_purchase_recommendation.async_get_savings_plans_purchase_recommendation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetSavingsPlansPurchaseRecommendation")
    )
    input_: capo_cost_explorer.types.get_savings_plans_purchase_recommendation_request.GetSavingsPlansPurchaseRecommendationRequest = {
        "savings_plans_type": savings_plans_type,
        "term_in_years": term_in_years,
        "payment_option": payment_option,
        "lookback_period_in_days": lookback_period_in_days,
    }
    if account_scope is not None:
        input_["account_scope"] = account_scope
    if next_page_token is not None:
        input_["next_page_token"] = next_page_token
    if page_size is not None:
        input_["page_size"] = page_size
    if filter is not None:
        input_["filter"] = filter

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