UNPKG

@hashgraph/solo

Version:

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

62 lines (61 loc) 4.35 kB
import { ComponentTypes } from './enumerations/component-types.js'; import { BaseStateSchema } from '../../../data/schema/model/remote/state/base-state-schema.js'; import { type DeploymentPhase } from '../../../data/schema/model/remote/deployment-phase.js'; import { type ClusterReferenceName, type ComponentId } from '../../../types/index.js'; import { type ComponentsDataWrapperApi } from './api/components-data-wrapper-api.js'; import { type DeploymentStateSchema } from '../../../data/schema/model/remote/deployment-state-schema.js'; import { type ComponentIdsStructure } from '../../../data/schema/model/remote/interfaces/components-ids-structure.js'; import { type PodReference } from '../../../integration/kube/resources/pod/pod-reference.js'; import { type K8 } from '../../../integration/kube/k8.js'; import { type SoloLogger } from '../../logging/solo-logger.js'; export declare class ComponentsDataWrapper implements ComponentsDataWrapperApi { state: DeploymentStateSchema; constructor(state: DeploymentStateSchema); get componentIds(): ComponentIdsStructure; /** Used to add new component to their respective group. */ addNewComponent(component: BaseStateSchema, type: ComponentTypes, isReplace?: boolean, skipIncrement?: boolean): void; changeNodePhase(componentId: ComponentId, phase: DeploymentPhase): void; changeComponentPhase(componentId: ComponentId, type: ComponentTypes, phase: DeploymentPhase): void; /** Used to remove specific component from their respective group. */ removeComponent(componentId: ComponentId, type: ComponentTypes): void; getComponent<T extends BaseStateSchema>(type: ComponentTypes, componentId: ComponentId): T; getComponentByType<T extends BaseStateSchema>(type: ComponentTypes): T[]; getComponentsByClusterReference<T extends BaseStateSchema>(type: ComponentTypes, clusterReference: ClusterReferenceName): T[]; getComponentById<T extends BaseStateSchema>(type: ComponentTypes, id: number): T; /** * Method used to map the type to the specific component group * and pass it to a callback to apply modifications */ private applyCallbackToComponentGroup; /** checks if component exists in the respective group */ private checkComponentExists; getNewComponentId(componentType: ComponentTypes): number; /** * Manages port forwarding for a component, checking if it's already enabled and persisting configuration * @param clusterReference The cluster reference to forward to * @param podReference The pod reference to forward to * @param podPort The port on the pod to forward from * @param localPort The local port to forward to (starting port if not available) * @param k8Client The Kubernetes client to use for port forwarding * @param logger Logger for messages * @param componentType The component type for persistence * @param label Label for the port forward * @param reuse Whether to reuse existing port forward if available * @param nodeId Optional node ID for finding component when cluster reference is not available * @returns The local port number that was used for port forwarding */ managePortForward(clusterReference: ClusterReferenceName, podReference: PodReference, podPort: number, localPort: number, k8Client: K8, logger: SoloLogger, componentType: ComponentTypes, label: string, reuse?: boolean, nodeId?: number, persist?: boolean, externalAddress?: string): Promise<number>; /** * Stops port forwarding for a component by removing the configuration and stopping the forward * @param clusterReference The cluster reference * @param podReference The pod reference * @param podPort The port on the pod * @param localPort The local port * @param k8Client The Kubernetes client to use for stopping port forwarding * @param logger Logger for messages * @param componentType The component type * @param label Label for the port forward * @param nodeId Optional node ID for finding component when cluster reference is not available */ stopPortForwards(clusterReference: ClusterReferenceName, podReference: PodReference, podPort: number, localPort: number, k8Client: K8, logger: SoloLogger, componentType: ComponentTypes, label: string, nodeId?: number): Promise<void>; }