| 1 | import type * as xray from "@distilled.cloud/aws/xray"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | export interface StartTraceRetrievalRequest |
| 6 | extends xray.StartTraceRetrievalRequest {} |
| 7 | |
| 8 | /** |
| 9 | * Initiate a Transaction Search trace retrieval for the given trace IDs |
| 10 | * and time range, returning a `RetrievalToken` for `ListRetrievedTraces` |
| 11 | * and `GetRetrievedTracesGraph`. |
| 12 | * |
| 13 | * Bind the operation in the function's init phase to get a runtime callable; |
| 14 | * provide the implementation with `Effect.provide(XRay.StartTraceRetrievalHttp)`. |
| 15 | * The action is account-scoped: X-Ray does not support resource-level |
| 16 | * permissions for `xray:StartTraceRetrieval`, so the binding grants it on `*`. |
| 17 | * ### Transaction Search |
| 18 | * **Example:** Start retrieving traces from Transaction Search |
| 19 | * ```typescript |
| 20 | * import * as XRay from "alchemy/AWS/XRay"; |
| 21 | * |
| 22 | * // init — grants xray:StartTraceRetrieval |
| 23 | * const startTraceRetrieval = yield* XRay.StartTraceRetrieval(); |
| 24 | * |
| 25 | * // runtime |
| 26 | * const now = yield* Effect.sync(() => Date.now()); |
| 27 | * const retrieval = yield* startTraceRetrieval({ |
| 28 | * TraceIds: ["1-63a2090f-3f4da4bcd9b1a3e07531423b"], |
| 29 | * StartTime: new Date(now - 60 * 60 * 1000), |
| 30 | * EndTime: new Date(now), |
| 31 | * }); |
| 32 | * const token = retrieval.RetrievalToken; |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | */ |
| 37 | export interface StartTraceRetrieval extends Binding.Service< |
| 38 | StartTraceRetrieval, |
| 39 | "AWS.XRay.StartTraceRetrieval", |
| 40 | () => Effect.Effect< |
| 41 | ( |
| 42 | request: StartTraceRetrievalRequest, |
| 43 | ) => Effect.Effect< |
| 44 | xray.StartTraceRetrievalResult, |
| 45 | xray.StartTraceRetrievalError |
| 46 | > |
| 47 | > |
| 48 | > {} |
| 49 | export const StartTraceRetrieval = Binding.Service<StartTraceRetrieval>( |
| 50 | "AWS.XRay.StartTraceRetrieval", |
| 51 | ); |