/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: eacf8105547c */ import * as z from "zod/v4"; import { safeParse } from "../lib/schemas.js"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { ComputePoolSelection, ComputePoolSelection$inboundSchema, } from "./computepoolselection.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; export const RequirementsArchitecture = { Arm64: "arm64", X8664: "x86_64", } as const; export type RequirementsArchitecture = ClosedEnum< typeof RequirementsArchitecture >; export type RequirementsGpu = { type: string; count: number; }; export type Requirements = { cpu: string; memoryBytes: number; ephemeralStorageBytes: number; architecture?: RequirementsArchitecture | null | undefined; gpu?: RequirementsGpu | null | undefined; }; export type Min = { min: number; max: number; default: number; }; export type Max = { min: number; max: number; default: number; }; export type ScaleAutoscale = { type: "autoscale"; min: Min; max: Max; }; export type Machines = { min: number; max: number; default: number; }; export type ScaleFixed = { type: "fixed"; machines: Machines; }; export type Scale = ScaleFixed | ScaleAutoscale; export const ProfileArchitecture = { Arm64: "arm64", X8664: "x86_64", } as const; export type ProfileArchitecture = ClosedEnum; export type ProfileGpu = { type: string; count: number; }; export type DeploymentComputePlanProfile = { cpu: string; memoryBytes: number; ephemeralStorageBytes: number; architecture?: ProfileArchitecture | null | undefined; gpu?: ProfileGpu | null | undefined; }; export type DeploymentComputePlanMachine = { machine: string; profile: DeploymentComputePlanProfile; recommended: boolean; }; export type Pool = { poolId: string; workloads: Array; requirements: Requirements; scale: ScaleFixed | ScaleAutoscale; /** * User-selected deployment settings for one compute pool. */ selected: ComputePoolSelection; /** * User-selected deployment settings for one compute pool. */ recommended: ComputePoolSelection; machines: Array; errors?: Array | undefined; }; export type DeploymentComputePlan = { pools: Array; }; /** @internal */ export const RequirementsArchitecture$inboundSchema: z.ZodEnum< typeof RequirementsArchitecture > = z.enum(RequirementsArchitecture); /** @internal */ export const RequirementsGpu$inboundSchema: z.ZodType< RequirementsGpu, unknown > = z.object({ type: z.string(), count: z.int(), }); export function requirementsGpuFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RequirementsGpu$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RequirementsGpu' from JSON`, ); } /** @internal */ export const Requirements$inboundSchema: z.ZodType = z .object({ cpu: z.string(), memoryBytes: z.int(), ephemeralStorageBytes: z.int(), architecture: z.nullable(RequirementsArchitecture$inboundSchema).optional(), gpu: z.nullable(z.lazy(() => RequirementsGpu$inboundSchema)).optional(), }); export function requirementsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Requirements$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Requirements' from JSON`, ); } /** @internal */ export const Min$inboundSchema: z.ZodType = z.object({ min: z.int(), max: z.int(), default: z.int(), }); export function minFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Min$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Min' from JSON`, ); } /** @internal */ export const Max$inboundSchema: z.ZodType = z.object({ min: z.int(), max: z.int(), default: z.int(), }); export function maxFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Max$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Max' from JSON`, ); } /** @internal */ export const ScaleAutoscale$inboundSchema: z.ZodType = z.object({ type: z.literal("autoscale"), min: z.lazy(() => Min$inboundSchema), max: z.lazy(() => Max$inboundSchema), }); export function scaleAutoscaleFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ScaleAutoscale$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ScaleAutoscale' from JSON`, ); } /** @internal */ export const Machines$inboundSchema: z.ZodType = z.object({ min: z.int(), max: z.int(), default: z.int(), }); export function machinesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Machines$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Machines' from JSON`, ); } /** @internal */ export const ScaleFixed$inboundSchema: z.ZodType = z .object({ type: z.literal("fixed"), machines: z.lazy(() => Machines$inboundSchema), }); export function scaleFixedFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ScaleFixed$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ScaleFixed' from JSON`, ); } /** @internal */ export const Scale$inboundSchema: z.ZodType = z.union([ z.lazy(() => ScaleFixed$inboundSchema), z.lazy(() => ScaleAutoscale$inboundSchema), ]); export function scaleFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Scale$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Scale' from JSON`, ); } /** @internal */ export const ProfileArchitecture$inboundSchema: z.ZodEnum< typeof ProfileArchitecture > = z.enum(ProfileArchitecture); /** @internal */ export const ProfileGpu$inboundSchema: z.ZodType = z .object({ type: z.string(), count: z.int(), }); export function profileGpuFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ProfileGpu$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProfileGpu' from JSON`, ); } /** @internal */ export const DeploymentComputePlanProfile$inboundSchema: z.ZodType< DeploymentComputePlanProfile, unknown > = z.object({ cpu: z.string(), memoryBytes: z.int(), ephemeralStorageBytes: z.int(), architecture: z.nullable(ProfileArchitecture$inboundSchema).optional(), gpu: z.nullable(z.lazy(() => ProfileGpu$inboundSchema)).optional(), }); export function deploymentComputePlanProfileFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DeploymentComputePlanProfile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeploymentComputePlanProfile' from JSON`, ); } /** @internal */ export const DeploymentComputePlanMachine$inboundSchema: z.ZodType< DeploymentComputePlanMachine, unknown > = z.object({ machine: z.string(), profile: z.lazy(() => DeploymentComputePlanProfile$inboundSchema), recommended: z.boolean(), }); export function deploymentComputePlanMachineFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DeploymentComputePlanMachine$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeploymentComputePlanMachine' from JSON`, ); } /** @internal */ export const Pool$inboundSchema: z.ZodType = z.object({ poolId: z.string(), workloads: z.array(z.string()), requirements: z.lazy(() => Requirements$inboundSchema), scale: z.union([ z.lazy(() => ScaleFixed$inboundSchema), z.lazy(() => ScaleAutoscale$inboundSchema), ]), selected: ComputePoolSelection$inboundSchema, recommended: ComputePoolSelection$inboundSchema, machines: z.array(z.lazy(() => DeploymentComputePlanMachine$inboundSchema)), errors: z.array(z.string()).optional(), }); export function poolFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Pool$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Pool' from JSON`, ); } /** @internal */ export const DeploymentComputePlan$inboundSchema: z.ZodType< DeploymentComputePlan, unknown > = z.object({ pools: z.array(z.lazy(() => Pool$inboundSchema)), }); export function deploymentComputePlanFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DeploymentComputePlan$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeploymentComputePlan' from JSON`, ); }