/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The name of the metric. * * @remarks * Allowed values: * `concurrent-requests`: Tracks the number of concurrent requests that a single Process handles. */ export const MetricName = { ConcurrentRequests: "concurrent-requests", } as const; /** * The name of the metric. * * @remarks * Allowed values: * `concurrent-requests`: Tracks the number of concurrent requests that a single Process handles. */ export type MetricName = OpenEnum; export type AutoscalerTargetMetric = { metricValue: number; /** * The name of the metric. * * @remarks * Allowed values: * `concurrent-requests`: Tracks the number of concurrent requests that a single Process handles. */ metricName: MetricName; }; /** @internal */ export const MetricName$inboundSchema: z.ZodType< MetricName, z.ZodTypeDef, unknown > = openEnums.inboundSchema(MetricName); /** @internal */ export const MetricName$outboundSchema: z.ZodType< string, z.ZodTypeDef, MetricName > = openEnums.outboundSchema(MetricName); /** @internal */ export const AutoscalerTargetMetric$inboundSchema: z.ZodType< AutoscalerTargetMetric, z.ZodTypeDef, unknown > = z.object({ metricValue: z.number(), metricName: MetricName$inboundSchema, }); /** @internal */ export type AutoscalerTargetMetric$Outbound = { metricValue: number; metricName: string; }; /** @internal */ export const AutoscalerTargetMetric$outboundSchema: z.ZodType< AutoscalerTargetMetric$Outbound, z.ZodTypeDef, AutoscalerTargetMetric > = z.object({ metricValue: z.number(), metricName: MetricName$outboundSchema, }); export function autoscalerTargetMetricToJSON( autoscalerTargetMetric: AutoscalerTargetMetric, ): string { return JSON.stringify( AutoscalerTargetMetric$outboundSchema.parse(autoscalerTargetMetric), ); } export function autoscalerTargetMetricFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AutoscalerTargetMetric$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AutoscalerTargetMetric' from JSON`, ); }