getSavingsPlansUtilizationDetails method

Future<GetSavingsPlansUtilizationDetailsResponse> getSavingsPlansUtilizationDetails({
  1. required DateInterval timePeriod,
  2. Expression? filter,
  3. int? maxResults,
  4. String? nextToken,
})

Retrieves attribute data along with aggregate utilization and savings data for a given time period. This doesn't support granular or grouped data (daily/monthly) in response. You can't retrieve data by dates in a single response similar to GetSavingsPlanUtilization, but you have the option to make multiple calls to GetSavingsPlanUtilizationDetails by providing individual dates. You can use GetDimensionValues in SAVINGS_PLANS to determine the possible dimension values.

May throw LimitExceededException. May throw DataUnavailableException. May throw InvalidNextTokenException.

Parameter timePeriod : The time period that you want the usage and costs for. The Start date must be within 13 months. The End date must be after the Start date, and before the current date. Future dates can't be used as an End date.

Parameter filter : Filters Savings Plans utilization coverage data for active Savings Plans dimensions. You can filter data with the following dimensions:

  • LINKED_ACCOUNT
  • SAVINGS_PLAN_ARN
  • REGION
  • PAYMENT_OPTION
  • INSTANCE_TYPE_FAMILY
GetSavingsPlansUtilizationDetails uses the same Expression object as the other operations, but only AND is supported among each dimension.

Parameter maxResults : The number of items to be returned in a response. The default is 20, with a minimum value of 1.

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

Implementation

Future<GetSavingsPlansUtilizationDetailsResponse>
    getSavingsPlansUtilizationDetails({
  required DateInterval timePeriod,
  Expression? filter,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(timePeriod, 'timePeriod');
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1152921504606846976,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWSInsightsIndexService.GetSavingsPlansUtilizationDetails'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TimePeriod': timePeriod,
      if (filter != null) 'Filter': filter,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetSavingsPlansUtilizationDetailsResponse.fromJson(
      jsonResponse.body);
}