UNPKG

@zowe/imperative

Version:
157 lines 7.22 kB
import { IConvertV1ProfOpts, IConvertV1ProfResult } from "./doc/IConvertV1Profiles"; export declare class ConvertV1Profiles { private static readonly noCfgFilePathNm; private static readonly credMgrKey; private static readonly oldScsPluginNm; private static readonly builtInCredMgrNm; private static profileInfo; private static oldScsPluginWasConfigured; private static convertOpts; private static convertResult; private static profilesRootDir; private static oldProfilesDir; private static zoweKeyRing; /** * Convert V1 profiles into a zowe.config.json file. * * It will also do the following: * Create a zowe.schema.json file. * Migrate V1 secure properties into the current consolidated Zowe client secure properties. * Replace old SCS-plugin credential manager override with the Zowe embedded SCS. * Delete old V1 profiles (and old V1 secure properties) if requested. * * Calling this function after having already converted, will not attempt to * convert again. However it will still delete the old profiles if requested. * * You should **NOT** initialize the secure credential manager before calling this function. * The CredMgr can only be initialized once. If the old V1 SCS-plugin happens to be configured * as the CredMgr when this function is called, the old V1 SCS-plugin CredMgr is unable * to create the current consolidated Zowe client secure properties. Users will have to * re-enter all of their credentials. * * @param convertOpts Options that will control the conversion process. * @returns Result object into which messages and stats are stored. */ static convert(convertOpts: IConvertV1ProfOpts): Promise<IConvertV1ProfResult>; /** * Detect whether we must convert any V1 profiles to a zowe client configuration. * @returns True means we must do a conversion. False otherwise. */ private static isConversionNeeded; /** * Replace any detected oldCredMgr override entry in settings.json with the Zowe embedded credMgr. * * After the replacement of the credential manager override, we can then initialize * credential manager later in this class. */ private static replaceOldCredMgrOverride; /** * Initialize credential manager so that we can migrate the secure properties that are * stored for V1 profiles to new secure properties for the converted config that we will create. * * For all CLI commands other than convert-profiles, the credential manager is loaded in * Imperative.init and frozen with Object.freeze so it cannot be modified later on. * Because convert-profiles cannot create new secure properties for the converted config * (if the old SCS plugin credMgr is already loaded), Imperative.init does not load the * credential manager for the convert-profiles command. * * VSCode extensions must also avoid initializing the Credential Manager before calling * ConvertV1Profiles.convert. * * If we encounter an error when trying to initialize the credential manager, we report (through * ConvertV1Profiles.convertResult.credsWereMigrated) that creds were not migrated. */ private static initCredMgr; /** * Move the contents of existing v1 profiles to a zowe client config file. * * @returns The path name to the new zowe client config file (null upon failure). */ private static moveV1ProfilesToConfigFile; /** * Create a new zowe client config file from an IConfig object. * Store the name of the new config file in our convertResult object. * * @param convertedConfig IConfig object created as a result of V1 profile conversion. * @returns string - Path name to the newly created config file. */ private static createNewConfigFile; /** * Load V1 profile schemas, which will not have been loaded for VSCode extensions. */ private static loadV1Schemas; /** * Put the path name to the config file, obtained from the supplied Config object, * into our result object. * * @param configForPath The config object from which we will extract the path. */ private static putCfgFileNmInResult; /** * Delete the V1 profiles that have been converted. * We also delete the secure credentials stored for those V1 profiles. */ private static deleteV1Profiles; /** * Convert a set of known property names to their new names * for V2 conformance (and later releases). * * @param convertedConfig The converted client configuration in which we shall * rename obsolete property names to their conformant names. */ private static convertPropNames; /** * Retrieve info about old plug-ins and their overrides. * @returns IOldPluginInfo * plugins - List of CLI plug-ins to uninstall * overrides - List of overrides to replace in app settings */ private static getOldPluginInfo; /** * Report whether the specified plugin is installed. * @param pluginName name of the plugin to search for. * @returns True if plugin is installed. False otherwise. */ private static isPluginInstalled; /** * Get the number of old profiles present in the CLI home dir. * @param profilesRootDir Root profiles directory * @returns Number of old profiles found */ private static getOldProfileCount; /** * Verify that the credential vault is accessible, or whether there is a problem. * @returns true if credential vault is available, false if it is not */ private static isZoweKeyRingAvailable; /** * Locate the names of secured properties stored under an account in the operating * system's credential vault. * @param acct The account to search for in the credential store * @param convertMsgs The set of conversion messages to which we can add new messages * @returns a list of secured properties stored under the specified account */ private static findOldSecureProps; /** * Delete the secure property specified from the operating system credential vault. * @param acct The account the property is stored under * @param propName The name of the property to delete * @param convertMsgs The set of conversion messages to which we can add new messages * @returns true if the property was deleted successfully */ private static deleteOldSecureProps; /** * Add a new message to the V1 profile conversion messages that reports a caught exception. * * @param introMsg An introductory message describing what action was being attempted when we failed. * @param error The exception that we caught. */ private static addExceptionToConvertMsgs; /** * Add a new message to the V1 profile conversion messages. * @param msgFormat Formatting clues for the message. * @param msgText Unformatted text of the message. */ private static addToConvertMsgs; } //# sourceMappingURL=ConvertV1Profiles.d.ts.map