| 1 | import * as xray from "@distilled.cloud/aws/xray"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { makeXRayHttpBinding } from "./BindingHttp.ts"; |
| 4 | import { GetTraceSummaries } from "./GetTraceSummaries.ts"; |
| 5 | |
| 6 | /** |
| 7 | * HTTP implementation of the `XRay.GetTraceSummaries` binding. |
| 8 | * |
| 9 | * At deploy time it grants `xray:GetTraceSummaries` on `*` to the host Lambda |
| 10 | * Function (the action does not support resource-level permissions); at |
| 11 | * runtime it calls the X-Ray API with the function's execution role |
| 12 | * credentials. |
| 13 | * |
| 14 | * @example Provide on the Function effect |
| 15 | * ```typescript |
| 16 | * import * as XRay from "alchemy/AWS/XRay"; |
| 17 | * |
| 18 | * Effect.gen(function* () { |
| 19 | * const getTraceSummaries = yield* XRay.GetTraceSummaries(); |
| 20 | * // ... |
| 21 | * }).pipe(Effect.provide(XRay.GetTraceSummariesHttp)); |
| 22 | * ``` |
| 23 | */ |
| 24 | export const GetTraceSummariesHttp = Layer.effect( |
| 25 | GetTraceSummaries, |
| 26 | makeXRayHttpBinding({ |
| 27 | tag: "AWS.XRay.GetTraceSummaries", |
| 28 | operation: xray.getTraceSummaries, |
| 29 | actions: ["xray:GetTraceSummaries"], |
| 30 | }), |
| 31 | ); |