getEC2RecommendationProjectedMetrics method
Returns the projected utilization metrics of Amazon EC2 instance recommendations.
May throw AccessDeniedException.
May throw InternalServerException.
May throw InvalidParameterValueException.
May throw MissingAuthenticationToken.
May throw OptInRequiredException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
Parameter endTime :
The timestamp 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 timestamp of the first projected metrics data point to return.
Parameter stat :
The statistic of the projected metrics.
Parameter recommendationPreferences :
An object to specify the preferences for the Amazon EC2 recommendation
projected metrics to return in the response.
Implementation
Future<GetEC2RecommendationProjectedMetricsResponse>
getEC2RecommendationProjectedMetrics({
required DateTime endTime,
required String instanceArn,
required int period,
required DateTime startTime,
required MetricStatistic stat,
RecommendationPreferences? recommendationPreferences,
}) async {
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.value,
if (recommendationPreferences != null)
'recommendationPreferences': recommendationPreferences,
},
);
return GetEC2RecommendationProjectedMetricsResponse.fromJson(
jsonResponse.body);
}