getEC2RecommendationProjectedMetrics method

Future<GetEC2RecommendationProjectedMetricsResponse> getEC2RecommendationProjectedMetrics({
  1. required DateTime endTime,
  2. required String instanceArn,
  3. required int period,
  4. required DateTime startTime,
  5. required MetricStatistic stat,
})

Returns the projected utilization metrics of Amazon EC2 instance recommendations.

May throw OptInRequiredException. May throw InternalServerException. May throw ServiceUnavailableException. May throw AccessDeniedException. May throw InvalidParameterValueException. May throw ResourceNotFoundException. May throw MissingAuthenticationToken. May throw ThrottlingException.

Parameter endTime : The time stamp of the last projected metrics data point to return.

Parameter instanceArn : The Amazon Resource Name (ARN) of the instances for which to return recommendation projected metrics.

Parameter period : The granularity, in seconds, of the projected metrics data points.

Parameter startTime : The time stamp of the first projected metrics data point to return.

Parameter stat : The statistic of the projected metrics.

Implementation

Future<GetEC2RecommendationProjectedMetricsResponse>
    getEC2RecommendationProjectedMetrics({
  required DateTime endTime,
  required String instanceArn,
  required int period,
  required DateTime startTime,
  required MetricStatistic stat,
}) async {
  ArgumentError.checkNotNull(endTime, 'endTime');
  ArgumentError.checkNotNull(instanceArn, 'instanceArn');
  ArgumentError.checkNotNull(period, 'period');
  ArgumentError.checkNotNull(startTime, 'startTime');
  ArgumentError.checkNotNull(stat, 'stat');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target':
        'ComputeOptimizerService.GetEC2RecommendationProjectedMetrics'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'endTime': unixTimestampToJson(endTime),
      'instanceArn': instanceArn,
      'period': period,
      'startTime': unixTimestampToJson(startTime),
      'stat': stat.toValue(),
    },
  );

  return GetEC2RecommendationProjectedMetricsResponse.fromJson(
      jsonResponse.body);
}