/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 7aa77b4fc2cb */ 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"; import { ReleaseRolloutState, ReleaseRolloutState$inboundSchema, } from "./releaserolloutstate.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 ReleaseDeploymentItemStatus = { 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 ReleaseDeploymentItemStatus = ClosedEnum< typeof ReleaseDeploymentItemStatus >; /** * Target platform for the deployment */ export const ReleaseDeploymentItemPlatform = { Aws: "aws", Gcp: "gcp", Azure: "azure", Kubernetes: "kubernetes", Machines: "machines", Local: "local", Test: "test", } as const; /** * Target platform for the deployment */ export type ReleaseDeploymentItemPlatform = ClosedEnum< typeof ReleaseDeploymentItemPlatform >; export const ReleaseDeploymentItemPlatformTest = { Test: "test", } as const; export type ReleaseDeploymentItemPlatformTest = ClosedEnum< typeof ReleaseDeploymentItemPlatformTest >; /** * Test platform environment information (mock) */ export type ReleaseDeploymentItemEnvironmentInfoTest = { /** * Test identifier for this environment */ testId: string; platform: ReleaseDeploymentItemPlatformTest; }; export const ReleaseDeploymentItemPlatformLocal = { Local: "local", } as const; export type ReleaseDeploymentItemPlatformLocal = ClosedEnum< typeof ReleaseDeploymentItemPlatformLocal >; /** * Local platform environment information */ export type ReleaseDeploymentItemEnvironmentInfoLocal = { /** * 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: ReleaseDeploymentItemPlatformLocal; }; export const ReleaseDeploymentItemPlatformAzure = { Azure: "azure", } as const; export type ReleaseDeploymentItemPlatformAzure = ClosedEnum< typeof ReleaseDeploymentItemPlatformAzure >; /** * Azure-specific environment information */ export type ReleaseDeploymentItemEnvironmentInfoAzure = { /** * Azure location/region */ location: string; /** * Azure subscription ID */ subscriptionId: string; /** * Azure tenant ID */ tenantId: string; platform: ReleaseDeploymentItemPlatformAzure; }; export const ReleaseDeploymentItemPlatformGcp = { Gcp: "gcp", } as const; export type ReleaseDeploymentItemPlatformGcp = ClosedEnum< typeof ReleaseDeploymentItemPlatformGcp >; /** * GCP-specific environment information */ export type ReleaseDeploymentItemEnvironmentInfoGcp = { /** * GCP project ID (e.g., "my-project") */ projectId: string; /** * GCP project number (e.g., "123456789012") */ projectNumber: string; /** * GCP region */ region: string; platform: ReleaseDeploymentItemPlatformGcp; }; export const ReleaseDeploymentItemPlatformAws = { Aws: "aws", } as const; export type ReleaseDeploymentItemPlatformAws = ClosedEnum< typeof ReleaseDeploymentItemPlatformAws >; /** * AWS-specific environment information */ export type ReleaseDeploymentItemEnvironmentInfoAws = { /** * AWS account ID */ accountId: string; /** * AWS region */ region: string; platform: ReleaseDeploymentItemPlatformAws; }; /** * Cloud environment information */ export type ReleaseDeploymentItemEnvironmentInfoUnion = | ReleaseDeploymentItemEnvironmentInfoGcp | ReleaseDeploymentItemEnvironmentInfoAzure | ReleaseDeploymentItemEnvironmentInfoLocal | ReleaseDeploymentItemEnvironmentInfoAws | ReleaseDeploymentItemEnvironmentInfoTest | any; /** * Deployment group this deployment belongs to */ export type ReleaseDeploymentItemDeploymentGroup = { /** * Unique identifier for the deployment group. */ id: string; /** * Deployment group name. */ name: string; /** * Case-sensitive, URL- and header-safe identifier from the integrating application. */ externalId: string | null; }; /** * Latest error information if the deployment is in a failed state */ export type ReleaseDeploymentItemError = { /** * 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 ReleaseDeploymentItem = { /** * 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: ReleaseDeploymentItemStatus; /** * Target platform for the deployment */ platform: ReleaseDeploymentItemPlatform; /** * Cloud environment information */ environmentInfo?: | ReleaseDeploymentItemEnvironmentInfoGcp | ReleaseDeploymentItemEnvironmentInfoAzure | ReleaseDeploymentItemEnvironmentInfoLocal | ReleaseDeploymentItemEnvironmentInfoAws | ReleaseDeploymentItemEnvironmentInfoTest | any | null | undefined; /** * Deployment group this deployment belongs to */ deploymentGroup?: ReleaseDeploymentItemDeploymentGroup | 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; /** * Timestamp of the last received heartbeat */ lastHeartbeatAt?: Date | null | undefined; rolloutState: ReleaseRolloutState; /** * When this release went live on the deployment, null if it never did */ releasedAt: Date | null; /** * Time from release creation until the deployment finished updating, in milliseconds. Null for initial provisions and deployments that never ran this release. */ durationMs: number | null; /** * Latest error information if the deployment is in a failed state */ error?: ReleaseDeploymentItemError | null | undefined; }; /** @internal */ export const ReleaseDeploymentItemStatus$inboundSchema: z.ZodEnum< typeof ReleaseDeploymentItemStatus > = z.enum(ReleaseDeploymentItemStatus); /** @internal */ export const ReleaseDeploymentItemPlatform$inboundSchema: z.ZodEnum< typeof ReleaseDeploymentItemPlatform > = z.enum(ReleaseDeploymentItemPlatform); /** @internal */ export const ReleaseDeploymentItemPlatformTest$inboundSchema: z.ZodEnum< typeof ReleaseDeploymentItemPlatformTest > = z.enum(ReleaseDeploymentItemPlatformTest); /** @internal */ export const ReleaseDeploymentItemEnvironmentInfoTest$inboundSchema: z.ZodType< ReleaseDeploymentItemEnvironmentInfoTest, unknown > = z.object({ testId: z.string(), platform: ReleaseDeploymentItemPlatformTest$inboundSchema, }); export function releaseDeploymentItemEnvironmentInfoTestFromJSON( jsonString: string, ): SafeParseResult< ReleaseDeploymentItemEnvironmentInfoTest, SDKValidationError > { return safeParse( jsonString, (x) => ReleaseDeploymentItemEnvironmentInfoTest$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ReleaseDeploymentItemEnvironmentInfoTest' from JSON`, ); } /** @internal */ export const ReleaseDeploymentItemPlatformLocal$inboundSchema: z.ZodEnum< typeof ReleaseDeploymentItemPlatformLocal > = z.enum(ReleaseDeploymentItemPlatformLocal); /** @internal */ export const ReleaseDeploymentItemEnvironmentInfoLocal$inboundSchema: z.ZodType< ReleaseDeploymentItemEnvironmentInfoLocal, unknown > = z.object({ arch: z.string(), hostname: z.string(), os: z.string(), platform: ReleaseDeploymentItemPlatformLocal$inboundSchema, }); export function releaseDeploymentItemEnvironmentInfoLocalFromJSON( jsonString: string, ): SafeParseResult< ReleaseDeploymentItemEnvironmentInfoLocal, SDKValidationError > { return safeParse( jsonString, (x) => ReleaseDeploymentItemEnvironmentInfoLocal$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ReleaseDeploymentItemEnvironmentInfoLocal' from JSON`, ); } /** @internal */ export const ReleaseDeploymentItemPlatformAzure$inboundSchema: z.ZodEnum< typeof ReleaseDeploymentItemPlatformAzure > = z.enum(ReleaseDeploymentItemPlatformAzure); /** @internal */ export const ReleaseDeploymentItemEnvironmentInfoAzure$inboundSchema: z.ZodType< ReleaseDeploymentItemEnvironmentInfoAzure, unknown > = z.object({ location: z.string(), subscriptionId: z.string(), tenantId: z.string(), platform: ReleaseDeploymentItemPlatformAzure$inboundSchema, }); export function releaseDeploymentItemEnvironmentInfoAzureFromJSON( jsonString: string, ): SafeParseResult< ReleaseDeploymentItemEnvironmentInfoAzure, SDKValidationError > { return safeParse( jsonString, (x) => ReleaseDeploymentItemEnvironmentInfoAzure$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ReleaseDeploymentItemEnvironmentInfoAzure' from JSON`, ); } /** @internal */ export const ReleaseDeploymentItemPlatformGcp$inboundSchema: z.ZodEnum< typeof ReleaseDeploymentItemPlatformGcp > = z.enum(ReleaseDeploymentItemPlatformGcp); /** @internal */ export const ReleaseDeploymentItemEnvironmentInfoGcp$inboundSchema: z.ZodType< ReleaseDeploymentItemEnvironmentInfoGcp, unknown > = z.object({ projectId: z.string(), projectNumber: z.string(), region: z.string(), platform: ReleaseDeploymentItemPlatformGcp$inboundSchema, }); export function releaseDeploymentItemEnvironmentInfoGcpFromJSON( jsonString: string, ): SafeParseResult< ReleaseDeploymentItemEnvironmentInfoGcp, SDKValidationError > { return safeParse( jsonString, (x) => ReleaseDeploymentItemEnvironmentInfoGcp$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ReleaseDeploymentItemEnvironmentInfoGcp' from JSON`, ); } /** @internal */ export const ReleaseDeploymentItemPlatformAws$inboundSchema: z.ZodEnum< typeof ReleaseDeploymentItemPlatformAws > = z.enum(ReleaseDeploymentItemPlatformAws); /** @internal */ export const ReleaseDeploymentItemEnvironmentInfoAws$inboundSchema: z.ZodType< ReleaseDeploymentItemEnvironmentInfoAws, unknown > = z.object({ accountId: z.string(), region: z.string(), platform: ReleaseDeploymentItemPlatformAws$inboundSchema, }); export function releaseDeploymentItemEnvironmentInfoAwsFromJSON( jsonString: string, ): SafeParseResult< ReleaseDeploymentItemEnvironmentInfoAws, SDKValidationError > { return safeParse( jsonString, (x) => ReleaseDeploymentItemEnvironmentInfoAws$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ReleaseDeploymentItemEnvironmentInfoAws' from JSON`, ); } /** @internal */ export const ReleaseDeploymentItemEnvironmentInfoUnion$inboundSchema: z.ZodType< ReleaseDeploymentItemEnvironmentInfoUnion, unknown > = z.union([ z.lazy(() => ReleaseDeploymentItemEnvironmentInfoGcp$inboundSchema), z.lazy(() => ReleaseDeploymentItemEnvironmentInfoAzure$inboundSchema), z.lazy(() => ReleaseDeploymentItemEnvironmentInfoLocal$inboundSchema), z.lazy(() => ReleaseDeploymentItemEnvironmentInfoAws$inboundSchema), z.lazy(() => ReleaseDeploymentItemEnvironmentInfoTest$inboundSchema), z.any(), ]); export function releaseDeploymentItemEnvironmentInfoUnionFromJSON( jsonString: string, ): SafeParseResult< ReleaseDeploymentItemEnvironmentInfoUnion, SDKValidationError > { return safeParse( jsonString, (x) => ReleaseDeploymentItemEnvironmentInfoUnion$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ReleaseDeploymentItemEnvironmentInfoUnion' from JSON`, ); } /** @internal */ export const ReleaseDeploymentItemDeploymentGroup$inboundSchema: z.ZodType< ReleaseDeploymentItemDeploymentGroup, unknown > = z.object({ id: z.string(), name: z.string(), externalId: z.nullable(z.string()), }); export function releaseDeploymentItemDeploymentGroupFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReleaseDeploymentItemDeploymentGroup$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReleaseDeploymentItemDeploymentGroup' from JSON`, ); } /** @internal */ export const ReleaseDeploymentItemError$inboundSchema: z.ZodType< ReleaseDeploymentItemError, 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 releaseDeploymentItemErrorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReleaseDeploymentItemError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReleaseDeploymentItemError' from JSON`, ); } /** @internal */ export const ReleaseDeploymentItem$inboundSchema: z.ZodType< ReleaseDeploymentItem, unknown > = z.object({ id: z.string(), name: z.string(), status: ReleaseDeploymentItemStatus$inboundSchema, platform: ReleaseDeploymentItemPlatform$inboundSchema, environmentInfo: z.nullable( z.union([ z.lazy(() => ReleaseDeploymentItemEnvironmentInfoGcp$inboundSchema), z.lazy(() => ReleaseDeploymentItemEnvironmentInfoAzure$inboundSchema), z.lazy(() => ReleaseDeploymentItemEnvironmentInfoLocal$inboundSchema), z.lazy(() => ReleaseDeploymentItemEnvironmentInfoAws$inboundSchema), z.lazy(() => ReleaseDeploymentItemEnvironmentInfoTest$inboundSchema), z.any(), ]), ).optional(), deploymentGroup: z.nullable( z.lazy(() => ReleaseDeploymentItemDeploymentGroup$inboundSchema), ).optional(), currentReleaseId: z.nullable(z.string()).optional(), desiredReleaseId: z.nullable(z.string()).optional(), pinnedReleaseId: z.nullable(z.string()).optional(), lastHeartbeatAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), rolloutState: ReleaseRolloutState$inboundSchema, releasedAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ), durationMs: z.nullable(z.int()), error: z.nullable(z.lazy(() => ReleaseDeploymentItemError$inboundSchema)) .optional(), }); export function releaseDeploymentItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReleaseDeploymentItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReleaseDeploymentItem' from JSON`, ); }