getSavingsPlansPurchaseRecommendation method

Future<GetSavingsPlansPurchaseRecommendationResponse> getSavingsPlansPurchaseRecommendation({
  1. required LookbackPeriodInDays lookbackPeriodInDays,
  2. required PaymentOption paymentOption,
  3. required SupportedSavingsPlansType savingsPlansType,
  4. required TermInYears termInYears,
  5. AccountScope? accountScope,
  6. Expression? filter,
  7. String? nextPageToken,
  8. int? pageSize,
})

Retrieves your request parameters, Savings Plan Recommendations Summary and Details.

May throw LimitExceededException. May throw InvalidNextTokenException.

Parameter lookbackPeriodInDays : The lookback period used to generate the recommendation.

Parameter paymentOption : The payment option used to generate these recommendations.

Parameter savingsPlansType : The Savings Plans recommendation type requested.

Parameter termInYears : The savings plan recommendation term used to generate these recommendations.

Parameter accountScope : The account scope that you want your recommendations for. Amazon Web Services calculates recommendations including the management account and member accounts if the value is set to PAYER. If the value is LINKED, recommendations are calculated for individual member accounts only.

Parameter filter : You can filter your recommendations by Account ID with the LINKED_ACCOUNT dimension. To filter your recommendations by Account ID, specify Key as LINKED_ACCOUNT and Value as the comma-separated Acount ID(s) for which you want to see Savings Plans purchase recommendations.

For GetSavingsPlansPurchaseRecommendation, the Filter does not include CostCategories or Tags. It only includes Dimensions. With Dimensions, Key must be LINKED_ACCOUNT and Value can be a single Account ID or multiple comma-separated Account IDs for which you want to see Savings Plans Purchase Recommendations. AND and OR operators are not supported.

Parameter nextPageToken : The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

Parameter pageSize : The number of recommendations that you want returned in a single response object.

Implementation

Future<GetSavingsPlansPurchaseRecommendationResponse>
    getSavingsPlansPurchaseRecommendation({
  required LookbackPeriodInDays lookbackPeriodInDays,
  required PaymentOption paymentOption,
  required SupportedSavingsPlansType savingsPlansType,
  required TermInYears termInYears,
  AccountScope? accountScope,
  Expression? filter,
  String? nextPageToken,
  int? pageSize,
}) async {
  ArgumentError.checkNotNull(lookbackPeriodInDays, 'lookbackPeriodInDays');
  ArgumentError.checkNotNull(paymentOption, 'paymentOption');
  ArgumentError.checkNotNull(savingsPlansType, 'savingsPlansType');
  ArgumentError.checkNotNull(termInYears, 'termInYears');
  _s.validateStringLength(
    'nextPageToken',
    nextPageToken,
    0,
    8192,
  );
  _s.validateNumRange(
    'pageSize',
    pageSize,
    0,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWSInsightsIndexService.GetSavingsPlansPurchaseRecommendation'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LookbackPeriodInDays': lookbackPeriodInDays.toValue(),
      'PaymentOption': paymentOption.toValue(),
      'SavingsPlansType': savingsPlansType.toValue(),
      'TermInYears': termInYears.toValue(),
      if (accountScope != null) 'AccountScope': accountScope.toValue(),
      if (filter != null) 'Filter': filter,
      if (nextPageToken != null) 'NextPageToken': nextPageToken,
      if (pageSize != null) 'PageSize': pageSize,
    },
  );

  return GetSavingsPlansPurchaseRecommendationResponse.fromJson(
      jsonResponse.body);
}