listRecommendations method

Future<ListRecommendationsResponse> listRecommendations({
  1. Filter? filter,
  2. bool? includeAllRecommendations,
  3. int? maxResults,
  4. String? nextToken,
  5. OrderBy? orderBy,
})

Returns a list of recommendations.

May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter filter : The constraints that you want all returned recommendations to match.

Parameter includeAllRecommendations : List of all recommendations for a resource, or a single recommendation if de-duped by resourceId.

Parameter maxResults : The maximum number of recommendations that are returned for the request.

Parameter nextToken : The token to retrieve the next set of results.

Parameter orderBy : The ordering of recommendations by a dimension.

Implementation

Future<ListRecommendationsResponse> listRecommendations({
  Filter? filter,
  bool? includeAllRecommendations,
  int? maxResults,
  String? nextToken,
  OrderBy? orderBy,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'CostOptimizationHubService.ListRecommendations'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (filter != null) 'filter': filter,
      if (includeAllRecommendations != null)
        'includeAllRecommendations': includeAllRecommendations,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (orderBy != null) 'orderBy': orderBy,
    },
  );

  return ListRecommendationsResponse.fromJson(jsonResponse.body);
}