Skip to content

get_lambda_function_recommendations async

get_lambda_function_recommendations(
    *,
    config_overrides: Optional[AsyncComputeOptimizerClientConfig] = None,
    function_arns: Optional[FunctionArns] = None,
    account_ids: Optional[AccountIds] = None,
    filters: Optional[LambdaFunctionRecommendationFilters] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> GetLambdaFunctionRecommendationsResponse

Returns Lambda function recommendations.

Compute Optimizer generates recommendations for functions that meet a specific set of requirements. For more information, see the Supported resources and requirements in the Compute Optimizer User Guide.

Parameters:

  • function_arns (Optional[FunctionArns], default: None ) –

    The Amazon Resource Name (ARN) of the functions for which to return recommendations.

    You can specify a qualified or unqualified ARN. If you specify an unqualified ARN without a function version suffix, Compute Optimizer will return recommendations for the latest ($LATEST) version of the function. If you specify a qualified ARN with a version suffix, Compute Optimizer will return recommendations for the specified function version. For more information about using function versions, see Using versions in the Lambda Developer Guide.

  • account_ids (Optional[AccountIds], default: None ) –

    The ID of the Amazon Web Services account for which to return function recommendations.

    If your account is the management account of an organization, use this parameter to specify the member account for which you want to return function recommendations.

    Only one account ID can be specified per request.

  • filters (Optional[LambdaFunctionRecommendationFilters], default: None ) –

    An array of objects to specify a filter that returns a more specific list of function recommendations.

  • next_token (Optional[NextToken], default: None ) –

    The token to advance to the next page of function recommendations.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of function recommendations to return with a single request.

    To retrieve the remaining results, make another request with the returned nextToken value.

Raises:

Source code in docs_src/capo_compute_optimizer/_services/async_compute_optimizer.py
async def get_lambda_function_recommendations(
    self,
    *,
    config_overrides: Optional[AsyncComputeOptimizerClientConfig] = None,
    function_arns: Optional[
        "capo_compute_optimizer.types.function_arns.FunctionArns"
    ] = None,
    account_ids: Optional[
        "capo_compute_optimizer.types.account_ids.AccountIds"
    ] = None,
    filters: Optional[
        "capo_compute_optimizer.types.lambda_function_recommendation_filters.LambdaFunctionRecommendationFilters"
    ] = None,
    next_token: Optional[
        "capo_compute_optimizer.types.next_token.NextToken"
    ] = None,
    max_results: Optional[
        "capo_compute_optimizer.types.max_results.MaxResults"
    ] = None,
) -> "capo_compute_optimizer.types.get_lambda_function_recommendations_response.GetLambdaFunctionRecommendationsResponse":
    """<p>Returns Lambda function recommendations.</p> <p>Compute Optimizer generates recommendations for functions that meet a specific set of requirements. For more information, see the <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/requirements.html">Supported resources and requirements</a> in the <i>Compute Optimizer User Guide</i>.</p>

    Args:
        function_arns: <p>The Amazon Resource Name (ARN) of the functions for which to return recommendations.</p> <p>You can specify a qualified or unqualified ARN. If you specify an unqualified ARN without a function version suffix, Compute Optimizer will return recommendations for the latest (<code>$LATEST</code>) version of the function. If you specify a qualified ARN with a version suffix, Compute Optimizer will return recommendations for the specified function version. For more information about using function versions, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html#versioning-versions-using">Using versions</a> in the <i>Lambda Developer Guide</i>.</p>
        account_ids: <p>The ID of the Amazon Web Services account for which to return function recommendations.</p> <p>If your account is the management account of an organization, use this parameter to specify the member account for which you want to return function recommendations.</p> <p>Only one account ID can be specified per request.</p>
        filters: <p>An array of objects to specify a filter that returns a more specific list of function recommendations.</p>
        next_token: <p>The token to advance to the next page of function recommendations.</p>
        max_results: <p>The maximum number of function recommendations to return with a single request.</p> <p>To retrieve the remaining results, make another request with the returned <code>nextToken</code> value.</p>

    Raises:
        capo_compute_optimizer.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_compute_optimizer.errors.internal_server_exception.InternalServerException: <p>An internal error has occurred. Try your call again.</p>
        capo_compute_optimizer.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value supplied for the input parameter is out of range or not valid.</p>
        capo_compute_optimizer.errors.limit_exceeded_exception.LimitExceededException: <p>The request exceeds a limit of the service.</p>
        capo_compute_optimizer.errors.missing_authentication_token.MissingAuthenticationToken: <p>The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 certificate.</p>
        capo_compute_optimizer.errors.opt_in_required_exception.OptInRequiredException: <p>The account is not opted in to Compute Optimizer.</p>
        capo_compute_optimizer.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request has failed due to a temporary failure of the server.</p>
        capo_compute_optimizer.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_compute_optimizer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_compute_optimizer.types.get_lambda_function_recommendations_request.GetLambdaFunctionRecommendationsRequest]",
    ) -> AsyncOperationResponse[
        "capo_compute_optimizer.types.get_lambda_function_recommendations_response.GetLambdaFunctionRecommendationsResponse"
    ]:
        import capo_compute_optimizer._operations.compute_optimizer_service.get_lambda_function_recommendations

        (
            output,
            http_response,
        ) = await capo_compute_optimizer._operations.compute_optimizer_service.get_lambda_function_recommendations.async_get_lambda_function_recommendations(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetLambdaFunctionRecommendations")
    )
    input_: capo_compute_optimizer.types.get_lambda_function_recommendations_request.GetLambdaFunctionRecommendationsRequest = {}
    if function_arns is not None:
        input_["function_arns"] = function_arns
    if account_ids is not None:
        input_["account_ids"] = account_ids
    if filters is not None:
        input_["filters"] = filters
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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