| 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 GetLogRecordRequest extends Logs.GetLogRecordRequest {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `logs:GetLogRecord` (CloudWatch Logs Insights). |
| 10 | * |
| 11 | * Bind this operation to the `LogGroup` an Insights query ran against to |
| 12 | * fetch the complete log record behind a query-result row: every row returned |
| 13 | * by {@link import("./GetQueryResults.ts").GetQueryResults} carries a `@ptr` |
| 14 | * field that identifies the record. |
| 15 | * ### Logs Insights |
| 16 | * **Example:** Fetch the Full Record Behind a Query Result |
| 17 | * ```typescript |
| 18 | * const getLogRecord = yield* AWS.Logs.GetLogRecord(logGroup); |
| 19 | * |
| 20 | * const ptr = row.find((field) => field.field === "@ptr")?.value; |
| 21 | * const { logRecord } = yield* getLogRecord({ logRecordPointer: ptr! }); |
| 22 | * // logRecord["@message"] is the full unparsed log line |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface GetLogRecord extends Binding.Service< |
| 28 | GetLogRecord, |
| 29 | "AWS.Logs.GetLogRecord", |
| 30 | <G extends LogGroup>( |
| 31 | logGroup: G, |
| 32 | ) => Effect.Effect< |
| 33 | ( |
| 34 | request: GetLogRecordRequest, |
| 35 | ) => Effect.Effect<Logs.GetLogRecordResponse, Logs.GetLogRecordError> |
| 36 | > |
| 37 | > {} |
| 38 | export const GetLogRecord = Binding.Service<GetLogRecord>( |
| 39 | "AWS.Logs.GetLogRecord", |
| 40 | ); |