@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
72 lines • 6.56 kB
JavaScript
// 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 ClusterReferenceCommandDefinition_1;
import { inject, injectable } from 'tsyringe-neo';
import { InjectTokens } from '../../core/dependency-injection/inject-tokens.js';
import { patchInject } from '../../core/dependency-injection/container-helper.js';
import { BaseCommandDefinition } from './base-command-definition.js';
import { CommandBuilder, CommandGroup, Subcommand } from '../../core/command-path-builders/command-builder.js';
import * as ContextFlags from '../cluster/flags.js';
import { ClusterCommand } from '../cluster/index.js';
import * as constants from '../../core/constants.js';
let ClusterReferenceCommandDefinition = class ClusterReferenceCommandDefinition extends BaseCommandDefinition {
static { ClusterReferenceCommandDefinition_1 = this; }
logger;
clusterCommand;
constructor(logger, clusterCommand) {
super();
this.logger = logger;
this.clusterCommand = clusterCommand;
this.clusterCommand = patchInject(clusterCommand, InjectTokens.ClusterCommand, this.constructor.name);
this.logger = patchInject(logger, InjectTokens.SoloLogger, this.constructor.name);
}
static COMMAND_NAME = 'cluster-ref';
static DESCRIPTION = 'Manages the relationship between Kubernetes context names and ' +
'Solo cluster references which are an alias for a kubernetes context.';
static CONFIG_SUBCOMMAND_NAME = 'config';
static CONFIG_SUBCOMMAND_DESCRIPTION = 'List, create, manage, and remove associations between Kubernetes contexts and Solo cluster references.';
static CONFIG_CONNECT = 'connect';
static CONFIG_DISCONNECT = 'disconnect';
static CONFIG_LIST = 'list';
static CONFIG_INFO = 'info';
static CONFIG_SETUP = 'setup';
static CONFIG_RESET = 'reset';
static CONNECT_COMMAND = `${ClusterReferenceCommandDefinition_1.COMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_SUBCOMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_CONNECT}`;
static SETUP_COMMAND = `${ClusterReferenceCommandDefinition_1.COMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_SUBCOMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_SETUP}`;
static RESET_COMMAND = `${ClusterReferenceCommandDefinition_1.COMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_SUBCOMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_RESET}`;
static DISCONNECT_COMMAND = `${ClusterReferenceCommandDefinition_1.COMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_SUBCOMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_DISCONNECT}`;
static LIST_COMMAND = `${ClusterReferenceCommandDefinition_1.COMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_SUBCOMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_LIST}`;
static INFO_COMMAND = `${ClusterReferenceCommandDefinition_1.COMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_SUBCOMMAND_NAME} ${ClusterReferenceCommandDefinition_1.CONFIG_INFO}`;
getCommandDefinition() {
return new CommandBuilder(ClusterReferenceCommandDefinition_1.COMMAND_NAME, ClusterReferenceCommandDefinition_1.DESCRIPTION, this.logger)
.addCommandGroup(new CommandGroup(ClusterReferenceCommandDefinition_1.CONFIG_SUBCOMMAND_NAME, ClusterReferenceCommandDefinition_1.CONFIG_SUBCOMMAND_DESCRIPTION)
.addSubcommand(new Subcommand(ClusterReferenceCommandDefinition_1.CONFIG_CONNECT, 'Creates a new internal Solo cluster name to a Kubernetes context or maps a Kubernetes context to an existing internal Solo cluster reference', this.clusterCommand.handlers, this.clusterCommand.handlers.connect, ContextFlags.CONNECT_FLAGS, []))
.addSubcommand(new Subcommand(ClusterReferenceCommandDefinition_1.CONFIG_DISCONNECT, 'Removes the Kubernetes context associated with an internal Solo cluster reference.', this.clusterCommand.handlers, this.clusterCommand.handlers.disconnect, ContextFlags.DEFAULT_FLAGS, []))
.addSubcommand(new Subcommand(ClusterReferenceCommandDefinition_1.CONFIG_LIST, 'Lists the configured Kubernetes context to Solo cluster reference mappings.', this.clusterCommand.handlers, this.clusterCommand.handlers.list, ContextFlags.NO_FLAGS, []))
.addSubcommand(new Subcommand(ClusterReferenceCommandDefinition_1.CONFIG_INFO, 'Displays the status information and attached deployments for a given Solo cluster reference mapping.', this.clusterCommand.handlers, this.clusterCommand.handlers.info, ContextFlags.DEFAULT_FLAGS, []))
// TODO: remove once command is merged in 'consensus network deploy'
.addSubcommand(new Subcommand(ClusterReferenceCommandDefinition_1.CONFIG_SETUP, 'Setup cluster with shared components', this.clusterCommand.handlers, this.clusterCommand.handlers.setup, ContextFlags.SETUP_FLAGS, [...constants.BASE_DEPENDENCIES]))
// TODO: remove once command is merged in 'consensus network destroy'
.addSubcommand(new Subcommand(ClusterReferenceCommandDefinition_1.CONFIG_RESET, 'Uninstall shared components from cluster', this.clusterCommand.handlers, this.clusterCommand.handlers.reset, ContextFlags.RESET_FLAGS, [...constants.BASE_DEPENDENCIES])))
.build();
}
};
ClusterReferenceCommandDefinition = ClusterReferenceCommandDefinition_1 = __decorate([
injectable(),
__param(0, inject(InjectTokens.SoloLogger)),
__param(1, inject(InjectTokens.ClusterCommand)),
__metadata("design:paramtypes", [Object, ClusterCommand])
], ClusterReferenceCommandDefinition);
export { ClusterReferenceCommandDefinition };
//# sourceMappingURL=cluster-reference-command-definition.js.map