import * as plugins from './plugins.js'; export type TClientType = 'api' | 'ci' | 'coreflow' | 'cli' | 'serverconfig'; export interface ICloudlyApiClientTypedSocketOptions { autoReconnect?: boolean; maxRetries?: number; initialBackoffMs?: number; maxBackoffMs?: number; abortSignal?: AbortSignal; restoreConnection?: plugins.typedsocket.ITypedSocketClientOptions['restoreConnection']; } export interface ICloudlyApiClientOptions { registerAs: TClientType; cloudlyUrl?: string; typedSocketClientOptions?: ICloudlyApiClientTypedSocketOptions; } import { Image } from './classes.image.js'; import { Service } from './classes.service.js'; import { Cluster } from './classes.cluster.js'; import { SecretClient } from './classes.secret.js'; import { ExternalRegistry } from './classes.externalregistry.js'; import { Backup } from './classes.backup.js'; import { PrivateNetworkClient } from './classes.privatenetwork.js'; import { CloudlyProtocolIncompatibleError } from './protocol.js'; export declare class CloudlyApiClient { private cloudlyUrl; private registerAs; private typedSocketClientOptions?; private startPromise?; private stopPromise?; private socketAbortController?; private authenticationAbortController; private authenticationQueue; private lifecycleGeneration; private sessionCredential?; typedrouter: plugins.typedrequest.TypedRouter; typedsocketClient?: plugins.typedsocket.TypedSocket; /** * The refusal that ended this client's socket lifecycle with no caller to reject. * * A refusal met while a reconnect restores the session reaches no caller — the transport * publishes it only as the cause of its own denied restoration — so it is kept here until the * next `start()` opens a new socket lifetime. */ lastProtocolRefusal?: CloudlyProtocolIncompatibleError; secrets: SecretClient; readonly privateNetworks: PrivateNetworkClient; configUpdateSubject: plugins.smartrx.rxjs.Subject<{ configData: plugins.servezoneInterfaces.data.ICluster; services: plugins.servezoneInterfaces.data.IService[]; platformProviderConfigs?: plugins.servezoneInterfaces.platform.IPlatformProviderConfig[]; platformBindings?: plugins.servezoneInterfaces.platform.IPlatformBinding[]; corestoreCredentialPublicationGrants?: import("@serve.zone/interfaces/runtime").ICorestoreCredentialPublicationGrant[]; }>; constructor(optionsArg: ICloudlyApiClientOptions); requireTypedSocket(): plugins.typedsocket.TypedSocket; requireIdentity(): plugins.servezoneInterfaces.data.IIdentity; private get httpEndpoint(); private createWsRequest; private createHttpRequest; protected fireRequest(methodArg: T['method'], requestArg: T['request']): Promise; protected createIdentityCredential(identityArg: plugins.servezoneInterfaces.data.IIdentityCredential | undefined): plugins.servezoneInterfaces.data.IIdentityCredential; start(optionsArg?: ICloudlyApiClientTypedSocketOptions): Promise; private socketAbortCleanup?; stop(): Promise; private serializeAuthentication; private requireCurrentLifecycle; /** * End the socket lifecycle a restoration was refused in, then rethrow; other failures pass on. * * The transport ends its own client on a denied restoration and carries the refusal only as * that denial's cause; the session it carried is this class's. So this client releases the * socket it would otherwise hold dead — `start()` is a working recovery again and the refusal * stays readable here — and keeps the session credential, which that next start re-offers once * an operator upgraded a side. */ private endSocketLifecycleOnProtocolRefusal; /** The exact body a session registration sends, validated the way the wire validates it. */ private snapshotSessionRegistration; private registerSession; private acceptIdentity; identity?: plugins.servezoneInterfaces.data.IIdentity; /** Adopt an identity from an existing login or OIDC exchange. */ setIdentity(identityArg: plugins.servezoneInterfaces.data.IIdentity): Promise; /** Forget authentication immediately, then close the connection that held it. */ clearIdentity(): Promise; getIdentityByToken(token: string, optionsArg?: { tagConnection?: boolean; statefullIdentity?: boolean; }): Promise; /** * will use statefull identity by default */ getClusterConfigFromCloudlyByIdentity(identityArg?: plugins.servezoneInterfaces.data.IIdentityCredential): Promise; /** * gets a certificate for a domain used by a service */ getCertificateForDomain(optionsArg: { domainName: string; type: plugins.servezoneInterfaces.requests.certificate.IRequest_Any_Cloudly_GetCertificateForDomain['request']['type']; identity?: plugins.servezoneInterfaces.data.IIdentity; }): Promise; externalRegistry: { getRegistryById: (registryNameArg: string) => Promise; updateRegistry: (registryId: string, registryData: plugins.servezoneInterfaces.data.IExternalRegistry["data"]) => Promise<{ resultRegistry: plugins.servezoneInterfaces.data.IExternalRegistry; }>; deleteRegistry: (registryId: string) => Promise<{ ok: boolean; }>; getRegistries: () => Promise; createRegistry: (optionsArg: Parameters[1]) => Promise; verifyRegistry: (registryId: string) => Promise<{ success: boolean; message: string; registry?: ExternalRegistry; }>; }; loginWithUsernameAndPassword(username: string, password: string): Promise; reconcileBaseServices(): Promise; image: { getImageById: (imageIdArg: string) => Promise; getImages: () => Promise; createImage: (optionsArg: Parameters[1]) => Promise; deleteImage: (imageId: string) => Promise; }; services: { getServiceById: (serviceIdArg: string) => Promise; getServices: () => Promise; createService: (optionsArg: Parameters[1]) => Promise; getRegistryTarget: (serviceId: string, tag?: string) => Promise; updateService: (serviceId: string, serviceData: plugins.servezoneInterfaces.data.IService["data"]) => Promise<{ service: plugins.servezoneInterfaces.data.IService; }>; deleteService: (serviceId: string) => Promise; }; cluster: { getClusterById: (clusterIdArg: string) => Promise; getClusters: () => Promise; createCluster: (optionsArg: Parameters[1]) => Promise; createClusterAdvanced: (clusterName: string, setupMode?: "manual" | "hetzner" | "aws" | "digitalocean") => Promise<{ cluster: plugins.servezoneInterfaces.data.ICluster; }>; }; node: { getNodes: (optionsArg?: { clusterId?: string; }) => Promise; getNodeById: (nodeId: string) => Promise; getNodeDeletionImpact: (nodeId: string) => Promise; deleteNodeById: (nodeId: string) => Promise; createNodeJumpCommand: (optionsArg: { clusterId: string; role?: plugins.servezoneInterfaces.data.IClusterNode["data"]["role"]; nodeType?: plugins.servezoneInterfaces.data.IClusterNode["data"]["nodeType"]; ttlMs?: number; }) => Promise; }; platform: { getPlatformDesiredState: () => Promise<{ capabilities: plugins.servezoneInterfaces.platform.IPlatformCapability[]; providerConfigs: plugins.servezoneInterfaces.platform.IPlatformProviderConfig[]; bindings: plugins.servezoneInterfaces.platform.IPlatformBinding[]; }>; getPlatformCapabilities: () => Promise<{ capabilities: plugins.servezoneInterfaces.platform.IPlatformCapability[]; }>; getPlatformProviderConfigs: (capability?: plugins.servezoneInterfaces.platform.TPlatformCapability) => Promise<{ providerConfigs: plugins.servezoneInterfaces.platform.IPlatformProviderConfig[]; }>; upsertPlatformProviderConfig: (providerConfig: plugins.servezoneInterfaces.platform.IPlatformProviderConfig) => Promise<{ providerConfig: plugins.servezoneInterfaces.platform.IPlatformProviderConfig; }>; deletePlatformProviderConfigById: (providerConfigId: string) => Promise<{ success: boolean; }>; getPlatformBindings: (optionsArg?: { serviceId?: string; capability?: plugins.servezoneInterfaces.platform.TPlatformCapability; }) => Promise<{ bindings: plugins.servezoneInterfaces.platform.IPlatformBinding[]; }>; upsertPlatformBinding: (binding: plugins.servezoneInterfaces.platform.IPlatformBinding) => Promise<{ binding: plugins.servezoneInterfaces.platform.IPlatformBinding; }>; updatePlatformBindingStatus: (optionsArg: Omit) => Promise<{ binding: plugins.servezoneInterfaces.platform.IPlatformBinding; }>; deletePlatformBindingById: (bindingId: string) => Promise<{ success: boolean; }>; }; backup: { createServiceBackup: (optionsArg: Parameters[1]) => Promise; getServiceBackups: (optionsArg?: Parameters[1]) => Promise; getBackupById: (backupIdArg: string) => Promise; restoreServiceBackup: (optionsArg: Parameters[1]) => Promise; createIsolatedRestore: (optionsArg: Parameters[1]) => Promise<{ restore: plugins.servezoneInterfaces.data.IIsolatedRestoreRecord; }>; getIsolatedRestores: (optionsArg?: Parameters[1]) => Promise<{ restores: plugins.servezoneInterfaces.data.IIsolatedRestoreRecord[]; nextCursor?: string; }>; getIsolatedRestoreById: (restoreIdArg: string) => Promise<{ restore: plugins.servezoneInterfaces.data.IIsolatedRestoreRecord; }>; cleanupIsolatedRestore: (optionsArg: Parameters[1]) => Promise<{ restore: plugins.servezoneInterfaces.data.IIsolatedRestoreRecord; }>; }; settings: { getSettings: () => Promise<{ settings: plugins.servezoneInterfaces.data.ICloudlySettings; }>; updateSettings: (updates: Partial) => Promise<{ success: boolean; message: string; }>; testProviderConnection: (provider: string) => Promise<{ connectionValid: boolean; message: string; }>; }; tasks: { getTasks: () => Promise<{ tasks: Array<{ name: string; description: string; category: "maintenance" | "deployment" | "backup" | "monitoring" | "cleanup" | "system" | "security"; schedule?: string; lastRun?: number; enabled: boolean; }>; }>; getTaskExecutions: (filter?: any) => Promise<{ executions: plugins.servezoneInterfaces.data.ITaskExecution[]; }>; getTaskExecutionById: (executionId: string) => Promise<{ execution: plugins.servezoneInterfaces.data.ITaskExecution; }>; triggerTask: (taskName: string, userId?: string) => Promise<{ execution: plugins.servezoneInterfaces.data.ITaskExecution; }>; cancelTask: (executionId: string) => Promise<{ success: boolean; }>; }; domains: { getDomains: () => Promise<{ domains: plugins.servezoneInterfaces.data.IDomain[]; }>; getDomainById: (domainId: string) => Promise<{ domain: plugins.servezoneInterfaces.data.IDomain; }>; createDomain: (domainData: plugins.servezoneInterfaces.data.IDomain["data"]) => Promise<{ domain: plugins.servezoneInterfaces.data.IDomain; }>; updateDomain: (domainId: string, domainData: Partial) => Promise<{ domain: plugins.servezoneInterfaces.data.IDomain; }>; deleteDomain: (domainId: string) => Promise<{ success: boolean; }>; verifyDomain: (domainId: string, verificationMethod?: "dns" | "http" | "email" | "manual") => Promise<{ domain: plugins.servezoneInterfaces.data.IDomain; verificationResult: any; }>; }; dns: { getDnsEntries: (zone?: string) => Promise<{ dnsEntries: plugins.servezoneInterfaces.data.IDnsEntry[]; }>; getDnsEntryById: (dnsEntryId: string) => Promise<{ dnsEntry: plugins.servezoneInterfaces.data.IDnsEntry; }>; createDnsEntry: (dnsEntryData: plugins.servezoneInterfaces.data.IDnsEntry["data"]) => Promise<{ dnsEntry: plugins.servezoneInterfaces.data.IDnsEntry; }>; updateDnsEntry: (dnsEntryId: string, dnsEntryData: plugins.servezoneInterfaces.data.IDnsEntry["data"]) => Promise<{ dnsEntry: plugins.servezoneInterfaces.data.IDnsEntry; }>; deleteDnsEntry: (dnsEntryId: string) => Promise<{ success: boolean; }>; getDnsZones: () => Promise<{ zones: string[]; }>; }; deployments: { getDeployments: (optionsArg?: { includeArchived?: boolean; }) => Promise<{ deployments: plugins.servezoneInterfaces.data.IDeployment[]; }>; getDeploymentById: (deploymentId: string) => Promise<{ deployment: plugins.servezoneInterfaces.data.IDeployment; }>; createDeployment: (deploymentData: Partial) => Promise<{ deployment: plugins.servezoneInterfaces.data.IDeployment; }>; updateDeployment: (deploymentId: string, deploymentData: Partial) => Promise<{ deployment: plugins.servezoneInterfaces.data.IDeployment; }>; deleteDeployment: (deploymentId: string) => Promise<{ success: boolean; }>; restartDeployment: (deploymentId: string) => Promise<{ success: boolean; deployment: plugins.servezoneInterfaces.data.IDeployment; }>; killDeployment: (deploymentId: string) => Promise<{ success: boolean; deployment: plugins.servezoneInterfaces.data.IDeployment; }>; scaleDeployment: (deploymentId: string, replicas: number) => Promise<{ success: boolean; deployment: plugins.servezoneInterfaces.data.IDeployment; }>; }; }