@zowe/imperative
Version:
framework for building configurable CLIs
44 lines • 1.6 kB
JavaScript
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthCommandBuilder = void 0;
const error_1 = require("../../../../error");
/**
* Abstract class for generating auth-related commands
*/
class AuthCommandBuilder {
/**
* Construct the builder based on the auth config.
* @param mProfileType - the profile name of the profile type e.g. banana
* @param {Logger} mLogger - logger instance to use for the builder class
* @param {IImperativeAuthConfig} mAuthConfig - the config for the auth type
*/
constructor(mProfileType, mLogger, mAuthConfig) {
this.mProfileType = mProfileType;
this.mLogger = mLogger;
this.mAuthConfig = mAuthConfig;
this.mConfig = mAuthConfig;
if (this.mConfig == null) {
throw new error_1.ImperativeError({ msg: `Auth Builder Error: No auth config was supplied.` });
}
}
/**
* Only constructs the "group" command segment for the document. Use this if the command definition
* document already includes an auth verb.
* @return {ICommandDefinition}
*/
build() {
return this.buildAuthSegmentFromConfig();
}
}
exports.AuthCommandBuilder = AuthCommandBuilder;
//# sourceMappingURL=AuthCommandBuilder.js.map
;