| 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 GetInsightImpactGraphRequest |
| 6 | extends xray.GetInsightImpactGraphRequest {} |
| 7 | |
| 8 | /** |
| 9 | * Retrieve a structural service graph filtered by insight — which |
| 10 | * services the insight's anomaly impacted over a time window. |
| 11 | * |
| 12 | * Bind the operation in the function's init phase to get a runtime callable; |
| 13 | * provide the implementation with `Effect.provide(XRay.GetInsightImpactGraphHttp)`. |
| 14 | * The action is account-scoped: X-Ray does not support resource-level |
| 15 | * permissions for `xray:GetInsightImpactGraph`, so the binding grants it on `*`. |
| 16 | * ### Insights |
| 17 | * **Example:** Graph the services an insight impacted |
| 18 | * ```typescript |
| 19 | * import * as XRay from "alchemy/AWS/XRay"; |
| 20 | * |
| 21 | * // init — grants xray:GetInsightImpactGraph |
| 22 | * const getInsightImpactGraph = yield* XRay.GetInsightImpactGraph(); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const now = yield* Effect.sync(() => Date.now()); |
| 26 | * const graph = yield* getInsightImpactGraph({ |
| 27 | * InsightId: insightId, |
| 28 | * StartTime: new Date(now - 60 * 60 * 1000), |
| 29 | * EndTime: new Date(now), |
| 30 | * }); |
| 31 | * const services = graph.Services ?? []; |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GetInsightImpactGraph extends Binding.Service< |
| 37 | GetInsightImpactGraph, |
| 38 | "AWS.XRay.GetInsightImpactGraph", |
| 39 | () => Effect.Effect< |
| 40 | ( |
| 41 | request: GetInsightImpactGraphRequest, |
| 42 | ) => Effect.Effect< |
| 43 | xray.GetInsightImpactGraphResult, |
| 44 | xray.GetInsightImpactGraphError |
| 45 | > |
| 46 | > |
| 47 | > {} |
| 48 | export const GetInsightImpactGraph = Binding.Service<GetInsightImpactGraph>( |
| 49 | "AWS.XRay.GetInsightImpactGraph", |
| 50 | ); |