| 1 | import type * as TSQ from "@distilled.cloud/aws/timestream-query"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { ScheduledQuery } from "./ScheduledQuery.ts"; |
| 5 | |
| 6 | export interface ExecuteScheduledQueryRequest extends Omit< |
| 7 | TSQ.ExecuteScheduledQueryRequest, |
| 8 | "ScheduledQueryArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `timestream-query:ExecuteScheduledQuery` — manually |
| 13 | * run a {@link ScheduledQuery} for a given invocation time (e.g. to backfill |
| 14 | * a window the schedule missed). |
| 15 | * |
| 16 | * Bind the operation to the scheduled query to get a callable with |
| 17 | * `ScheduledQueryArn` injected automatically. |
| 18 | * |
| 19 | * Provide `Timestream.ExecuteScheduledQueryHttp` on the Function to |
| 20 | * implement the binding. |
| 21 | * |
| 22 | * ### Creating Scheduled Queries |
| 23 | * **Example:** Backfill a missed window |
| 24 | * ```typescript |
| 25 | * // init — bind the operation to the scheduled query |
| 26 | * const executeScheduledQuery = yield* Timestream.ExecuteScheduledQuery(rollup); |
| 27 | * |
| 28 | * // runtime — re-run the rollup as-of one hour ago |
| 29 | * yield* executeScheduledQuery({ |
| 30 | * InvocationTime: new Date(Date.now() - 60 * 60 * 1000), |
| 31 | * }); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface ExecuteScheduledQuery extends Binding.Service< |
| 37 | ExecuteScheduledQuery, |
| 38 | "AWS.Timestream.ExecuteScheduledQuery", |
| 39 | ( |
| 40 | scheduledQuery: ScheduledQuery, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: ExecuteScheduledQueryRequest, |
| 44 | ) => Effect.Effect< |
| 45 | TSQ.ExecuteScheduledQueryResponse, |
| 46 | TSQ.ExecuteScheduledQueryError | TSQ.DescribeEndpointsError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | |
| 51 | export const ExecuteScheduledQuery = Binding.Service<ExecuteScheduledQuery>( |
| 52 | "AWS.Timestream.ExecuteScheduledQuery", |
| 53 | ); |