UNPKG

@hashgraph/solo

Version:

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

50 lines 2.5 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); } }; var K8ClientFactory_1; import { K8Client } from './k8-client.js'; import { inject, injectable } from 'tsyringe-neo'; import { InjectTokens } from '../../../core/dependency-injection/inject-tokens.js'; import { patchInject } from '../../../core/dependency-injection/container-helper.js'; let K8ClientFactory = K8ClientFactory_1 = class K8ClientFactory { kubectlInstallationDirectory; k8Clients = new Map(); constructor(kubectlInstallationDirectory) { this.kubectlInstallationDirectory = kubectlInstallationDirectory; this.kubectlInstallationDirectory = patchInject(kubectlInstallationDirectory, InjectTokens.KubectlInstallationDirectory, K8ClientFactory_1.name); } getK8(context) { if (!this.k8Clients.has(context)) { this.k8Clients.set(context, this.createK8Client(context)); } return this.k8Clients.get(context); } /** * Create a new k8Factory client for the given context * @param context - The context to create the k8Factory client for * @returns a new k8Factory client */ createK8Client(context) { return new K8Client(context, this.kubectlInstallationDirectory); } default() { return new K8Client(undefined, this.kubectlInstallationDirectory); } }; K8ClientFactory = K8ClientFactory_1 = __decorate([ injectable(), __param(0, inject(InjectTokens.KubectlInstallationDirectory)), __metadata("design:paramtypes", [String]) ], K8ClientFactory); export { K8ClientFactory }; //# sourceMappingURL=k8-client-factory.js.map