UNPKG

@hashgraph/solo

Version:

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

58 lines (57 loc) 2.74 kB
import { type ConfigManager } from './config-manager.js'; import { type K8Factory } from '../integration/kube/k8-factory.js'; import { type SoloLogger } from './logging/solo-logger.js'; import { AnyListrContext } from '../types/aliases.js'; import { SoloListr, type SoloListrTaskWrapper } from '../types/index.js'; /** * 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: SoloListrTaskWrapper<any>, grpcTlsCertificatePathsUnparsed: string, grpcWebTlsCertificatePathsUnparsed: string, grpcTlsKeyPathsUnparsed: string, grpcWebTlsKeyPathsUnparsed: string): SoloListr<AnyListrContext>; /** * 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; }