UNPKG

@apigeeks/fbl-k8s-plugin

Version:

fbl wrapper plugin for helm and kubectl cli utilities

62 lines 2.77 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const Joi = require("joi"); const typedi_1 = require("typedi"); const fbl_1 = require("fbl"); const services_1 = require("../../services"); class K8sHelmDescribeHandler extends fbl_1.ActionHandler { /* istanbul ignore next */ getMetadata() { return K8sHelmDescribeHandler.metadata; } getValidationSchema() { return K8sHelmDescribeHandler.schema; } execute(options, context, snapshot, parameters) { return __awaiter(this, void 0, void 0, function* () { /* istanbul ignore else */ if (options.chart) { const deployment = yield typedi_1.Container.get(services_1.K8sHelmService).getHelmDeployment(options.name); yield fbl_1.ContextUtil.assignTo(context, parameters, snapshot, options.chart.assignTo, deployment); yield fbl_1.ContextUtil.pushTo(context, parameters, snapshot, options.chart.pushTo, deployment); } /* istanbul ignore else */ if (options.objects) { const helmObjects = yield typedi_1.Container.get(services_1.K8sHelmService).getHelmObjects(options.name); yield fbl_1.ContextUtil.assignTo(context, parameters, snapshot, options.objects.assignTo, helmObjects); yield fbl_1.ContextUtil.pushTo(context, parameters, snapshot, options.objects.pushTo, helmObjects); } }); } } K8sHelmDescribeHandler.metadata = { id: 'a6s.k8s.helm.describe', aliases: ['k8s.helm.describe', 'helm.describe'], }; K8sHelmDescribeHandler.schema = Joi.object({ name: Joi.string() .min(1) .required(), chart: Joi.object({ assignTo: fbl_1.FBL_ASSIGN_TO_SCHEMA, pushTo: fbl_1.FBL_PUSH_TO_SCHEMA, }).or('assignTo', 'pushTo'), objects: Joi.object({ assignTo: fbl_1.FBL_ASSIGN_TO_SCHEMA, pushTo: fbl_1.FBL_PUSH_TO_SCHEMA, }).or('assignTo', 'pushTo'), }) .required() .options({ allowUnknown: true, }); exports.K8sHelmDescribeHandler = K8sHelmDescribeHandler; //# sourceMappingURL=K8sHelmDescribeHandler.js.map