/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type PutComputeTenantRequest = { orgId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; computeTenantUpdate: components.ComputeTenantUpdate; }; export type PutComputeTenantResponse = | components.ComputeTenant | components.ComputeErrorEnvelope; /** @internal */ export const PutComputeTenantRequest$inboundSchema: z.ZodType< PutComputeTenantRequest, z.ZodTypeDef, unknown > = z.object({ org_id: z.string(), "X-On-Behalf-Of": z.string().optional(), ComputeTenantUpdate: components.ComputeTenantUpdate$inboundSchema, }).transform((v) => { return remap$(v, { "org_id": "orgId", "X-On-Behalf-Of": "xOnBehalfOf", "ComputeTenantUpdate": "computeTenantUpdate", }); }); /** @internal */ export type PutComputeTenantRequest$Outbound = { org_id: string; "X-On-Behalf-Of"?: string | undefined; ComputeTenantUpdate: components.ComputeTenantUpdate$Outbound; }; /** @internal */ export const PutComputeTenantRequest$outboundSchema: z.ZodType< PutComputeTenantRequest$Outbound, z.ZodTypeDef, PutComputeTenantRequest > = z.object({ orgId: z.string(), xOnBehalfOf: z.string().optional(), computeTenantUpdate: components.ComputeTenantUpdate$outboundSchema, }).transform((v) => { return remap$(v, { orgId: "org_id", xOnBehalfOf: "X-On-Behalf-Of", computeTenantUpdate: "ComputeTenantUpdate", }); }); export function putComputeTenantRequestToJSON( putComputeTenantRequest: PutComputeTenantRequest, ): string { return JSON.stringify( PutComputeTenantRequest$outboundSchema.parse(putComputeTenantRequest), ); } export function putComputeTenantRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutComputeTenantRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutComputeTenantRequest' from JSON`, ); } /** @internal */ export const PutComputeTenantResponse$inboundSchema: z.ZodType< PutComputeTenantResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeTenant$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type PutComputeTenantResponse$Outbound = | components.ComputeTenant$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const PutComputeTenantResponse$outboundSchema: z.ZodType< PutComputeTenantResponse$Outbound, z.ZodTypeDef, PutComputeTenantResponse > = z.union([ components.ComputeTenant$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function putComputeTenantResponseToJSON( putComputeTenantResponse: PutComputeTenantResponse, ): string { return JSON.stringify( PutComputeTenantResponse$outboundSchema.parse(putComputeTenantResponse), ); } export function putComputeTenantResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutComputeTenantResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutComputeTenantResponse' from JSON`, ); }