UNPKG

@hashgraph/solo

Version:

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

57 lines (56 loc) 2.65 kB
import { type ConfigManager } from './config_manager.js'; import { type K8Factory } from './kube/k8_factory.js'; import { type SoloLogger } from './logging.js'; import { type ListrTaskWrapper } from 'listr2'; /** * Used to handle interactions with certificates data and inject it into the K8s cluster secrets */ export declare class CertificateManager { private readonly k8Factory?; private readonly logger?; private readonly configManager?; constructor(k8Factory?: K8Factory, logger?: SoloLogger, configManager?: ConfigManager); /** * Reads the certificate and key and build the secret with the appropriate structure * * @param cert - file path to the certificate file * @param key - file path to the key file * @param type - the certificate type if it's for gRPC or gRPC Web * * @returns the secret */ private buildSecret; /** * Copies the TLS Certificates into K8s namespaced secret. * * @param nodeAlias - the alias of the node to which the TLS certificate should apply * @param cert - file path to the certificate file * @param key - file path to the key file * @param type - the certificate type if it's for gRPC or gRPC Web */ private copyTlsCertificate; /** * Creates sub-tasks for copying the TLS Certificates into K8s secrets for gRPC and gRPC Web * * @param task - Listr Task to which to attach the sub-tasks * @param grpcTlsCertificatePathsUnparsed - the unparsed (alias=path)[] for the gRPC Certificate * @param grpcWebTlsCertificatePathsUnparsed - the unparsed (alias=path)[] for the gRPC Web Certificate * @param grpcTlsKeyPathsUnparsed - the unparsed (alias=path)[] for the gRPC Certificate Key * @param grpcWebTlsKeyPathsUnparsed - the unparsed (alias=path)[] for the gRPC Web Certificate Key * * @returns the build sub-tasks for creating the secrets */ buildCopyTlsCertificatesTasks(task: ListrTaskWrapper<any, any, any>, grpcTlsCertificatePathsUnparsed: string, grpcWebTlsCertificatePathsUnparsed: string, grpcTlsKeyPathsUnparsed: string, grpcWebTlsKeyPathsUnparsed: string): import("listr2").Listr<any, any, any>; /** * Handles parsing the unparsed data validating it follows the structure * * @param input - the unparsed data ( ex. node0=/usr/bob/grpc-web.cert ) * @param type - of the data being parsed for the error logging * * @returns an array of parsed data with node alias and the path * * @throws SoloError - if the data doesn't follow the structure */ private parseAndValidate; private getNamespace; }