UNPKG

@hashgraph/solo

Version:

An opinionated CLI tool to deploy and manage private Hedera Networks.

120 lines (98 loc) 3.82 kB
// SPDX-License-Identifier: Apache-2.0 import {type HelmClient} from '../helm-client.js'; import {type HelmClientBuilder} from '../helm-client-builder.js'; import {DefaultHelmClient} from './default-helm-client.js'; /** * The default implementation of the HelmClientBuilder interface. */ export class DefaultHelmClientBuilder implements HelmClientBuilder { /** * The default namespace to be set by the HelmClient. Defaults to a null value which indicates that * the Helm -n <namespace> argument should not be specified. */ private _defaultNamespace?: string; /** * The working directory to be used by the HelmClient. */ private _workingDirectory?: string; /** * The kubernetes API server address and port number to which the client should connect. Defaults to a null * value which indicates that the Helm --kube-apiserver <address_and_port> argument should not be specified. */ private _kubeApiServer?: string; /** * The kubernetes CA certificate file. Defaults to a null value which indicates that the Helm * --kube-ca-file <ca_file> argument should not be specified. */ private _kubeCAFile?: string; /** * The kubernetes context from the kube config file to be used. Defaults to a null value which indicates * that the Helm --kube-context <context> argument should not be specified. */ private _kubeContext?: string; /** * Specifies whether the Helm client should skip TLS certificate verification. Defaults to a null value * which indicates that the Helm --kube-insecure-skip-tls-verify <bool> argument should not be specified. */ private _kubeSkipTlsVerification?: boolean; /** * The kubernetes server name to use for TLS server certificate validation. Defaults to a null value * which indicates that the Helm --kube-tls-server-name <name> argument should not be specified. */ private _kubeTlsServerName?: string; /** * The kubernetes bearer token to be used for authentication. Defaults to a null values which indicates that * the Helm --kube-token <token> argument should not be specified. */ private _kubeToken?: string; /** * The path to the kube config file. Defaults to a null value which indicates that the Helm * --kubeconfig <context> argument should not be specified. */ private _kubeConfig?: string; /** * Constructs a new builder instance and initializes it with the default configuration. */ public constructor() {} public defaultNamespace(namespace: string): HelmClientBuilder { this._defaultNamespace = namespace; return this; } public workingDirectory(workingDirectory: string): HelmClientBuilder { this._workingDirectory = workingDirectory; return this; } public kubeApiServer(kubeApiServer: string): HelmClientBuilder { this._kubeApiServer = kubeApiServer; return this; } public kubeCAFile(kubeCAFile: string): HelmClientBuilder { this._kubeCAFile = kubeCAFile; return this; } public kubeContext(kubeContext: string): HelmClientBuilder { this._kubeContext = kubeContext; return this; } public kubeSkipTlsVerification(kubeSkipTlsVerification: boolean): HelmClientBuilder { this._kubeSkipTlsVerification = kubeSkipTlsVerification; return this; } public kubeTlsServerName(kubeTlsServerName: string): HelmClientBuilder { this._kubeTlsServerName = kubeTlsServerName; return this; } public kubeToken(kubeToken: string): HelmClientBuilder { this._kubeToken = kubeToken; return this; } public kubeConfig(kubeConfig: string): HelmClientBuilder { this._kubeConfig = kubeConfig; return this; } public async build(): Promise<HelmClient> { const client: DefaultHelmClient = new DefaultHelmClient(); await client.version(); return client; } }