listInstances method
- required String clusterId,
- String? instanceFleetId,
- InstanceFleetType? instanceFleetType,
- String? instanceGroupId,
- List<
InstanceGroupType> ? instanceGroupTypes, - List<
InstanceState> ? instanceStates, - String? marker,
Provides information for all active EC2 instances and EC2 instances terminated in the last 30 days, up to a maximum of 2,000. EC2 instances in any of the following states are considered active: AWAITING_FULFILLMENT, PROVISIONING, BOOTSTRAPPING, RUNNING.
May throw InternalServerException. May throw InvalidRequestException.
Parameter clusterId
:
The identifier of the cluster for which to list the instances.
Parameter instanceFleetId
:
The unique identifier of the instance fleet.
Parameter instanceFleetType
:
The node type of the instance fleet. For example MASTER, CORE, or TASK.
Parameter instanceGroupId
:
The identifier of the instance group for which to list the instances.
Parameter instanceGroupTypes
:
The type of instance group for which to list the instances.
Parameter instanceStates
:
A list of instance states that will filter the instances returned with
this request.
Parameter marker
:
The pagination token that indicates the next set of results to retrieve.
Implementation
Future<ListInstancesOutput> listInstances({
required String clusterId,
String? instanceFleetId,
InstanceFleetType? instanceFleetType,
String? instanceGroupId,
List<InstanceGroupType>? instanceGroupTypes,
List<InstanceState>? instanceStates,
String? marker,
}) async {
ArgumentError.checkNotNull(clusterId, 'clusterId');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'ElasticMapReduce.ListInstances'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ClusterId': clusterId,
if (instanceFleetId != null) 'InstanceFleetId': instanceFleetId,
if (instanceFleetType != null)
'InstanceFleetType': instanceFleetType.toValue(),
if (instanceGroupId != null) 'InstanceGroupId': instanceGroupId,
if (instanceGroupTypes != null)
'InstanceGroupTypes':
instanceGroupTypes.map((e) => e.toValue()).toList(),
if (instanceStates != null)
'InstanceStates': instanceStates.map((e) => e.toValue()).toList(),
if (marker != null) 'Marker': marker,
},
);
return ListInstancesOutput.fromJson(jsonResponse.body);
}