UNPKG

@hashgraph/solo

Version:

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

102 lines (101 loc) 4.84 kB
import { type ConfigManager } from './config_manager.js'; import { type SoloLogger } from './logging.js'; import { type AnyObject, type DirPath, type NodeAlias, type NodeAliases } from '../types/aliases.js'; import { type ConsensusNode } from './model/consensus_node.js'; import { type K8Factory } from './kube/k8_factory.js'; export declare class ProfileManager { private readonly logger; private readonly configManager; private readonly cacheDir; private readonly k8Factory; private profiles; private profileFile; constructor(logger?: SoloLogger, configManager?: ConfigManager, cacheDir?: DirPath, k8Factory?: K8Factory); /** * Load profiles from a profile file and populate the profiles map. * * @param [forceReload = false] - forces the profiles map to override even if it exists. * @returns reference to the populated profiles map. * * @throws {IllegalArgumentError} if the profile file is not found. */ loadProfiles(forceReload?: boolean): Map<string, AnyObject>; /** * Get profile from the profiles map, loads them on demand if they are not loaded already. * * @param profileName - profile name (key in the map). * @returns the profile. * * @throws {IllegalArgumentError} if profiles can't be loaded or the profile name is not found in the map. */ getProfile(profileName: string): AnyObject; /** * Set value in the YAML object * @param itemPath - item path in the yaml * @param value - value to be set * @param yamlRoot - root of the YAML object * @returns */ _setValue(itemPath: string, value: any, yamlRoot: AnyObject): AnyObject; /** * Set items for the chart * @param itemPath - item path in the YAML, if empty then root of the YAML object will be used * @param items - the element object * @param yamlRoot - root of the YAML object to update * @private */ _setChartItems(itemPath: string, items: any, yamlRoot: AnyObject): void; resourcesForConsensusPod(profile: AnyObject, consensusNodes: ConsensusNode[], nodeAliases: NodeAliases, yamlRoot: AnyObject): Promise<AnyObject>; private resourcesForHaProxyPod; private resourcesForEnvoyProxyPod; private resourcesForHederaExplorerPod; private resourcesForMinioTenantPod; /** * Prepare a values file for Solo Helm chart * @param profileName - resource profile name * @param consensusNodes - the list of consensus nodes * @returns return the full path to the values file */ prepareValuesForSoloChart(profileName: string, consensusNodes: ConsensusNode[]): Promise<string>; private bumpHederaConfigVersion; prepareValuesForNodeAdd(configTxtPath: string, applicationPropertiesPath: string): Promise<string>; /** * Prepare a values file for rpc-relay Helm chart * @param profileName - resource profile name * @returns return the full path to the values file */ prepareValuesForRpcRelayChart(profileName: string): Promise<string | void>; prepareValuesHederaExplorerChart(profileName: string): Promise<string>; /** * Writes the YAML to file. * * @param cachedValuesFile - the target file to write the YAML root to. * @param yamlRoot - object to turn into YAML and write to file. */ private writeToYaml; /** * Prepare a values file for mirror-node Helm chart * @param profileName - resource profile name * @returns the full path to the values file */ prepareValuesForMirrorNodeChart(profileName: string): Promise<string | void>; /** * Writes the contents of a file as a value for the given nested item path in the YAML object * @param itemPath - nested item path in the YAML object to store the file contents * @param valueFilePath - path to the file whose contents will be stored in the YAML object * @param yamlRoot - root of the YAML object */ private _setFileContentsAsValue; /** * Prepares config.txt file for the node * @param nodeAccountMap - the map of node aliases to account IDs * @param consensusNodes - the list of consensus nodes * @param destPath - path to the destination directory to write the config.txt file * @param releaseTagOverride - release tag override * @param [appName] - the app name (default: HederaNode.jar) * @param [chainId] - chain ID (298 for local network) * @param [loadBalancerEnabled] - whether the load balancer is enabled (flag is not set by default) * @returns the config.txt file path */ prepareConfigTxt(nodeAccountMap: Map<NodeAlias, string>, consensusNodes: ConsensusNode[], destPath: string, releaseTagOverride: string, appName?: string, chainId?: string, loadBalancerEnabled?: boolean): Promise<string>; }