getLambdaFunctionRecommendations method

Future<GetLambdaFunctionRecommendationsResponse> getLambdaFunctionRecommendations({
  1. List<String>? accountIds,
  2. List<LambdaFunctionRecommendationFilter>? filters,
  3. List<String>? functionArns,
  4. int? maxResults,
  5. String? nextToken,
})

Returns AWS Lambda function recommendations.

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

May throw OptInRequiredException. May throw InternalServerException. May throw ServiceUnavailableException. May throw AccessDeniedException. May throw InvalidParameterValueException. May throw MissingAuthenticationToken. May throw ThrottlingException. May throw LimitExceededException.

Parameter accountIds : The IDs of the AWS accounts for which to return function recommendations.

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

Only one account ID can be specified per request.

Parameter filters : An array of objects that describe a filter that returns a more specific list of function recommendations.

Parameter functionArns : 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 AWS Lambda Developer Guide.

Parameter maxResults : 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.

Parameter nextToken : The token to advance to the next page of function recommendations.

Implementation

Future<GetLambdaFunctionRecommendationsResponse>
    getLambdaFunctionRecommendations({
  List<String>? accountIds,
  List<LambdaFunctionRecommendationFilter>? filters,
  List<String>? functionArns,
  int? maxResults,
  String? nextToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'ComputeOptimizerService.GetLambdaFunctionRecommendations'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (accountIds != null) 'accountIds': accountIds,
      if (filters != null) 'filters': filters,
      if (functionArns != null) 'functionArns': functionArns,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return GetLambdaFunctionRecommendationsResponse.fromJson(jsonResponse.body);
}