getEC2InstanceRecommendations method
Returns Amazon EC2 instance recommendations.
AWS Compute Optimizer generates recommendations for Amazon Elastic Compute Cloud (Amazon EC2) instances that meet a specific set of requirements. For more information, see the Supported resources and requirements in the AWS Compute Optimizer User Guide.
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 accountIds
:
The IDs of the AWS accounts for which to return instance recommendations.
If your account is the management account of an organization, use this parameter to specify the member accounts for which you want to return instance recommendations.
Only one account ID can be specified per request.
Parameter filters
:
An array of objects that describe a filter that returns a more specific
list of instance recommendations.
Parameter instanceArns
:
The Amazon Resource Name (ARN) of the instances for which to return
recommendations.
Parameter maxResults
:
The maximum number of instance recommendations to return with a single
request.
To retrieve the remaining results, make another request with the returned
NextToken
value.
Parameter nextToken
:
The token to advance to the next page of instance recommendations.
Implementation
Future<GetEC2InstanceRecommendationsResponse> getEC2InstanceRecommendations({
List<String>? accountIds,
List<Filter>? filters,
List<String>? instanceArns,
int? maxResults,
String? nextToken,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'ComputeOptimizerService.GetEC2InstanceRecommendations'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (accountIds != null) 'accountIds': accountIds,
if (filters != null) 'filters': filters,
if (instanceArns != null) 'instanceArns': instanceArns,
if (maxResults != null) 'maxResults': maxResults,
if (nextToken != null) 'nextToken': nextToken,
},
);
return GetEC2InstanceRecommendationsResponse.fromJson(jsonResponse.body);
}