Skip to content

get_recommendation async

get_recommendation(
    recommendation_id: str,
    *,
    config_overrides: Optional[AsyncCostOptimizationHubClientConfig] = None,
) -> GetRecommendationResponse

Returns both the current and recommended resource configuration and the estimated cost impact for a recommendation.

The recommendationId is only valid for up to a maximum of 24 hours as recommendations are refreshed daily. To retrieve the recommendationId, use the ListRecommendations API.

Parameters:

  • recommendation_id (str) –

    The ID for the recommendation.

Raises:

Source code in docs_src/capo_cost_optimization_hub/_services/async_cost_optimization_hub.py
async def get_recommendation(
    self,
    recommendation_id: str,
    *,
    config_overrides: Optional[AsyncCostOptimizationHubClientConfig] = None,
) -> "capo_cost_optimization_hub.types.get_recommendation_response.GetRecommendationResponse":
    """<p>Returns both the current and recommended resource configuration and the estimated cost impact for a recommendation.</p> <p>The <code>recommendationId</code> is only valid for up to a maximum of 24 hours as recommendations are refreshed daily. To retrieve the <code>recommendationId</code>, use the <code>ListRecommendations</code> API.</p>

    Args:
        recommendation_id: <p>The ID for the recommendation.</p>

    Raises:
        capo_cost_optimization_hub.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to use this operation with the given parameters.</p>
        capo_cost_optimization_hub.errors.internal_server_exception.InternalServerException: <p>An error on the server occurred during the processing of your request. Try again later.</p>
        capo_cost_optimization_hub.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified Amazon Resource Name (ARN) in the request doesn't exist.</p>
        capo_cost_optimization_hub.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_cost_optimization_hub.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_cost_optimization_hub.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cost_optimization_hub.types.get_recommendation_request.GetRecommendationRequest]",
    ) -> AsyncOperationResponse[
        "capo_cost_optimization_hub.types.get_recommendation_response.GetRecommendationResponse"
    ]:
        import capo_cost_optimization_hub._operations.cost_optimization_hub_service.get_recommendation

        (
            output,
            http_response,
        ) = await capo_cost_optimization_hub._operations.cost_optimization_hub_service.get_recommendation.async_get_recommendation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetRecommendation")
    )
    input_: capo_cost_optimization_hub.types.get_recommendation_request.GetRecommendationRequest = {
        "recommendation_id": recommendation_id
    }

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