UNPKG

@multicloud-io/multicloud-connection-js

Version:

Shared TypeScript/JavaScript library for connecting to Multicloud servers with mTLS authentication

82 lines 3.58 kB
/** * Multicloud Connection Library * * A comprehensive TypeScript/JavaScript library for connecting to Multicloud servers * with mTLS authentication, configuration management, and full REST API support. * * IMPORTANT: This library is designed for server-side use only. * Never expose Multicloud credentials or use this library in client/browser environments. * * @example * ```typescript * import { MulticloudConfig, MulticloudRESTClient } from '@multicloud/connection-js'; * * // Basic usage with default configuration * const params = MulticloudConfig.getConnectionParams(); * const client = new MulticloudRESTClient(params); * const clusters = await client.getClusters(); * * // Usage with custom configuration * const params = MulticloudConfig.getConnectionParams( * { debug: true }, * { envPrefix: 'MY_APP_MULTICLOUD_' } * ); * const client = new MulticloudRESTClient(params); * ``` * * @example * ```typescript * // Check if multicloud is enabled before using * if (MulticloudConfig.isEnabled()) { * const params = MulticloudConfig.getConnectionParams(); * const client = new MulticloudRESTClient(params); * // Use client... * } else { * // Use fallback/mock data * } * ``` */ export { MulticloudConfig, type MulticloudConnectionParams, type MulticloudConfigOptions } from './config'; export { MulticloudRestClient, type Cluster, type Job, type Server, type Service, type ConstraintSet, type JobLocationRule, type Task, TaskStatus, type Upstream, type IpLease, type IpLeaseMetadata, type Response, type ServerStatus, type ServerTypeSpec, type MetaLocation, type CloudProvider, type KeyPair, type VolumeDesc, type VolumeDescAccessMode, type VolumeDescSyncMode, type ProcessorSpec, type ProcessorArchitecture, type VolumeSpec, type AcceleratorSpec, type TaskAssignment, type TaskAssignmentType, type GetTaskRequest, type Property, type Unit, type PortPermission, type Route53, type ServerTemplate, type Alloc, type Constraint, type ConstraintType, type AnyConstraint, type Application, type Dns, State, Orchestration, ExtendedLocationRuleType } from './client'; export { MulticloudConnectionError, MulticloudAuthenticationError, MulticloudConfigurationError, MulticloudNetworkError, MulticloudResponseError } from './exceptions'; import { type MulticloudConnectionParams, type MulticloudConfigOptions } from './config'; import { MulticloudRestClient } from './client'; /** * Library version */ export declare const version = "1.0.0"; /** * Quick utility to create a configured Multicloud client * * @param overrides Connection parameter overrides * @param options Configuration options * @returns Configured MulticloudRESTClient instance * * @example * ```typescript * import { createMulticloudClient } from '@multicloud/connection-js'; * * const client = createMulticloudClient({ debug: true }); * const clusters = await client.getClusters(); * ``` */ export declare function createMulticloudClient(overrides?: Partial<MulticloudConnectionParams>, options?: MulticloudConfigOptions): MulticloudRestClient; /** * Quick utility to check if Multicloud is properly configured * * @param options Configuration options * @returns True if multicloud is enabled and configured * * @example * ```typescript * import { isMulticloudEnabled } from '@multicloud/connection-js'; * * if (isMulticloudEnabled()) { * // Use multicloud * } else { * // Use fallback * } * ``` */ export declare function isMulticloudEnabled(options?: MulticloudConfigOptions): boolean; //# sourceMappingURL=index.d.ts.map