/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 7e8bcffbb95d */ 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 { ManagerManagementConfigs, ManagerManagementConfigs$inboundSchema, } from "./managermanagementconfigs.js"; import { ManagerStatus, ManagerStatus$inboundSchema } from "./managerstatus.js"; /** * Represents the target cloud platform. */ export const TargetEnum = { Aws: "aws", Gcp: "gcp", Azure: "azure", Kubernetes: "kubernetes", Machines: "machines", Local: "local", Test: "test", } as const; /** * Represents the target cloud platform. */ export type TargetEnum = ClosedEnum; /** * Cloud where this private manager is deployed */ export const CloudEnum = { Aws: "aws", Gcp: "gcp", Azure: "azure", Kubernetes: "kubernetes", Machines: "machines", Local: "local", Test: "test", } as const; /** * Cloud where this private manager is deployed */ export type CloudEnum = ClosedEnum; /** * Private manager setup lifecycle status */ export const ManagerSetupStatus = { Pending: "pending", Provisioning: "provisioning", Active: "active", Failed: "failed", Deleting: "deleting", Deleted: "deleted", } as const; /** * Private manager setup lifecycle status */ export type ManagerSetupStatus = ClosedEnum; /** * Runtime metrics (self-reported via heartbeat) */ export type ManagerMetrics = { /** * Number of active deployments */ activeDeployments?: number | undefined; /** * Number of pending deployments */ pendingDeployments?: number | undefined; /** * Memory usage in megabytes */ memoryUsageMb?: number | undefined; /** * CPU usage percentage */ cpuUsagePercent?: number | undefined; }; /** * Manager schema */ export type Manager = { id: string; /** * Display name of the manager */ name: string; /** * Platforms this manager can handle */ targets: Array; /** * Cloud where this private manager is deployed */ cloud?: CloudEnum | null | undefined; /** * Cloud region selected for this private manager */ region?: string | null | undefined; /** * Private manager setup lifecycle status */ setupStatus?: ManagerSetupStatus | null | undefined; /** * Manager URL (self-reported via heartbeat). DeepStore endpoints are exposed through this URL (e.g., {url}/v1/logs) */ url?: string | null | undefined; /** * Per-platform management configurations for cross-account access (self-reported via heartbeat) */ managementConfigs: ManagerManagementConfigs; /** * Whether this is a system manager (Alien-hosted) */ isSystem: boolean; /** * The workspace ID (for system managers, this is ALIEN_WORKSPACE_ID) */ workspaceId: string; /** * Current health status */ status: ManagerStatus; /** * Manager version (self-reported via heartbeat) */ version?: string | null | undefined; /** * Runtime metrics (self-reported via heartbeat) */ metrics?: ManagerMetrics | null | undefined; /** * Timestamp of the last received heartbeat from the manager */ lastHeartbeatAt?: Date | null | undefined; /** * ID of the logs database associated with this manager */ logsDatabaseId?: string | null | undefined; /** * Number of deployments currently being managed by this manager */ managedDeploymentCount: number; /** * Number of projects that select this manager as a default manager */ defaultProjectCount: number; /** * Timestamp when the manager was created */ createdAt: Date; }; /** @internal */ export const TargetEnum$inboundSchema: z.ZodEnum = z.enum( TargetEnum, ); /** @internal */ export const CloudEnum$inboundSchema: z.ZodEnum = z.enum( CloudEnum, ); /** @internal */ export const ManagerSetupStatus$inboundSchema: z.ZodEnum< typeof ManagerSetupStatus > = z.enum(ManagerSetupStatus); /** @internal */ export const ManagerMetrics$inboundSchema: z.ZodType = z.object({ activeDeployments: z.number().optional(), pendingDeployments: z.number().optional(), memoryUsageMb: z.number().optional(), cpuUsagePercent: z.number().optional(), }); export function managerMetricsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ManagerMetrics$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ManagerMetrics' from JSON`, ); } /** @internal */ export const Manager$inboundSchema: z.ZodType = z.object({ id: z.string(), name: z.string(), targets: z.array(TargetEnum$inboundSchema), cloud: z.nullable(CloudEnum$inboundSchema).optional(), region: z.nullable(z.string()).optional(), setupStatus: z.nullable(ManagerSetupStatus$inboundSchema).optional(), url: z.nullable(z.string()).optional(), managementConfigs: ManagerManagementConfigs$inboundSchema, isSystem: z.boolean(), workspaceId: z.string(), status: ManagerStatus$inboundSchema, version: z.nullable(z.string()).optional(), metrics: z.nullable(z.lazy(() => ManagerMetrics$inboundSchema)).optional(), lastHeartbeatAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), logsDatabaseId: z.nullable(z.string()).optional(), managedDeploymentCount: z.int(), defaultProjectCount: z.int(), createdAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), }); export function managerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Manager$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Manager' from JSON`, ); }