UNPKG

@hashgraph/solo

Version:

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

52 lines 2.69 kB
// SPDX-License-Identifier: Apache-2.0 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; import { inject } from 'tsyringe-neo'; import { InjectTokens } from '../../core/dependency-injection/inject-tokens.js'; import { patchInject } from '../../core/dependency-injection/container-helper.js'; import { ContainerReference } from '../../integration/kube/resources/container/container-reference.js'; import * as constants from '../../core/constants.js'; import { Templates } from '../../core/templates.js'; let K8Helper = class K8Helper { k8; constructor(context, k8Factory) { k8Factory = patchInject(k8Factory, InjectTokens.K8Factory, this.constructor.name); this.k8 = k8Factory.getK8(context); } async getConsensusNodeRootContainer(namespace, nodeAlias) { return await this.getConsensusNodePodReference(namespace, nodeAlias) .then((pod) => ContainerReference.of(pod, constants.ROOT_CONTAINER)) .then((containerReference) => this.k8.containers().readByRef(containerReference)); } async getConsensusNodePod(namespace, nodeAlias) { return await this.k8 .pods() .list(namespace, Templates.renderNodeLabelsFromNodeAlias(nodeAlias)) .then((pods) => pods[0]); } async getConsensusNodePodReference(namespace, nodeAlias) { return await this.getConsensusNodePod(namespace, nodeAlias).then((pod) => pod.podReference); } async getBlockNodePod(namespace, id) { return this.k8 .pods() .list(namespace, Templates.renderBlockNodeLabels(id)) .then((pods) => pods[0]); } }; K8Helper = __decorate([ __param(1, inject(InjectTokens.K8Factory)), __metadata("design:paramtypes", [String, Object]) ], K8Helper); export { K8Helper }; //# sourceMappingURL=k8-helper.js.map