/** * Multicloud REST API client * * Provides a comprehensive client for interacting with Multicloud servers * with mTLS authentication and proper error handling. * * IMPORTANT: This is for server-side use only - never expose to client/browser! */ import { MulticloudConnectionParams } from './config'; /** * Application data structure from Multicloud API */ export interface Application { id?: number; name: string; description?: string; dns?: Dns; jobs?: Job[]; clusters?: Cluster[]; [key: string]: any; } /** * Dns data structure from Multicloud API */ export interface Dns { id?: number; domainName: string; account: string; provider: string; [key: string]: any; } /** * ExtendedLocationRuleType enum for location rules */ export declare enum ExtendedLocationRuleType { INCLUDE_ALL_PROVIDER = "INCLUDE_ALL_PROVIDER", EXCLUDE_ALL_PROVIDER = "EXCLUDE_ALL_PROVIDER", INCLUDE_REGION = "INCLUDE_REGION", EXCLUDE_REGION = "EXCLUDE_REGION", INCLUDE_PROVIDER_REGION = "INCLUDE_PROVIDER_REGION", EXCLUDE_PROVIDER_REGION = "EXCLUDE_PROVIDER_REGION", INCLUDE_LOCATION = "INCLUDE_LOCATION", EXCLUDE_LOCATION = "EXCLUDE_LOCATION", INCLUDE_ZONE = "INCLUDE_ZONE", EXCLUDE_ZONE = "EXCLUDE_ZONE", INCLUDE_PROVIDER_ZONE = "INCLUDE_PROVIDER_ZONE", EXCLUDE_PROVIDER_ZONE = "EXCLUDE_PROVIDER_ZONE" } /** * CloudProvider data structure */ export interface CloudProvider { id?: number; type: string; name?: string; [key: string]: any; } /** * MetaLocation data structure from Multicloud API */ export interface MetaLocation { id?: number; name: string; cloudProvider: CloudProvider; region: string; zone?: string; pingUrl?: string; loadBalancerName?: string; clientPingLatency?: number; [key: string]: any; } /** * KeyPair data structure from Multicloud API */ export interface KeyPair { id?: number; name: string; publicKey?: string; privateKey?: string; [key: string]: any; } /** * JobLocationRule data structure from Multicloud API (for jobs) */ export interface JobLocationRule { id?: number; ruleType: ExtendedLocationRuleType; cloudProvider?: CloudProvider; region?: string; zone?: string; metaLocation?: MetaLocation; job?: Job; [key: string]: any; } /** * Job data structure from Multicloud API */ export interface Job { id?: number; name: string; displayName?: string; owner?: string; status?: string; state?: State; targetInstanceCount?: number; availability?: number; priority?: number; envVars?: { [key: string]: string; }; command?: string; image?: string; longRunning?: boolean; orchestration?: Orchestration; sdnUniqueNamePerTask?: boolean; volumes?: VolumeDesc[]; services?: Service[]; upstreams?: Upstream[]; locationRules?: JobLocationRule[]; constraints?: ConstraintSet; schedulingMetadata?: any; lastRun?: string; cronSchedule?: string; capabilities?: string; options?: string; hostname?: string; network?: string; networkAliases?: string[]; [key: string]: any; } /** * State enum for job states */ export declare enum State { LOADED = "LOADED", STARTING = "STARTING", RUNNING = "RUNNING", STOPPING = "STOPPING", STOPPED = "STOPPED", PENDING_DESTROY = "PENDING_DESTROY", DONE = "DONE", ERROR = "ERROR" } /** * Orchestration enum for job orchestration types */ export declare enum Orchestration { EXTERNAL = "EXTERNAL", ALL = "ALL", EXACTLY = "EXACTLY", ACTIVE_STANDBY = "ACTIVE_STANDBY", EXACTLY_ONCE = "EXACTLY_ONCE", CRON = "CRON" } /** * LocationRule data structure from Multicloud API (for clusters) */ export interface LocationRule { id?: number; ruleType: ExtendedLocationRuleType; cloudProvider?: CloudProvider; region?: string; zone?: string; metaLocation?: MetaLocation; cluster?: Cluster; [key: string]: any; } /** * Cluster data structure from Multicloud API */ export interface Cluster { id: number; name: string; enabled: boolean; minServers?: number; maxServers?: number; minZones?: number; minNodeMemory?: string; minMultiCoreBench?: number; minBootDiskSize?: string; dnsRecord?: string; affinity?: string; maxCostPerHour?: number; locationRules?: LocationRule[]; [key: string]: any; } /** * ServerLocationRule data structure from Multicloud API (for servers) */ export interface ServerLocationRule { id?: number; ruleType: ExtendedLocationRuleType; cloudProvider?: CloudProvider; region?: string; zone?: string; metaLocation?: MetaLocation; server?: Server; [key: string]: any; } /** * Server data structure from Multicloud API */ export interface Server { id?: number; hostId: string; status: ServerStatus; zone?: string; publicIp?: string; privateIp?: string; sdnIp?: string; cost?: number; providerHostId?: string; serverTypeSpec?: ServerTypeSpec; locationRules?: ServerLocationRule[]; expires?: string; totalMemoryMb?: number; availableMemoryMb?: number; cpuLoad5Min?: number; lastUpdated?: string; logicalProcessors?: number; physicalProcessors?: number; availableAccelerators?: number; sdnAvailable?: boolean; ephemeral?: boolean; constraints?: ConstraintSet; [key: string]: any; } /** * ServerStatus enum */ export declare enum ServerStatus { PENDING = "PENDING", UNKNOWN = "UNKNOWN", INITIALIZING = "INITIALIZING", STARTING = "STARTING", RUNNING = "RUNNING", STOPPING = "STOPPING", STOPPED = "STOPPED", ERROR = "ERROR", PENDING_SHUTDOWN = "PENDING_SHUTDOWN", TERMINATED = "TERMINATED" } /** * ServerTypeSpec data structure from Multicloud API */ export interface ServerTypeSpec { name: string; id?: string; provider: string; ram: number; processor?: ProcessorSpec; volumes?: VolumeSpec[]; accelerators?: AcceleratorSpec; benchmarkSingle?: number; benchmarkMulti?: number; [key: string]: any; } /** * ProcessorSpec data structure */ export interface ProcessorSpec { vendor?: string; speed?: number; architecture?: ProcessorArchitecture; coreCount?: number; threadsPerCore?: number; hyperThreadEnabled?: boolean; [key: string]: any; } /** * ProcessorArchitecture enum */ export declare enum ProcessorArchitecture { X86_64 = "X86_64", ARM64 = "ARM64", UNKNOWN = "UNKNOWN" } /** * VolumeSpec data structure */ export interface VolumeSpec { name?: string; sizeGb: number; type?: string; boot?: boolean; [key: string]: any; } /** * AcceleratorSpec data structure */ export interface AcceleratorSpec { name?: string; vendor?: string; memMb?: number; relativePerformance?: number; count?: number; [key: string]: any; } /** * Legacy Processor interface (deprecated - use ProcessorSpec) * @deprecated Use ProcessorSpec instead */ export interface Processor { architecture?: string; architectureGen?: string; vendor?: string; speed?: number; coreCount?: number; [key: string]: any; } /** * Legacy Accelerator interface (deprecated - use AcceleratorSpec) * @deprecated Use AcceleratorSpec instead */ export interface Accelerator { name?: string; vendor?: string; memMb?: number; count?: number; totalMemMb?: number; [key: string]: any; } /** * Task data structure from Multicloud API */ export interface Task { id?: number; jobId: number; serverId: number; status: TaskStatus; sequence?: number; expires?: string; since?: string; memLimitMb?: number; upstreams?: Upstream[]; ipLease?: IpLease; extra?: { [key: string]: string; }; statsCpu?: number; statsMemUsage?: number; statsMemLimit?: number; statsNetIn?: number; statsNetOut?: number; statsBlockIn?: number; statsBlockOut?: number; statsCpuUsageRaw?: number; statsSystemCpuUsageRaw?: number; [key: string]: any; } /** * TaskStatus enum */ export declare enum TaskStatus { UNKNOWN = "UNKNOWN", PENDING = "PENDING", PENDING_UNASSIGNABLE = "PENDING_UNASSIGNABLE", ASSIGNED = "ASSIGNED", STARTING = "STARTING", RUNNING = "RUNNING", RESTARTING = "RESTARTING", STOPPING = "STOPPING", STOPPED = "STOPPED", DONE = "DONE", ERROR = "ERROR", PENDING_SHUTDOWN = "PENDING_SHUTDOWN", PENDING_RESTART = "PENDING_RESTART", CANCELLED = "CANCELLED" } /** * Service data structure from Multicloud API */ export interface Service { id?: number; name: string; frontend?: string; backendName?: string; backendPort?: number; domain?: string; urlReg?: string; httpCheck?: string; httpCheckOptions?: string; authRealm?: string; authClientId?: string; authentication?: string; [key: string]: any; } /** * VolumeDesc interface matching Java VolumeDesc class */ export interface VolumeDesc { id?: number; hostPath?: string; containerPath?: string; source?: string; accessMode?: VolumeDescAccessMode; syncMode?: VolumeDescSyncMode; preSyncCommand?: string; postSyncCommand?: string; [key: string]: any; } /** * VolumeDesc access mode enum matching Java AccessMode */ export declare enum VolumeDescAccessMode { RW = "rw", RO = "ro" } /** * VolumeDesc sync mode enum matching Java SyncMode */ export declare enum VolumeDescSyncMode { NEVER = "NEVER", ON_EXIT = "ON_EXIT", CONTINUOUS = "CONTINUOUS", PERIODIC = "PERIODIC", ON_MIGRATION = "ON_MIGRATION" } /** * Upstream data structure from Multicloud API */ export interface Upstream { id?: number; name: string; port: number; protocol?: string; [key: string]: any; } /** * IpLease data structure from Multicloud API */ export interface IpLease { id?: number; subnetName: string; name: string; ip: string; cidr: string; expires?: string; since?: string; metadata?: IpLeaseMetadata[]; [key: string]: any; } /** * IpLeaseMetadata data structure from Multicloud API */ export interface IpLeaseMetadata { property: string; value?: string; lease: IpLease; [key: string]: any; } /** * Property data structure from Multicloud API */ /** * Property interface matching Java Property class */ export interface Property { id?: number; propKey: string; propVal?: string; [key: string]: any; } /** * Unit data structure from Multicloud API */ export interface Unit { id?: number; name: string; description?: string; [key: string]: any; } /** * PortPermission data structure from Multicloud API */ export interface PortPermission { id?: number; port: number; protocol?: string; [key: string]: any; } /** * Route53 data structure from Multicloud API */ export interface Route53 { id?: number; hostedZoneId: string; recordName: string; recordType: string; recordValue: string; ttl?: number; [key: string]: any; } /** * ServerTemplate interface matching Java ServerTemplate class */ export interface ServerTemplate { id?: number; imageId?: string; imageName?: string; imageVersion?: string; sshUser?: string; customData?: string; providerName?: string; processorArchs?: string; acceleratorNames?: string; properties?: Property[]; comment?: string; [key: string]: any; } /** * TaskAssignment data structure from Multicloud API */ export interface TaskAssignment { assignmentId?: string; task?: Task; serverId?: string; assignedAt?: string; type?: TaskAssignmentType; [key: string]: any; } /** * TaskAssignmentType enum */ export declare enum TaskAssignmentType { NEW_TASK = "NEW_TASK", TASK_UPDATE = "TASK_UPDATE", TASK_STOP = "TASK_STOP" } /** * GetTaskRequest data structure from Multicloud API */ export interface GetTaskRequest { serverId: number; jobId?: number; [key: string]: any; } /** * Alloc data structure from Multicloud API */ export interface Alloc { id?: number; name: string; value?: string; [key: string]: any; } /** * Base constraint interface for the unified constraint system */ export interface Constraint { type: ConstraintType; description?: string; priority?: number; required?: boolean; } /** * Constraint type enum matching the Java constraint system */ export declare enum ConstraintType { SERVER_RESOURCES = "serverResources", REQUIRES_MEMORY = "requiresMemory", REQUIRES_GPU = "requiresGpu", REQUIRES_CPU_CORES = "requiresCpuCores", CPU_BENCHMARK = "cpuBenchmark", AFTER_JOB = "afterJob", BEFORE_JOB = "beforeJob", AT_TIME = "atTime" } /** * GPU requirements for server resources constraint */ export interface GpuRequirements { requiredType?: string; requiredCount?: number; requiredMemoryMb?: number; } /** * Server resources constraint - composite constraint for resource requirements */ export interface ServerResourcesConstraint extends Constraint { type: ConstraintType.SERVER_RESOURCES; minMemoryMb?: number; minCpuCores?: number; minSingleCoreBench?: number; minMultiCoreBench?: number; sdnRequired?: boolean; gpuRequirements?: GpuRequirements; } /** * Memory requirement constraint */ export interface RequiresMemoryConstraint extends Constraint { type: ConstraintType.REQUIRES_MEMORY; minMemoryMb: number; } /** * GPU requirement constraint */ export interface RequiresGpuConstraint extends Constraint { type: ConstraintType.REQUIRES_GPU; requiredType?: string; requiredCount?: number; requiredMemoryMb?: number; } /** * CPU cores requirement constraint */ export interface RequiresCpuCoresConstraint extends Constraint { type: ConstraintType.REQUIRES_CPU_CORES; minCpuCores: number; } /** * CPU benchmark requirement constraint */ export interface CpuBenchmarkConstraint extends Constraint { type: ConstraintType.CPU_BENCHMARK; minSingleCoreBench?: number; minMultiCoreBench?: number; } /** * Job dependency constraint - requires prerequisite job to complete */ export interface AfterJobConstraint extends Constraint { type: ConstraintType.AFTER_JOB; prerequisiteJobName: string; prerequisiteType?: string; } /** * Job dependency constraint - must complete before dependent job starts */ export interface BeforeJobConstraint extends Constraint { type: ConstraintType.BEFORE_JOB; dependentJobName: string; dependentType?: string; } /** * Time-based scheduling constraint */ export interface AtTimeConstraint extends Constraint { type: ConstraintType.AT_TIME; scheduledTime: string; } /** * Union type for all constraint types */ export type AnyConstraint = ServerResourcesConstraint | RequiresMemoryConstraint | RequiresGpuConstraint | RequiresCpuCoresConstraint | CpuBenchmarkConstraint | AfterJobConstraint | BeforeJobConstraint | AtTimeConstraint; /** * ConstraintSet containing multiple constraints */ export interface ConstraintSet { constraints: AnyConstraint[]; } /** * Legacy JobConstraint interface (deprecated - use ConstraintSet) * @deprecated Use ConstraintSet instead */ export interface JobConstraint { type: LegacyConstraintType; properties?: { [key: string]: string; }; priority?: number; required?: boolean; description?: string; [key: string]: any; } /** * Legacy ConstraintType enum (deprecated - use new ConstraintType instead) * @deprecated Use ConstraintType instead */ export declare enum LegacyConstraintType { AFTER = "after", BEFORE = "before", AT = "at", REQUIRES = "requires" } /** * Response wrapper for API responses */ export interface Response { success: boolean; message?: string; data?: any; [key: string]: any; } /** * Multicloud REST API client */ export declare class MulticloudRestClient { private params; private debug; constructor(params: MulticloudConnectionParams, debug?: boolean); /** * Make an authenticated request to the Multicloud API */ private makeRequest; /** * Test connection to the Multicloud server */ testConnection(): Promise; /** * Health check endpoints */ /** * Application management endpoints */ getApplications(): Promise; getApplication(applicationId: string | number): Promise; createApplication(application: Partial): Promise; updateApplication(applicationId: string | number, application: Partial): Promise; deleteApplication(applicationId: string | number): Promise; getApplicationJobs(applicationId: string | number): Promise; getApplicationClusters(applicationId: string | number): Promise; /** * Customer-facing endpoints with limited field exposure */ /** * Health check endpoint for customer API * @returns */ pingCustomer(): Promise; getCustomerJobs(applicationId: string | number, clusterId?: string | number): Promise; getCustomerClusters(applicationId: string | number, clusterId?: string | number): Promise; getCustomerServers(applicationId: string | number, clusterId?: string | number): Promise; getCustomerTasks(applicationId: string | number, jobIds?: Set, clusterId?: string | number): Promise; /** * Customer-facing endpoint to get cluster locations (different from admin endpoint) */ getCustomerClusterLocations(applicationId: string | number, clusterId: string | number): Promise; /** * Customer-facing endpoint to add jobs to a cluster (different from coordinator endpoint) */ addCustomerJobs(jobDescs: Partial[], applicationId: string | number, clusterId: string | number): Promise; /** * Customer-facing endpoint to perform job actions (different from coordinator endpoint) */ customerJobAction(jobId: string | number, action: string, applicationId: string | number, clusterId: string | number, scaleBy?: number): Promise; /** * Job management endpoints */ getJobs(clusterId?: string | number): Promise; getJob(jobId: string | number): Promise; addJobs(jobs: Partial[], clusterId?: string | number): Promise; addJob(job: Partial): Promise; updateJob(jobId: string | number, job: Partial): Promise; jobAction(jobId: string | number, action: string, clusterId?: string | number, scaleBy?: number): Promise; deleteJob(jobId: string | number): Promise; getJobTasks(jobId: string | number): Promise; getJobByOwner(owner: string, jobId?: string): Promise; /** * Cluster management endpoints */ getClusters(): Promise; getCluster(clusterId: string | number): Promise; createCluster(cluster: Partial): Promise; addOrUpdateClusters(clusters: Partial[]): Promise; updateCluster(clusterId: string | number, cluster: Partial): Promise; deleteCluster(clusterId: string | number): Promise; getClusterJobs(clusterId: string | number): Promise; getClusterServers(clusterId: string | number): Promise; getClusterLocations(clusterId: string | number): Promise; /** * Server management endpoints */ getServers(clusterId?: string | number): Promise; getServer(clusterId: string | number, serverId: string | number): Promise; updateServer(serverId: string | number, server: Partial): Promise; deleteServer(serverId: string | number): Promise; getServerTasks(serverId: string | number): Promise; /** * Server resource offer endpoint (used by agents) */ offerResources(server: Partial): Promise; /** * Task management endpoints */ getTasks(clusterId?: string | number, jobId?: string | number): Promise; getTask(taskId: string | number): Promise; updateTask(task: Partial): Promise; deleteTask(taskId: string | number): Promise; getTasksByOwner(owner: string): Promise; restartJobTasks(jobId: string | number, clusterId?: string | number): Promise; restartTask(taskIds: number[]): Promise; /** * IP Lease management endpoints */ getIpLeases(subnetName?: string, serviceName?: string): Promise; getIpLease(subnetName: string, serviceName: string): Promise; createIpLease(ipLease: Partial): Promise; updateIpLease(subnetName: string, serviceName: string, ipLease: Partial): Promise; deleteIpLease(subnetName: string, serviceName: string): Promise; /** * Location management endpoints */ getLocations(): Promise; getLocation(locationId: string | number): Promise; /** * Cloud provider management endpoints */ getCloudProviders(): Promise; getCloudProvider(providerId: string | number): Promise; /** * Key pair management endpoints */ getKeyPairs(): Promise; getKeyPair(keyPairId: string | number): Promise; /** * Service management endpoints */ getServices(): Promise; getService(serviceId: string | number): Promise; /** * Volume management endpoints */ getVolumes(): Promise; getVolume(volumeId: string | number): Promise; /** * Property management endpoints */ getProperties(): Promise; getProperty(propertyId: string | number): Promise; /** * Unit management endpoints */ getUnits(): Promise; getUnit(unitId: string | number): Promise; /** * Route53 management endpoints */ getRoute53Records(): Promise; getRoute53Record(recordId: string | number): Promise; /** * Admin endpoints */ getAdminStats(): Promise; getAdminHealth(): Promise; getAdminMetrics(): Promise; /** * Catalog endpoints */ getCatalogServerTypes(): Promise; getCatalogServerType(serverTypeId: string | number): Promise; getCatalogProcessors(): Promise; getCatalogAccelerators(): Promise; } //# sourceMappingURL=client.d.ts.map