1import type * as xray from "@distilled.cloud/aws/xray";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5export interface GetServiceGraphRequest extends xray.GetServiceGraphRequest {}
6
7/**
8 * Retrieve the service graph for a time window — a document describing
9 * the services processing requests and the downstream services they call.
10 *
11 * Bind the operation in the function's init phase to get a runtime callable;
12 * provide the implementation with `Effect.provide(XRay.GetServiceGraphHttp)`.
13 * The action is account-scoped: X-Ray does not support resource-level
14 * permissions for `xray:GetServiceGraph`, so the binding grants it on `*`.
15 * ### Service Graphs & Statistics
16 * **Example:** Fetch the last 10 minutes of the service graph
17 * ```typescript
18 * import * as XRay from "alchemy/AWS/XRay";
19 *
20 * // init — grants xray:GetServiceGraph
21 * const getServiceGraph = yield* XRay.GetServiceGraph();
22 *
23 * // runtime
24 * const now = yield* Effect.sync(() => Date.now());
25 * const graph = yield* getServiceGraph({
26 * StartTime: new Date(now - 10 * 60 * 1000),
27 * EndTime: new Date(now),
28 * });
29 * const services = graph.Services ?? [];
30 * ```
31 *
32 * @binding
33 */
34export interface GetServiceGraph extends Binding.Service<
35 GetServiceGraph,
36 "AWS.XRay.GetServiceGraph",
37 () => Effect.Effect<
38 (
39 request: GetServiceGraphRequest,
40 ) => Effect.Effect<xray.GetServiceGraphResult, xray.GetServiceGraphError>
41 >
42> {}
43export const GetServiceGraph = Binding.Service<GetServiceGraph>(
44 "AWS.XRay.GetServiceGraph",
45);