/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PrometheusResponseActiveTarget, PrometheusResponseActiveTarget$inboundSchema, } from "./prometheusresponseactivetarget.js"; import { PrometheusResponseDroppedTarget, PrometheusResponseDroppedTarget$inboundSchema, } from "./prometheusresponsedroppedtarget.js"; import { PrometheusResponsePrometheusVersion, PrometheusResponsePrometheusVersion$inboundSchema, } from "./prometheusresponseprometheusversion.js"; export type PrometheusResponse = { /** * List of active targets. */ activeTargets?: Array | null | undefined; /** * List of the versions of everything that Prometheus finds i.e., version of Prometheus, Go, Node, cAdvisor, etc. */ allVersions?: Array | null | undefined; /** * True when the config endpoint is exposed. */ configExposed?: boolean | undefined; /** * List of dropped targets. */ droppedTargets?: Array | null | undefined; /** * List of the versions of Go. */ goVersions?: Array | null | undefined; prometheusVersions?: | Array | null | undefined; }; /** @internal */ export const PrometheusResponse$inboundSchema: z.ZodType< PrometheusResponse, z.ZodTypeDef, unknown > = z.object({ active_targets: z.nullable( z.array(PrometheusResponseActiveTarget$inboundSchema), ).optional(), all_versions: z.nullable(z.array(z.string())).optional(), config_exposed: z.boolean().optional(), dropped_targets: z.nullable( z.array(PrometheusResponseDroppedTarget$inboundSchema), ).optional(), go_versions: z.nullable(z.array(z.string())).optional(), prometheus_versions: z.nullable( z.array(PrometheusResponsePrometheusVersion$inboundSchema), ).optional(), }).transform((v) => { return remap$(v, { "active_targets": "activeTargets", "all_versions": "allVersions", "config_exposed": "configExposed", "dropped_targets": "droppedTargets", "go_versions": "goVersions", "prometheus_versions": "prometheusVersions", }); }); export function prometheusResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PrometheusResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PrometheusResponse' from JSON`, ); }