sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ InternetMonitor/ GetQueryResults.ts

import * as im from "@distilled.cloud/aws/internetmonitor";
import * as Binding from "alchemy/Binding";
import * as Effect from "effect/Effect";
import type { Monitor } from "./Monitor.ts";

export interface GetQueryResultsRequest extends Omit<im.GetQueryResultsInput, "MonitorName"> {}

/**
 * Runtime binding for `internetmonitor:GetQueryResults` — fetch the result
 * rows of a `SUCCEEDED` query on the bound {@link Monitor}; the monitor name
 * is injected automatically.
 *
 * Provide `InternetMonitor.GetQueryResultsHttp` on the hosting Lambda
 * Function to satisfy the requirement.
 * ### Querying Measurements
 * **Example:** Read Query Results
 * ```typescript
 * // init — grants internetmonitor:GetQueryResults on the monitor
 * const getQueryResults = yield* AWS.InternetMonitor.GetQueryResults(monitor);
 *
 * // runtime
 * const { Fields, Data } = yield* getQueryResults({ QueryId: queryId });
 * ```
 *
 * @binding
 */
export interface GetQueryResults extends Binding.Service<
  GetQueryResults,
  "AWS.InternetMonitor.GetQueryResults",
  (
    monitor: Monitor,
  ) => Effect.Effect<
    (
      request: GetQueryResultsRequest,
    ) => Effect.Effect<im.GetQueryResultsOutput, im.GetQueryResultsError>
  >
> {}

export const GetQueryResults = Binding.Service<GetQueryResults>(
  "AWS.InternetMonitor.GetQueryResults",
);