1import type * as amplify from "@distilled.cloud/aws/amplify";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { App } from "./App.ts";
5
6export interface GenerateAccessLogsRequest extends Omit<
7 amplify.GenerateAccessLogsRequest,
8 "appId"
9> {}
10
11/**
12 * Runtime binding for `amplify:GenerateAccessLogs`.
13 *
14 * Bind an {@link App} in the function's init phase to get a callable that
15 * generates a pre-signed URL to the app's access logs for a time range —
16 * e.g. an analytics function ingesting traffic data on a schedule. Provide the
17 * implementation with `Effect.provide(AWS.Amplify.GenerateAccessLogsHttp)`.
18 * ### Reading Access Logs
19 * **Example:** Pull the Last Day of Access Logs
20 * ```typescript
21 * // init — bind the operation to the app
22 * const generateAccessLogs = yield* AWS.Amplify.GenerateAccessLogs(app);
23 *
24 * // runtime — logUrl is a pre-signed CSV download
25 * const { logUrl } = yield* generateAccessLogs({
26 * domainName: "example.com",
27 * startTime: new Date(Date.now() - 24 * 60 * 60 * 1000),
28 * endTime: new Date(),
29 * });
30 * ```
31 *
32 * @binding
33 */
34export interface GenerateAccessLogs extends Binding.Service<
35 GenerateAccessLogs,
36 "AWS.Amplify.GenerateAccessLogs",
37 (
38 app: App,
39 ) => Effect.Effect<
40 (
41 request: GenerateAccessLogsRequest,
42 ) => Effect.Effect<
43 amplify.GenerateAccessLogsResult,
44 amplify.GenerateAccessLogsError
45 >
46 >
47> {}
48
49export const GenerateAccessLogs = Binding.Service<GenerateAccessLogs>(
50 "AWS.Amplify.GenerateAccessLogs",
51);