listRecommendationSummaries method

Future<ListRecommendationSummariesResponse> listRecommendationSummaries({
  1. required String groupBy,
  2. Filter? filter,
  3. int? maxResults,
  4. List<SummaryMetrics>? metrics,
  5. String? nextToken,
})

Returns a concise representation of savings estimates for resources. Also returns de-duped savings across different types of recommendations.

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

Parameter groupBy : The grouping of recommendations by a dimension.

Parameter maxResults : The maximum number of recommendations to be returned for the request.

Parameter metrics : Additional metrics to be returned for the request. The only valid value is savingsPercentage.

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

Implementation

Future<ListRecommendationSummariesResponse> listRecommendationSummaries({
  required String groupBy,
  Filter? filter,
  int? maxResults,
  List<SummaryMetrics>? metrics,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'CostOptimizationHubService.ListRecommendationSummaries'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'groupBy': groupBy,
      if (filter != null) 'filter': filter,
      if (maxResults != null) 'maxResults': maxResults,
      if (metrics != null) 'metrics': metrics.map((e) => e.value).toList(),
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return ListRecommendationSummariesResponse.fromJson(jsonResponse.body);
}