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 GetSamplingTargetsRequest
6 extends xray.GetSamplingTargetsRequest {}
7
8/**
9 * Report sampling statistics and receive updated sampling quotas — the
10 * second half of the sampling protocol implemented by X-Ray SDK samplers.
11 *
12 * Bind the operation in the function's init phase to get a runtime callable;
13 * provide the implementation with `Effect.provide(XRay.GetSamplingTargetsHttp)`.
14 * The action is account-scoped: X-Ray does not support resource-level
15 * permissions for `xray:GetSamplingTargets`, so the binding grants it on `*`.
16 * ### Sampling
17 * **Example:** Refresh sampling quotas
18 * ```typescript
19 * import * as XRay from "alchemy/AWS/XRay";
20 *
21 * // init — grants xray:GetSamplingTargets
22 * const getSamplingTargets = yield* XRay.GetSamplingTargets();
23 *
24 * // runtime — report what this client sampled and receive new quotas
25 * const targets = yield* getSamplingTargets({
26 * SamplingStatisticsDocuments: [
27 * {
28 * RuleName: "my-rule",
29 * ClientID: "0123456789abcdef01234567",
30 * Timestamp: new Date(),
31 * RequestCount: 100,
32 * SampledCount: 5,
33 * },
34 * ],
35 * });
36 * const documents = targets.SamplingTargetDocuments ?? [];
37 * ```
38 *
39 * @binding
40 */
41export interface GetSamplingTargets extends Binding.Service<
42 GetSamplingTargets,
43 "AWS.XRay.GetSamplingTargets",
44 () => Effect.Effect<
45 (
46 request: GetSamplingTargetsRequest,
47 ) => Effect.Effect<
48 xray.GetSamplingTargetsResult,
49 xray.GetSamplingTargetsError
50 >
51 >
52> {}
53export const GetSamplingTargets = Binding.Service<GetSamplingTargets>(
54 "AWS.XRay.GetSamplingTargets",
55);