updateInstanceCustomHealthStatus method
- required String instanceId,
- required String serviceId,
- required CustomHealthStatus status,
Submits a request to change the health status of a custom health check to healthy or unhealthy.
You can use UpdateInstanceCustomHealthStatus
to change the
status only for custom health checks, which you define using
HealthCheckCustomConfig
when you create a service. You can't
use it to change the status for Route 53 health checks, which you define
using HealthCheckConfig
.
For more information, see HealthCheckCustomConfig.
May throw InstanceNotFound. May throw ServiceNotFound. May throw CustomHealthNotFound. May throw InvalidInput.
Parameter instanceId
:
The ID of the instance that you want to change the health status for.
Parameter serviceId
:
The ID of the service that includes the configuration for the custom
health check that you want to change the status for.
Parameter status
:
The new status of the instance, HEALTHY
or
UNHEALTHY
.
Implementation
Future<void> updateInstanceCustomHealthStatus({
required String instanceId,
required String serviceId,
required CustomHealthStatus status,
}) async {
ArgumentError.checkNotNull(instanceId, 'instanceId');
_s.validateStringLength(
'instanceId',
instanceId,
0,
64,
isRequired: true,
);
ArgumentError.checkNotNull(serviceId, 'serviceId');
_s.validateStringLength(
'serviceId',
serviceId,
0,
64,
isRequired: true,
);
ArgumentError.checkNotNull(status, 'status');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target':
'Route53AutoNaming_v20170314.UpdateInstanceCustomHealthStatus'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'InstanceId': instanceId,
'ServiceId': serviceId,
'Status': status.toValue(),
},
);
}