@broadcom/endevor-bridge-for-git-for-zowe-cli
Version:
Endevor Bridge for Git plug-in for Zowe CLI
71 lines (70 loc) • 2.96 kB
TypeScript
import { AbstractSession, ICommandArguments, ICommandHandler, ICommandOptionDefinition, IHandlerFormatOutputApi, IHandlerParameters, IHandlerProgressApi, IHandlerResponseConsoleApi, IHandlerResponseDataApi, IImperativeError } from "@zowe/imperative";
import { EBGRestService } from "@broadcom/endevor-bridge-for-git-rest-api";
/**
* This class is used by the various handlers in the project as the base class for their implementation.
*/
export declare abstract class BaseHandler implements ICommandHandler {
/**
* Full set of command handler parameters from imperative
*/
protected params: IHandlerParameters;
protected ebgService: EBGRestService;
private optionValidator;
private optionUtils;
private endevorProfileUtils;
private zosmfProfileUtils;
private endevorProfile;
private zosmfProfile;
private baseProfile;
/**
* This will grab the arguments and create a session before calling the subclass
* {@link BaseHandler#processWithSession} method.
*
* @param {IHandlerParameters} params Command parameters sent by imperative.
*
* @returns {Promise<void>}
*/
process(params: IHandlerParameters): Promise<void>;
protected validateRequiredOptions(): void;
protected getOption(optionDefinition: ICommandOptionDefinition, isRequired?: boolean): any;
protected getOptionFromArgument(optionDefinition: ICommandOptionDefinition): any;
protected getEndevorSessionOption(optionDefinition: ICommandOptionDefinition, isRequired?: boolean): any;
protected createEbgSession(): AbstractSession;
protected createEbgService(ebgSession: AbstractSession): EBGRestService;
protected createEndevorSession(): AbstractSession;
protected createZosmfSession(): AbstractSession;
/**
* Returns the command line arguments passed
*/
protected get arguments(): ICommandArguments;
/**
* Fail the command with an imperative error
* @param {IImperativeError} err - the imperative error parameters
*/
protected fail(err: IImperativeError): void;
/**
* Returns the console interface for the command handler
* @returns {IHandlerResponseConsoleApi}
*/
protected get console(): IHandlerResponseConsoleApi;
/**
* Returns the format interface for the command handler
* @returns {IHandlerFormatOutputApi}
*/
protected get format(): IHandlerFormatOutputApi;
/**
* Returns the format interface for the command handler
* @returns {IHandlerResponseDataApi}
*/
protected get data(): IHandlerResponseDataApi;
/**
* Returns the format interface for the command handler
* @returns {IHandlerProgressApi}
*/
protected get progress(): IHandlerProgressApi;
/**
* This is called by the {@link BaseHandler#process} after it creates a session.
*/
protected abstract processWithSession(): Promise<void>;
private profileExists;
}