| 1 | import type * as SD from "@distilled.cloud/aws/servicediscovery"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Service } from "./Service.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `UpdateInstanceCustomHealthStatus` request with `ServiceId` injected from |
| 8 | * the bound {@link Service}. |
| 9 | */ |
| 10 | export interface UpdateInstanceCustomHealthStatusRequest extends Omit< |
| 11 | SD.UpdateInstanceCustomHealthStatusRequest, |
| 12 | "ServiceId" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `servicediscovery:UpdateInstanceCustomHealthStatus` — |
| 17 | * pushes an instance's health status (`HEALTHY` / `UNHEALTHY`) for a |
| 18 | * service configured with `healthCheckCustomConfig`. This is the push-based |
| 19 | * health mechanism: the workload reports its own health instead of being |
| 20 | * probed by Route 53. Provide the implementation with |
| 21 | * `Effect.provide(AWS.CloudMap.UpdateInstanceCustomHealthStatusHttp)`. |
| 22 | * ### Instance Health |
| 23 | * **Example:** Report the Instance Healthy |
| 24 | * ```typescript |
| 25 | * const updateInstanceCustomHealthStatus = |
| 26 | * yield* AWS.CloudMap.UpdateInstanceCustomHealthStatus(service); |
| 27 | * |
| 28 | * yield* updateInstanceCustomHealthStatus({ |
| 29 | * InstanceId: "worker-1", |
| 30 | * Status: "HEALTHY", |
| 31 | * }); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface UpdateInstanceCustomHealthStatus extends Binding.Service< |
| 37 | UpdateInstanceCustomHealthStatus, |
| 38 | "AWS.CloudMap.UpdateInstanceCustomHealthStatus", |
| 39 | <S extends Service>( |
| 40 | service: S, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: UpdateInstanceCustomHealthStatusRequest, |
| 44 | ) => Effect.Effect< |
| 45 | SD.UpdateInstanceCustomHealthStatusResponse, |
| 46 | SD.UpdateInstanceCustomHealthStatusError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | export const UpdateInstanceCustomHealthStatus = |
| 51 | Binding.Service<UpdateInstanceCustomHealthStatus>( |
| 52 | "AWS.CloudMap.UpdateInstanceCustomHealthStatus", |
| 53 | ); |