### Hierarchy

- ConfigUtils

## Index

### Accessors

- onlyV1ProfilesExist

### Methods

- coercePropValue
- findProfTypeInNestedProfiles
- formGlobOrProjProfileNm
- getActiveProfileName
- getZoweDir
- hasTokenExpired
- initImpUtils
- jsonPathMatches
- readExtendersJson
- secureSaveError
- writeExtendersJson

## Accessors

### Static onlyV1ProfilesExist

- get onlyV1ProfilesExist(): boolean

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:142

  Returns an indicator that the user has no team configuration, but we detected the existence of old-school V1 profiles. We will not work with the V1 profiles. This function can let you tell a user that they are incorrectly trying to use V1 profiles.

  #### Returns boolean

  True - Means there is NO team config AND we detected that a V1 profile exists. False otherwise.

## Methods

### Static coercePropValue

- coercePropValue(value: any, type?: string): any

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:89

  Coerces string property value to a boolean or number type.

  #### Parameters

  - ##### value: any

    String value

  - ##### Optional type: string

    Property type defined in the schema

  #### Returns any

  Boolean, number, or string

### Static Private findProfTypeInNestedProfiles

- findProfTypeInNestedProfiles(profileType: string, profilesObj: {}): boolean

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:276

  Find the specified profile type in the specified (or nested) profiles.

  #### Parameters

  - ##### profileType: string

         The profile type to search for.

  - ##### profilesObj: {}

         The profile object in which we should search.

    - ##### [key: string]: IConfigProfile

  #### Returns boolean

       True if we find the profile type. False otherwise.

### Static formGlobOrProjProfileNm

- formGlobOrProjProfileNm(profileType: string, globalConfig?: boolean): string

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:234

  Form a profile name of a given profile type to be used as a default profile name. The name can vary based on whether the configuration to contain the profile is a global config or a project config.

  Currently, we only form a different global/project profile name for a base profile. The profile name for any other profile type is currently set to the profile type string.

  #### Parameters

  - ##### profileType: string

         The profile type for which we will form a name.

  - ##### Default value globalConfig: boolean = null

         Indicator that the caller knows that the profile name will be
         for a globalConfig (true) or project config (false).
         If globalConfig is not supplied, we interrogate any existing
         Config object to determine whether to form a global or project
         profile name.

  #### Returns string

       A string to be used as the profile name for the specified profile type.

### Static getActiveProfileName

- getActiveProfileName(profileType: string, cmdArguments?: ICommandArguments, defaultProfileName?: string): string

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:115

  Retrieves the name of the active profile for the given type. If no such profile exists, returns the default name which can be used to create a new profile.

  #### Parameters

  - ##### profileType: string

    The type of CLI profile

  - ##### Optional cmdArguments: ICommandArguments

    CLI arguments which may specify a profile

  - ##### Optional defaultProfileName: string

    Name to fall back to if profile doesn't exist. If not specified, the profile type will be used.

  #### Returns string

  The profile name

### Static getZoweDir

- getZoweDir(): string

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:35

  Retrieves the Zowe CLI home directory. In the situation Imperative has not initialized it we use a default value.

  #### Returns string

  - Returns the Zowe home directory

### Static hasTokenExpired

- hasTokenExpired(token: string): boolean

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:302

  Checks if the given token has expired. Supports JSON web tokens only.

  #### Parameters

  - ##### token: string

    The JSON web token to check

  #### Returns boolean

      Whether the token has expired. Returns `false` if the token cannot
      be decoded or an expire time is not specified in the payload.

### Static initImpUtils

- initImpUtils(appName: string): Logger

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:180

  Perform a rudimentary initialization of some Imperative utilities. We must do this because VSCode apps do not typically call imperative.init.

  internal

  #### Parameters

  - ##### appName: string

  #### Returns Logger

### Static jsonPathMatches

- jsonPathMatches(fullPath: string, partialPath: string): boolean

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:129

  Checks if partial path is equal to or nested inside full path

  #### Parameters

  - ##### fullPath: string

    JSON path to profile 1

  - ##### partialPath: string

    JSON path to profile 2

  #### Returns boolean

### Static readExtendersJson

- readExtendersJson(): IExtendersJsonOpts

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:54

  Reads the `extenders.json` file from the CLI home directory. Called once in `readProfilesFromDisk` and cached to minimize I/O operations.

  internal
  throws

    If the extenders.json file cannot be created when it does not exist.

  throws

    If the extenders.json file cannot be read.

  #### Returns IExtendersJsonOpts

### Static secureSaveError

- secureSaveError(solution?: string): ImperativeError

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:163

  Form an error message for failures to securely save a value.

  #### Parameters

  - ##### Optional solution: string

    Text that our caller can supply for a solution.

  #### Returns ImperativeError

  ImperativeError to be thrown

### Static writeExtendersJson

- writeExtendersJson(obj: IExtendersJsonOpts): boolean

- - Defined in @zowe/imperative/src/config/src/ConfigUtils.ts:72

  Attempts to write to the `extenders.json` file in the CLI home directory.

  internal

  #### Parameters

  - ##### obj: IExtendersJsonOpts

  #### Returns boolean

  `true` if written successfully; `false` otherwise

Generated using TypeDoc