| 1 | import type * as fis from "@distilled.cloud/aws/fis"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { ExperimentTemplate } from "./ExperimentTemplate.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `fis:StartExperiment`. |
| 8 | * |
| 9 | * Starts a fault-injection experiment from the bound |
| 10 | * {@link ExperimentTemplate} — the template's id is injected and the |
| 11 | * idempotency `clientToken` is generated automatically. The IAM grant covers |
| 12 | * both the template and the `experiment/*` ARN the started experiment is |
| 13 | * created under. Provide the implementation with |
| 14 | * `Effect.provide(AWS.FIS.StartExperimentHttp)`. |
| 15 | * ### Running Experiments |
| 16 | * **Example:** Start an Experiment from the Bound Template |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the experiment template |
| 19 | * const startExperiment = yield* AWS.FIS.StartExperiment(template); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const { experiment } = yield* startExperiment(); |
| 23 | * console.log(experiment?.id, experiment?.state?.status); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface StartExperiment extends Binding.Service< |
| 29 | StartExperiment, |
| 30 | "AWS.FIS.StartExperiment", |
| 31 | ( |
| 32 | template: ExperimentTemplate, |
| 33 | ) => Effect.Effect< |
| 34 | ( |
| 35 | request?: Omit< |
| 36 | fis.StartExperimentRequest, |
| 37 | "experimentTemplateId" | "clientToken" |
| 38 | >, |
| 39 | ) => Effect.Effect<fis.StartExperimentResponse, fis.StartExperimentError> |
| 40 | > |
| 41 | > {} |
| 42 | export const StartExperiment = Binding.Service<StartExperiment>( |
| 43 | "AWS.FIS.StartExperiment", |
| 44 | ); |