| 1 | import * as im from "@distilled.cloud/aws/internetmonitor"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Monitor } from "./Monitor.ts"; |
| 5 | |
| 6 | export interface StartQueryRequest extends Omit< |
| 7 | im.StartQueryInput, |
| 8 | "MonitorName" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `internetmonitor:StartQuery` — start a query against |
| 13 | * the bound {@link Monitor}'s measurement data with the Internet Monitor |
| 14 | * query interface; the monitor name is injected automatically. |
| 15 | * |
| 16 | * Provide `InternetMonitor.StartQueryHttp` on the hosting Lambda Function to |
| 17 | * satisfy the requirement. |
| 18 | * ### Querying Measurements |
| 19 | * **Example:** Start a Measurements Query |
| 20 | * ```typescript |
| 21 | * // init — grants internetmonitor:StartQuery on the monitor |
| 22 | * const startQuery = yield* AWS.InternetMonitor.StartQuery(monitor); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const { QueryId } = yield* startQuery({ |
| 26 | * StartTime: new Date(Date.now() - 3_600_000), |
| 27 | * EndTime: new Date(), |
| 28 | * QueryType: "MEASUREMENTS", |
| 29 | * }); |
| 30 | * ``` |
| 31 | * |
| 32 | * @binding |
| 33 | */ |
| 34 | export interface StartQuery extends Binding.Service< |
| 35 | StartQuery, |
| 36 | "AWS.InternetMonitor.StartQuery", |
| 37 | ( |
| 38 | monitor: Monitor, |
| 39 | ) => Effect.Effect< |
| 40 | ( |
| 41 | request: StartQueryRequest, |
| 42 | ) => Effect.Effect<im.StartQueryOutput, im.StartQueryError> |
| 43 | > |
| 44 | > {} |
| 45 | |
| 46 | export const StartQuery = Binding.Service<StartQuery>( |
| 47 | "AWS.InternetMonitor.StartQuery", |
| 48 | ); |