| 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 GetInsightRequest extends xray.GetInsightRequest {} |
| 6 | |
| 7 | /** |
| 8 | * Retrieve the summary information of an X-Ray insight — the anomaly |
| 9 | * details X-Ray detected for a group with insights enabled. |
| 10 | * |
| 11 | * Bind the operation in the function's init phase to get a runtime callable; |
| 12 | * provide the implementation with `Effect.provide(XRay.GetInsightHttp)`. |
| 13 | * The action is account-scoped: X-Ray does not support resource-level |
| 14 | * permissions for `xray:GetInsight`, so the binding grants it on `*`. |
| 15 | * ### Insights |
| 16 | * **Example:** Fetch an insight by id |
| 17 | * ```typescript |
| 18 | * import * as XRay from "alchemy/AWS/XRay"; |
| 19 | * |
| 20 | * // init — grants xray:GetInsight |
| 21 | * const getInsight = yield* XRay.GetInsight(); |
| 22 | * |
| 23 | * // runtime |
| 24 | * const result = yield* getInsight({ InsightId: insightId }); |
| 25 | * const state = result.Insight?.State; |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface GetInsight extends Binding.Service< |
| 31 | GetInsight, |
| 32 | "AWS.XRay.GetInsight", |
| 33 | () => Effect.Effect< |
| 34 | ( |
| 35 | request: GetInsightRequest, |
| 36 | ) => Effect.Effect<xray.GetInsightResult, xray.GetInsightError> |
| 37 | > |
| 38 | > {} |
| 39 | export const GetInsight = Binding.Service<GetInsight>("AWS.XRay.GetInsight"); |