| 1 | import type * as Logs from "@distilled.cloud/aws/cloudwatch-logs"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { LogGroup } from "./LogGroup.ts"; |
| 5 | |
| 6 | export interface StopQueryRequest extends Logs.StopQueryRequest {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `logs:StopQuery` (CloudWatch Logs Insights). |
| 10 | * |
| 11 | * Bind this operation to the `LogGroup` an Insights query was started against |
| 12 | * (via {@link import("./StartQuery.ts").StartQuery}) to cancel it while it is |
| 13 | * still `Scheduled` or `Running` — e.g. on caller timeout or shutdown. |
| 14 | * ### Logs Insights |
| 15 | * **Example:** Cancel a Running Query |
| 16 | * ```typescript |
| 17 | * const startQuery = yield* AWS.Logs.StartQuery(logGroup); |
| 18 | * const stopQuery = yield* AWS.Logs.StopQuery(logGroup); |
| 19 | * |
| 20 | * const { queryId } = yield* startQuery({ queryString, startTime, endTime }); |
| 21 | * const { success } = yield* stopQuery({ queryId: queryId! }); |
| 22 | * ``` |
| 23 | * |
| 24 | * @binding |
| 25 | */ |
| 26 | export interface StopQuery extends Binding.Service< |
| 27 | StopQuery, |
| 28 | "AWS.Logs.StopQuery", |
| 29 | <G extends LogGroup>( |
| 30 | logGroup: G, |
| 31 | ) => Effect.Effect< |
| 32 | ( |
| 33 | request: StopQueryRequest, |
| 34 | ) => Effect.Effect<Logs.StopQueryResponse, Logs.StopQueryError> |
| 35 | > |
| 36 | > {} |
| 37 | export const StopQuery = Binding.Service<StopQuery>("AWS.Logs.StopQuery"); |