@kubernetes/client-node
Version:
NodeJS client for kubernetes
80 lines (79 loc) • 3.14 kB
TypeScript
import https from 'node:https';
import { RequestInit } from 'node-fetch';
import { RequestContext } from './api.js';
import { Authenticator } from './auth.js';
import { Cluster, ConfigOptions, Context, User } from './config_types.js';
import { Configuration, SecurityAuthentication } from './gen/index.js';
import WebSocket from 'isomorphic-ws';
export interface ApiType {
}
export declare class KubeConfig implements SecurityAuthentication {
private static authenticators;
private custom_authenticators;
addAuthenticator(authenticator: Authenticator): void;
/**
* The list of all known clusters
*/
'clusters': Cluster[];
/**
* The list of all known users
*/
'users': User[];
/**
* The list of all known contexts
*/
'contexts': Context[];
/**
* The name of the current context
*/
'currentContext': string;
constructor();
getContexts(): Context[];
getClusters(): Cluster[];
getUsers(): User[];
getCurrentContext(): string;
setCurrentContext(context: string): void;
getContextObject(name: string): Context | null;
getCurrentCluster(): Cluster | null;
getCluster(name: string): Cluster | null;
getCurrentUser(): User | null;
getUser(name: string): User | null;
loadFromFile(file: string, opts?: Partial<ConfigOptions>): void;
applyToFetchOptions(opts: https.RequestOptions): Promise<RequestInit>;
applyToHTTPSOptions(opts: https.RequestOptions | WebSocket.ClientOptions): Promise<void>;
/**
* Applies SecurityAuthentication to RequestContext of an API Call from API Client
* @param context
*/
applySecurityAuthentication(context: RequestContext): Promise<void>;
/**
* Returns name of this security authentication method
* @returns string
*/
getName(): string;
loadFromString(config: string, opts?: Partial<ConfigOptions>): void;
loadFromOptions(options: any): void;
loadFromClusterAndUser(cluster: Cluster, user: User): void;
loadFromCluster(pathPrefix?: string): void;
mergeConfig(config: KubeConfig, preserveContext?: boolean): void;
addCluster(cluster: Cluster): void;
addUser(user: User): void;
addContext(ctx: Context): void;
loadFromDefault(opts?: Partial<ConfigOptions>, contextFromStartingConfig?: boolean, platform?: string): void;
makeApiClient<T extends ApiType>(apiClientType: ApiConstructor<T>): T;
makePathsAbsolute(rootDirectory: string): void;
exportConfig(): string;
private getCurrentContextObject;
private createAgent;
private applyHTTPSOptions;
private applyAuthorizationHeader;
private applyOptions;
}
export type ApiConstructor<T extends ApiType> = new (config: Configuration) => T;
export declare function makeAbsolutePath(root: string, file: string): string;
export declare function bufferFromFileOrString(file?: string, data?: string): Buffer | null;
export declare function findHomeDir(platform?: string): string | null;
export interface Named {
name: string;
}
export declare function findObject<T extends Named>(list: T[], name: string, key: string): T | null;