/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: e6c95beee2fe */ 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 { DeploymentGroupInfo, DeploymentGroupInfo$inboundSchema, } from "./deploymentgroupinfo.js"; import { DeploymentProjectInfo, DeploymentProjectInfo$inboundSchema, } from "./deploymentprojectinfo.js"; import { DeploymentPurpose, DeploymentPurpose$inboundSchema, } from "./deploymentpurpose.js"; import { DeploymentReleaseInfo, DeploymentReleaseInfo$inboundSchema, } from "./deploymentreleaseinfo.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { OperatorCapabilityReport, OperatorCapabilityReport$inboundSchema, } from "./operatorcapabilityreport.js"; /** * Deployment status in the deployment lifecycle. * * @remarks * * For observe-only deployments with no release or stack state, `Running` * means the Operator is attached. Connectivity comes from `lastHeartbeatAt`; * resource health comes from inventory and resource heartbeat data. */ export const DeploymentListItemResponseStatus = { Pending: "pending", PreflightsFailed: "preflights-failed", InitialSetup: "initial-setup", InitialSetupFailed: "initial-setup-failed", Provisioning: "provisioning", WaitingForMachines: "waiting-for-machines", ProvisioningFailed: "provisioning-failed", Running: "running", RefreshFailed: "refresh-failed", UpdatePending: "update-pending", Updating: "updating", UpdateFailed: "update-failed", DeletePending: "delete-pending", Deleting: "deleting", DeleteFailed: "delete-failed", TeardownRequired: "teardown-required", TeardownFailed: "teardown-failed", Deleted: "deleted", Error: "error", } as const; /** * Deployment status in the deployment lifecycle. * * @remarks * * For observe-only deployments with no release or stack state, `Running` * means the Operator is attached. Connectivity comes from `lastHeartbeatAt`; * resource health comes from inventory and resource heartbeat data. */ export type DeploymentListItemResponseStatus = ClosedEnum< typeof DeploymentListItemResponseStatus >; /** * Target platform for the deployment */ export const DeploymentListItemResponsePlatform = { Aws: "aws", Gcp: "gcp", Azure: "azure", Kubernetes: "kubernetes", Machines: "machines", Local: "local", Test: "test", } as const; /** * Target platform for the deployment */ export type DeploymentListItemResponsePlatform = ClosedEnum< typeof DeploymentListItemResponsePlatform >; export const DeploymentListItemResponsePlatformTest = { Test: "test", } as const; export type DeploymentListItemResponsePlatformTest = ClosedEnum< typeof DeploymentListItemResponsePlatformTest >; /** * Test platform environment information (mock) */ export type DeploymentListItemResponseEnvironmentInfoTest = { /** * Test identifier for this environment */ testId: string; platform: DeploymentListItemResponsePlatformTest; }; export const DeploymentListItemResponsePlatformLocal = { Local: "local", } as const; export type DeploymentListItemResponsePlatformLocal = ClosedEnum< typeof DeploymentListItemResponsePlatformLocal >; /** * Local platform environment information */ export type DeploymentListItemResponseEnvironmentInfoLocal = { /** * Architecture (e.g., "x86_64", "aarch64") */ arch: string; /** * Hostname of the machine running the deployment */ hostname: string; /** * Operating system (e.g., "linux", "macos", "windows") */ os: string; platform: DeploymentListItemResponsePlatformLocal; }; export const DeploymentListItemResponsePlatformAzure = { Azure: "azure", } as const; export type DeploymentListItemResponsePlatformAzure = ClosedEnum< typeof DeploymentListItemResponsePlatformAzure >; /** * Azure-specific environment information */ export type DeploymentListItemResponseEnvironmentInfoAzure = { /** * Azure location/region */ location: string; /** * Azure subscription ID */ subscriptionId: string; /** * Azure tenant ID */ tenantId: string; platform: DeploymentListItemResponsePlatformAzure; }; export const DeploymentListItemResponsePlatformGcp = { Gcp: "gcp", } as const; export type DeploymentListItemResponsePlatformGcp = ClosedEnum< typeof DeploymentListItemResponsePlatformGcp >; /** * GCP-specific environment information */ export type DeploymentListItemResponseEnvironmentInfoGcp = { /** * GCP project ID (e.g., "my-project") */ projectId: string; /** * GCP project number (e.g., "123456789012") */ projectNumber: string; /** * GCP region */ region: string; platform: DeploymentListItemResponsePlatformGcp; }; export const DeploymentListItemResponsePlatformAws = { Aws: "aws", } as const; export type DeploymentListItemResponsePlatformAws = ClosedEnum< typeof DeploymentListItemResponsePlatformAws >; /** * AWS-specific environment information */ export type DeploymentListItemResponseEnvironmentInfoAws = { /** * AWS account ID */ accountId: string; /** * AWS region */ region: string; platform: DeploymentListItemResponsePlatformAws; }; /** * Cloud environment information */ export type DeploymentListItemResponseEnvironmentInfoUnion = | DeploymentListItemResponseEnvironmentInfoGcp | DeploymentListItemResponseEnvironmentInfoAzure | DeploymentListItemResponseEnvironmentInfoLocal | DeploymentListItemResponseEnvironmentInfoAws | DeploymentListItemResponseEnvironmentInfoTest | any; /** * Setup source that imported this deployment */ export const DeploymentListItemResponseImportSource = { Cloudformation: "cloudformation", Terraform: "terraform", Helm: "helm", } as const; /** * Setup source that imported this deployment */ export type DeploymentListItemResponseImportSource = ClosedEnum< typeof DeploymentListItemResponseImportSource >; /** * Setup method that created the deployment record. */ export const DeploymentListItemResponseSetupMethod = { Cloudformation: "cloudformation", GoogleOauth: "google-oauth", Terraform: "terraform", Helm: "helm", Cli: "cli", Manual: "manual", } as const; /** * Setup method that created the deployment record. */ export type DeploymentListItemResponseSetupMethod = ClosedEnum< typeof DeploymentListItemResponseSetupMethod >; /** * Latest error information if in a failed state */ export type DeploymentListItemResponseError = { /** * A unique identifier for the type of error. * * @remarks * * This should be a short, machine-readable string that can be used * by clients to programmatically handle different error types. * Examples: "NOT_FOUND", "VALIDATION_ERROR", "TIMEOUT" */ code: string; /** * Additional diagnostic information about the error context. * * @remarks * * This optional field can contain structured data providing more details * about the error, such as validation errors, request parameters that * caused the issue, or other relevant context information. */ context?: any | null | undefined; /** * Optional human-facing remediation hint. */ hint?: string | null | undefined; /** * HTTP status code for this error. * * @remarks * * Used when converting the error to an HTTP response. If None, falls back to * the error type's default status code or 500. */ httpStatusCode?: number | null | undefined; /** * Indicates if this is an internal error that should not be exposed to users. * * @remarks * * When `true`, this error contains sensitive information or implementation * details that should not be shown to end-users. Such errors should be * logged for debugging but replaced with generic error messages in responses. */ internal: boolean; /** * Human-readable error message. * * @remarks * * This message should be clear and actionable for developers or end-users, * providing context about what went wrong and potentially how to fix it. */ message: string; /** * Indicates whether the operation that caused the error should be retried. * * @remarks * * When `true`, the error is transient and the operation might succeed * if attempted again. When `false`, retrying the same operation is * unlikely to succeed without changes. */ retryable: boolean; /** * The underlying error that caused this error, creating an error chain. * * @remarks * * This allows for proper error propagation and debugging by maintaining * the full context of how an error occurred through multiple layers * of an application. */ source?: any | null | undefined; }; export type DeploymentListItemResponse = { /** * Unique identifier for the deployment. */ id: string; name: string; /** * Deployment status in the deployment lifecycle. * * @remarks * * For observe-only deployments with no release or stack state, `Running` * means the Operator is attached. Connectivity comes from `lastHeartbeatAt`; * resource health comes from inventory and resource heartbeat data. */ status: DeploymentListItemResponseStatus; /** * Unique identifier for the project. */ projectId: string; /** * Target platform for the deployment */ platform: DeploymentListItemResponsePlatform; /** * DeploymentState protocol version owned by the runtime/manager */ deploymentProtocolVersion: number; /** * ID of deployment group this deployment belongs to */ deploymentGroupId: string; /** * Operational purpose of this deployment within its customer environment. */ purpose: DeploymentPurpose; /** * Cloud environment information */ environmentInfo?: | DeploymentListItemResponseEnvironmentInfoGcp | DeploymentListItemResponseEnvironmentInfoAzure | DeploymentListItemResponseEnvironmentInfoLocal | DeploymentListItemResponseEnvironmentInfoAws | DeploymentListItemResponseEnvironmentInfoTest | any | null | undefined; /** * ID of the currently deployed release */ currentReleaseId?: string | null | undefined; /** * ID of the desired release */ desiredReleaseId?: string | null | undefined; /** * ID of the pinned release */ pinnedReleaseId?: string | null | undefined; releaseChannel: string; /** * Setup source that imported this deployment */ importSource?: DeploymentListItemResponseImportSource | null | undefined; /** * Setup method that created the deployment record. */ setupMethod?: DeploymentListItemResponseSetupMethod | null | undefined; /** * Setup method metadata needed to guide privileged teardown. */ setupMetadata?: { [k: string]: any | null } | null | undefined; /** * Imported setup target for compatibility checks */ setupTarget?: string | null | undefined; /** * Imported setup compatibility fingerprint */ setupFingerprint?: string | null | undefined; /** * Imported setup fingerprint version */ setupFingerprintVersion?: number | null | undefined; /** * Display-only scope reported by the Operator manifest */ operatorScope?: string | null | undefined; /** * Display-only permission tier reported by the Operator manifest */ operatorPermission?: string | null | undefined; /** * Version reported by the Operator */ operatorVersion?: string | null | undefined; /** * Capability state reported by the Operator */ capabilities?: Array | null | undefined; /** * Timestamp of the last received heartbeat */ lastHeartbeatAt?: Date | null | undefined; /** * Latest error information if in a failed state */ error?: DeploymentListItemResponseError | null | undefined; /** * Whether a retry has been requested */ retryRequested: boolean; createdAt: Date; updatedAt: Date; /** * ID of the manager */ managerId: string; /** * Unique identifier for the workspace. */ workspaceId: string; release?: DeploymentReleaseInfo | null | undefined; deploymentGroup?: DeploymentGroupInfo | undefined; project?: DeploymentProjectInfo | undefined; }; /** @internal */ export const DeploymentListItemResponseStatus$inboundSchema: z.ZodEnum< typeof DeploymentListItemResponseStatus > = z.enum(DeploymentListItemResponseStatus); /** @internal */ export const DeploymentListItemResponsePlatform$inboundSchema: z.ZodEnum< typeof DeploymentListItemResponsePlatform > = z.enum(DeploymentListItemResponsePlatform); /** @internal */ export const DeploymentListItemResponsePlatformTest$inboundSchema: z.ZodEnum< typeof DeploymentListItemResponsePlatformTest > = z.enum(DeploymentListItemResponsePlatformTest); /** @internal */ export const DeploymentListItemResponseEnvironmentInfoTest$inboundSchema: z.ZodType = z.object({ testId: z.string(), platform: DeploymentListItemResponsePlatformTest$inboundSchema, }); export function deploymentListItemResponseEnvironmentInfoTestFromJSON( jsonString: string, ): SafeParseResult< DeploymentListItemResponseEnvironmentInfoTest, SDKValidationError > { return safeParse( jsonString, (x) => DeploymentListItemResponseEnvironmentInfoTest$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'DeploymentListItemResponseEnvironmentInfoTest' from JSON`, ); } /** @internal */ export const DeploymentListItemResponsePlatformLocal$inboundSchema: z.ZodEnum< typeof DeploymentListItemResponsePlatformLocal > = z.enum(DeploymentListItemResponsePlatformLocal); /** @internal */ export const DeploymentListItemResponseEnvironmentInfoLocal$inboundSchema: z.ZodType = z.object( { arch: z.string(), hostname: z.string(), os: z.string(), platform: DeploymentListItemResponsePlatformLocal$inboundSchema, }, ); export function deploymentListItemResponseEnvironmentInfoLocalFromJSON( jsonString: string, ): SafeParseResult< DeploymentListItemResponseEnvironmentInfoLocal, SDKValidationError > { return safeParse( jsonString, (x) => DeploymentListItemResponseEnvironmentInfoLocal$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'DeploymentListItemResponseEnvironmentInfoLocal' from JSON`, ); } /** @internal */ export const DeploymentListItemResponsePlatformAzure$inboundSchema: z.ZodEnum< typeof DeploymentListItemResponsePlatformAzure > = z.enum(DeploymentListItemResponsePlatformAzure); /** @internal */ export const DeploymentListItemResponseEnvironmentInfoAzure$inboundSchema: z.ZodType = z.object( { location: z.string(), subscriptionId: z.string(), tenantId: z.string(), platform: DeploymentListItemResponsePlatformAzure$inboundSchema, }, ); export function deploymentListItemResponseEnvironmentInfoAzureFromJSON( jsonString: string, ): SafeParseResult< DeploymentListItemResponseEnvironmentInfoAzure, SDKValidationError > { return safeParse( jsonString, (x) => DeploymentListItemResponseEnvironmentInfoAzure$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'DeploymentListItemResponseEnvironmentInfoAzure' from JSON`, ); } /** @internal */ export const DeploymentListItemResponsePlatformGcp$inboundSchema: z.ZodEnum< typeof DeploymentListItemResponsePlatformGcp > = z.enum(DeploymentListItemResponsePlatformGcp); /** @internal */ export const DeploymentListItemResponseEnvironmentInfoGcp$inboundSchema: z.ZodType = z.object({ projectId: z.string(), projectNumber: z.string(), region: z.string(), platform: DeploymentListItemResponsePlatformGcp$inboundSchema, }); export function deploymentListItemResponseEnvironmentInfoGcpFromJSON( jsonString: string, ): SafeParseResult< DeploymentListItemResponseEnvironmentInfoGcp, SDKValidationError > { return safeParse( jsonString, (x) => DeploymentListItemResponseEnvironmentInfoGcp$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'DeploymentListItemResponseEnvironmentInfoGcp' from JSON`, ); } /** @internal */ export const DeploymentListItemResponsePlatformAws$inboundSchema: z.ZodEnum< typeof DeploymentListItemResponsePlatformAws > = z.enum(DeploymentListItemResponsePlatformAws); /** @internal */ export const DeploymentListItemResponseEnvironmentInfoAws$inboundSchema: z.ZodType = z.object({ accountId: z.string(), region: z.string(), platform: DeploymentListItemResponsePlatformAws$inboundSchema, }); export function deploymentListItemResponseEnvironmentInfoAwsFromJSON( jsonString: string, ): SafeParseResult< DeploymentListItemResponseEnvironmentInfoAws, SDKValidationError > { return safeParse( jsonString, (x) => DeploymentListItemResponseEnvironmentInfoAws$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'DeploymentListItemResponseEnvironmentInfoAws' from JSON`, ); } /** @internal */ export const DeploymentListItemResponseEnvironmentInfoUnion$inboundSchema: z.ZodType = z.union([ z.lazy(() => DeploymentListItemResponseEnvironmentInfoGcp$inboundSchema), z.lazy(() => DeploymentListItemResponseEnvironmentInfoAzure$inboundSchema), z.lazy(() => DeploymentListItemResponseEnvironmentInfoLocal$inboundSchema), z.lazy(() => DeploymentListItemResponseEnvironmentInfoAws$inboundSchema), z.lazy(() => DeploymentListItemResponseEnvironmentInfoTest$inboundSchema), z.any(), ]); export function deploymentListItemResponseEnvironmentInfoUnionFromJSON( jsonString: string, ): SafeParseResult< DeploymentListItemResponseEnvironmentInfoUnion, SDKValidationError > { return safeParse( jsonString, (x) => DeploymentListItemResponseEnvironmentInfoUnion$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'DeploymentListItemResponseEnvironmentInfoUnion' from JSON`, ); } /** @internal */ export const DeploymentListItemResponseImportSource$inboundSchema: z.ZodEnum< typeof DeploymentListItemResponseImportSource > = z.enum(DeploymentListItemResponseImportSource); /** @internal */ export const DeploymentListItemResponseSetupMethod$inboundSchema: z.ZodEnum< typeof DeploymentListItemResponseSetupMethod > = z.enum(DeploymentListItemResponseSetupMethod); /** @internal */ export const DeploymentListItemResponseError$inboundSchema: z.ZodType< DeploymentListItemResponseError, unknown > = z.object({ code: z.string(), context: z.nullable(z.any()).optional(), hint: z.nullable(z.string()).optional(), httpStatusCode: z.nullable(z.int()).optional(), internal: z.boolean(), message: z.string(), retryable: z.boolean().default(false), source: z.nullable(z.any()).optional(), }); export function deploymentListItemResponseErrorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DeploymentListItemResponseError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeploymentListItemResponseError' from JSON`, ); } /** @internal */ export const DeploymentListItemResponse$inboundSchema: z.ZodType< DeploymentListItemResponse, unknown > = z.object({ id: z.string(), name: z.string(), status: DeploymentListItemResponseStatus$inboundSchema, projectId: z.string(), platform: DeploymentListItemResponsePlatform$inboundSchema, deploymentProtocolVersion: z.int(), deploymentGroupId: z.string(), purpose: DeploymentPurpose$inboundSchema, environmentInfo: z.nullable( z.union([ z.lazy(() => DeploymentListItemResponseEnvironmentInfoGcp$inboundSchema), z.lazy(() => DeploymentListItemResponseEnvironmentInfoAzure$inboundSchema ), z.lazy(() => DeploymentListItemResponseEnvironmentInfoLocal$inboundSchema ), z.lazy(() => DeploymentListItemResponseEnvironmentInfoAws$inboundSchema ), z.lazy(() => DeploymentListItemResponseEnvironmentInfoTest$inboundSchema), z.any(), ]), ).optional(), currentReleaseId: z.nullable(z.string()).optional(), desiredReleaseId: z.nullable(z.string()).optional(), pinnedReleaseId: z.nullable(z.string()).optional(), releaseChannel: z.string(), importSource: z.nullable(DeploymentListItemResponseImportSource$inboundSchema) .optional(), setupMethod: z.nullable(DeploymentListItemResponseSetupMethod$inboundSchema) .optional(), setupMetadata: z.nullable(z.record(z.string(), z.nullable(z.any()))) .optional(), setupTarget: z.nullable(z.string()).optional(), setupFingerprint: z.nullable(z.string()).optional(), setupFingerprintVersion: z.nullable(z.int()).optional(), operatorScope: z.nullable(z.string()).optional(), operatorPermission: z.nullable(z.string()).optional(), operatorVersion: z.nullable(z.string()).optional(), capabilities: z.nullable(z.array(OperatorCapabilityReport$inboundSchema)) .optional(), lastHeartbeatAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), error: z.nullable(z.lazy(() => DeploymentListItemResponseError$inboundSchema)) .optional(), retryRequested: z.boolean(), createdAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), updatedAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), managerId: z.string(), workspaceId: z.string(), release: z.nullable(DeploymentReleaseInfo$inboundSchema).optional(), deploymentGroup: DeploymentGroupInfo$inboundSchema.optional(), project: DeploymentProjectInfo$inboundSchema.optional(), }); export function deploymentListItemResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DeploymentListItemResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeploymentListItemResponse' from JSON`, ); }