sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ XRay/ GetTraceSegmentDestination.ts

import type * as xray from "@distilled.cloud/aws/xray";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";

export interface GetTraceSegmentDestinationRequest extends xray.GetTraceSegmentDestinationRequest {}

/**
 * Retrieve the current destination (X-Ray or CloudWatch Logs) of data
 * sent to `PutTraceSegments` and the OTLP endpoint. Transaction Search
 * trace retrieval requires a CloudWatch Logs destination.
 *
 * Bind the operation in the function's init phase to get a runtime callable;
 * provide the implementation with `Effect.provide(XRay.GetTraceSegmentDestinationHttp)`.
 * The action is account-scoped: X-Ray does not support resource-level
 * permissions for `xray:GetTraceSegmentDestination`, so the binding grants it on `*`.
 * ### Transaction Search
 * **Example:** Check the trace segment destination
 * ```typescript
 * import * as XRay from "@alchemy.run/aws/XRay";
 *
 * // init — grants xray:GetTraceSegmentDestination
 * const getTraceSegmentDestination =
 *   yield* XRay.GetTraceSegmentDestination();
 *
 * // runtime
 * const destination = yield* getTraceSegmentDestination();
 * const isTransactionSearch = destination.Destination === "CloudWatchLogs";
 * ```
 *
 * @binding
 */
export interface GetTraceSegmentDestination extends Binding.Service<
  GetTraceSegmentDestination,
  "AWS.XRay.GetTraceSegmentDestination",
  () => Effect.Effect<
    (
      request?: GetTraceSegmentDestinationRequest,
    ) => Effect.Effect<xray.GetTraceSegmentDestinationResult, xray.GetTraceSegmentDestinationError>
  >
> {}
export const GetTraceSegmentDestination = Binding.Service<GetTraceSegmentDestination>(
  "AWS.XRay.GetTraceSegmentDestination",
);