getSavingsPlansUtilization method

Future<GetSavingsPlansUtilizationResponse> getSavingsPlansUtilization({
  1. required DateInterval timePeriod,
  2. Expression? filter,
  3. Granularity? granularity,
})

Retrieves the Savings Plans utilization for your account across date ranges with daily or monthly granularity. Management account in an organization have access to member accounts. You can use GetDimensionValues in SAVINGS_PLANS to determine the possible dimension values.

May throw LimitExceededException. May throw DataUnavailableException.

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
  • SAVINGS_PLANS_TYPE
  • REGION
  • PAYMENT_OPTION
  • INSTANCE_TYPE_FAMILY
GetSavingsPlansUtilization uses the same Expression object as the other operations, but only AND is supported among each dimension.

Parameter granularity : The granularity of the Amazon Web Services utillization data for your Savings Plans.

The GetSavingsPlansUtilization operation supports only DAILY and MONTHLY granularities.

Implementation

Future<GetSavingsPlansUtilizationResponse> getSavingsPlansUtilization({
  required DateInterval timePeriod,
  Expression? filter,
  Granularity? granularity,
}) async {
  ArgumentError.checkNotNull(timePeriod, 'timePeriod');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSInsightsIndexService.GetSavingsPlansUtilization'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TimePeriod': timePeriod,
      if (filter != null) 'Filter': filter,
      if (granularity != null) 'Granularity': granularity.toValue(),
    },
  );

  return GetSavingsPlansUtilizationResponse.fromJson(jsonResponse.body);
}