getInstancesHealthStatus method
Gets the current health status (Healthy,
Unhealthy, or Unknown) of one or more instances
that are associated with a specified service.
May throw InstanceNotFound.
May throw InvalidInput.
May throw ServiceNotFound.
Parameter serviceId :
The ID or Amazon Resource Name (ARN) of the service that the instance is
associated with. For services created in a shared namespace, specify the
service ARN. For more information about shared namespaces, see Cross-account
Cloud Map namespace sharing in the Cloud Map Developer Guide.
Parameter instances :
An array that contains the IDs of all the instances that you want to get
the health status for.
If you omit Instances, Cloud Map returns the health status
for all the instances that are associated with the specified service.
Parameter maxResults :
The maximum number of instances that you want Cloud Map to return in the
response to a GetInstancesHealthStatus request. If you don't
specify a value for MaxResults, Cloud Map returns up to 100
instances.
Parameter nextToken :
For the first GetInstancesHealthStatus request, omit this
value.
If more than MaxResults instances match the specified
criteria, you can submit another GetInstancesHealthStatus
request to get the next group of results. Specify the value of
NextToken from the previous response in the next request.
Implementation
Future<GetInstancesHealthStatusResponse> getInstancesHealthStatus({
required String serviceId,
List<String>? instances,
int? maxResults,
String? nextToken,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
100,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Route53AutoNaming_v20170314.GetInstancesHealthStatus'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ServiceId': serviceId,
if (instances != null) 'Instances': instances,
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
},
);
return GetInstancesHealthStatusResponse.fromJson(jsonResponse.body);
}