The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Effect from "effect/Effect"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { makeAmpWorkspaceHttpBinding } from "./BindingHttp.ts"; |
| 4 | import { GetMetricMetadata, type GetMetricMetadataRequest } from "./GetMetricMetadata.ts"; |
| 5 | import type { PrometheusMetricMetadata } from "./PrometheusTypes.ts"; |
| 6 | |
| 7 | export const GetMetricMetadataHttp = Layer.effect( |
| 8 | GetMetricMetadata, |
| 9 | makeAmpWorkspaceHttpBinding({ |
| 10 | name: "GetMetricMetadata", |
| 11 | iamActions: ["aps:GetMetricMetadata"], |
| 12 | makeClient: (send) => (request: GetMetricMetadataRequest) => |
| 13 | send({ |
| 14 | method: "GET", |
| 15 | path: "api/v1/metadata", |
| 16 | query: { |
| 17 | metric: request.metric, |
| 18 | limit: request.limit !== undefined ? String(request.limit) : undefined, |
| 19 | }, |
| 20 | }).pipe(Effect.map((data) => data as Record<string, PrometheusMetricMetadata[]>)), |
| 21 | }), |
| 22 | ); |