/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 97c4203e8119 */ 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 { SDKValidationError } from "./errors/sdkvalidationerror.js"; /** * How to dispatch the command */ export const CreateCommandResponseDeploymentModel = { Push: "push", Pull: "pull", } as const; /** * How to dispatch the command */ export type CreateCommandResponseDeploymentModel = ClosedEnum< typeof CreateCommandResponseDeploymentModel >; /** * The kind of command-capable resource a command targets. */ export const CreateCommandResponseResourceType = { Worker: "worker", Container: "container", Daemon: "daemon", } as const; /** * The kind of command-capable resource a command targets. */ export type CreateCommandResponseResourceType = ClosedEnum< typeof CreateCommandResponseResourceType >; /** * Resource the command is addressed to */ export type CreateCommandResponseTarget = { /** * The resource ID within the deployment's stack (e.g. a Worker/Container/Daemon id). */ resourceId: string; /** * The kind of command-capable resource a command targets. */ resourceType: CreateCommandResponseResourceType; }; /** * How the command is delivered to its target */ export const CreateCommandResponseDeliveryMode = { Push: "push", Pull: "pull", } as const; /** * How the command is delivered to its target */ export type CreateCommandResponseDeliveryMode = ClosedEnum< typeof CreateCommandResponseDeliveryMode >; export type CreateCommandResponse = { /** * Unique identifier for the command. */ id: string; /** * Project ID (for manager to use in routing) */ projectId: string; /** * How to dispatch the command */ deploymentModel: CreateCommandResponseDeploymentModel; /** * Resource the command is addressed to */ target: CreateCommandResponseTarget; /** * How the command is delivered to its target */ deliveryMode: CreateCommandResponseDeliveryMode; /** * Whether an operation result contract was stored atomically with this command */ operationResultContractPersisted: boolean; }; /** @internal */ export const CreateCommandResponseDeploymentModel$inboundSchema: z.ZodEnum< typeof CreateCommandResponseDeploymentModel > = z.enum(CreateCommandResponseDeploymentModel); /** @internal */ export const CreateCommandResponseResourceType$inboundSchema: z.ZodEnum< typeof CreateCommandResponseResourceType > = z.enum(CreateCommandResponseResourceType); /** @internal */ export const CreateCommandResponseTarget$inboundSchema: z.ZodType< CreateCommandResponseTarget, unknown > = z.object({ resourceId: z.string(), resourceType: CreateCommandResponseResourceType$inboundSchema, }); export function createCommandResponseTargetFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateCommandResponseTarget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateCommandResponseTarget' from JSON`, ); } /** @internal */ export const CreateCommandResponseDeliveryMode$inboundSchema: z.ZodEnum< typeof CreateCommandResponseDeliveryMode > = z.enum(CreateCommandResponseDeliveryMode); /** @internal */ export const CreateCommandResponse$inboundSchema: z.ZodType< CreateCommandResponse, unknown > = z.object({ id: z.string(), projectId: z.string(), deploymentModel: CreateCommandResponseDeploymentModel$inboundSchema, target: z.lazy(() => CreateCommandResponseTarget$inboundSchema), deliveryMode: CreateCommandResponseDeliveryMode$inboundSchema, operationResultContractPersisted: z.boolean(), }); export function createCommandResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateCommandResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateCommandResponse' from JSON`, ); }