updateInstanceCustomHealthStatus method

Future<void> updateInstanceCustomHealthStatus({
  1. required String instanceId,
  2. required String serviceId,
  3. 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 CustomHealthNotFound. May throw InstanceNotFound. May throw InvalidInput. May throw ServiceNotFound.

Parameter instanceId : The ID of the instance that you want to change the health status for.

Parameter serviceId : The ID or Amazon Resource Name (ARN) of the service that includes the configuration for the custom health check that you want to change the status for. 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 status : The new status of the instance, HEALTHY or UNHEALTHY.

Implementation

Future<void> updateInstanceCustomHealthStatus({
  required String instanceId,
  required String serviceId,
  required CustomHealthStatus status,
}) async {
  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.value,
    },
  );
}