/* * 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 { PrometheusResponseActiveTargetDiscoveredLabels, PrometheusResponseActiveTargetDiscoveredLabels$inboundSchema, } from "./prometheusresponseactivetargetdiscoveredlabels.js"; import { PrometheusResponseActiveTargetLabels, PrometheusResponseActiveTargetLabels$inboundSchema, } from "./prometheusresponseactivetargetlabels.js"; export type PrometheusResponseActiveTarget = { discoveredLabels?: PrometheusResponseActiveTargetDiscoveredLabels | undefined; /** * Whether target is up or down. */ health?: string | undefined; labels?: PrometheusResponseActiveTargetLabels | undefined; /** * Last error that occurred within target. */ lastError?: string | undefined; /** * Last time Prometheus scraped target. */ lastScrape?: string | undefined; /** * URL that Prometheus scraped. */ scrapeUrl?: string | undefined; }; /** @internal */ export const PrometheusResponseActiveTarget$inboundSchema: z.ZodType< PrometheusResponseActiveTarget, z.ZodTypeDef, unknown > = z.object({ discovered_labels: PrometheusResponseActiveTargetDiscoveredLabels$inboundSchema.optional(), health: z.string().optional(), labels: PrometheusResponseActiveTargetLabels$inboundSchema.optional(), last_error: z.string().optional(), last_scrape: z.string().optional(), scrape_url: z.string().optional(), }).transform((v) => { return remap$(v, { "discovered_labels": "discoveredLabels", "last_error": "lastError", "last_scrape": "lastScrape", "scrape_url": "scrapeUrl", }); }); export function prometheusResponseActiveTargetFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PrometheusResponseActiveTarget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PrometheusResponseActiveTarget' from JSON`, ); }