| 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 DescribeLogStreamsRequest extends Omit< |
| 7 | Logs.DescribeLogStreamsRequest, |
| 8 | "logGroupName" | "logGroupIdentifier" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `logs:DescribeLogStreams`. |
| 13 | * |
| 14 | * Bind this operation to a `LogGroup` inside a function runtime to list the |
| 15 | * streams of the group (e.g. to discover the most recently written stream |
| 16 | * before reading with `GetLogEvents`), automatically injecting the log group |
| 17 | * name. |
| 18 | * ### Reading Logs |
| 19 | * **Example:** Find the Most Recent Stream |
| 20 | * ```typescript |
| 21 | * const describeLogStreams = yield* AWS.Logs.DescribeLogStreams(logGroup); |
| 22 | * |
| 23 | * const { logStreams } = yield* describeLogStreams({ |
| 24 | * orderBy: "LastEventTime", |
| 25 | * descending: true, |
| 26 | * limit: 1, |
| 27 | * }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface DescribeLogStreams extends Binding.Service< |
| 33 | DescribeLogStreams, |
| 34 | "AWS.Logs.DescribeLogStreams", |
| 35 | <G extends LogGroup>( |
| 36 | logGroup: G, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request?: DescribeLogStreamsRequest, |
| 40 | ) => Effect.Effect< |
| 41 | Logs.DescribeLogStreamsResponse, |
| 42 | Logs.DescribeLogStreamsError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const DescribeLogStreams = Binding.Service<DescribeLogStreams>( |
| 47 | "AWS.Logs.DescribeLogStreams", |
| 48 | ); |