API Class for manipulating config layers.

### Hierarchy

- ConfigApi
  - ConfigSecure

## Index

### Constructors

- constructor

### Properties

- mConfig
- mLoadFailed

### Accessors

- loadFailed

### Methods

- cacheAndPrune
- directSave
- findSecure
- load
- loadCached
- rmUnusedProps
- save
- secureFields
- secureInfoForProp
- securePropsForLayer
- securePropsForProfile

## Constructors

### constructor

- new ConfigSecure(mConfig: Config): ConfigSecure

- Inherited from ConfigApi.constructor

  - Defined in @zowe/imperative/src/config/src/api/ConfigApi.ts:17

  #### Parameters

  - ##### mConfig: Config

  #### Returns ConfigSecure

## Properties

### Protected mConfig

mConfig: Config

Inherited from ConfigApi.mConfig

- Defined in @zowe/imperative/src/config/src/api/ConfigApi.ts:18

### Private mLoadFailed

mLoadFailed: boolean

- Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:30

## Accessors

### loadFailed

- get loadFailed(): boolean

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:319

  Return true if the secure load method was called and threw an error, or it was never called because the CredentialManager failed to initialize.

  #### Returns boolean

## Methods

### cacheAndPrune

- cacheAndPrune(opts?: { global: boolean; properties?: IConfig; user: boolean }): void

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:153

  Copy secure config properties from the specified layer into cached secure properties. To save secure config properties directly to the vault, use the asynchronous method `save` instead.

  Warning: Do not pass an `IConfigLayer` object into this method unless you want its properties to be edited.

  internal

  #### Parameters

  - ##### Optional opts: { global: boolean; properties?: IConfig; user: boolean }

    The user and global flags that specify one of the four config files (aka layers).

    - ##### global: boolean

    - ##### Optional properties?: IConfig

      `IConfig` object cloned from the specified layer. If specified, secure properties will be removed.

    - ##### user: boolean

  #### Returns void

### directSave

- directSave(): Promise<void>

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:133

  Save secure properties to the vault without rebuilding the JSON object.

  internal

  #### Returns Promise<void>

### findSecure

- findSecure(profiles: {}, path: string): string[]

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:239

  Recursively find secure property paths inside a team config "profiles" object.

  internal

  #### Parameters

  - ##### profiles: {}

    The "profiles" object that is present at the top level of team config files, and may also be present at lower levels.

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

  - ##### path: string

    The JSON path to the "profiles" object

  #### Returns string[]

  Array of secure property paths

### load

- load(vault?: IConfigVault): Promise<void>

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:40

  Load the secure application properties from secure storage using the specified vault interface. The vault interface is placed into our Config object. The secure values are placed into our Config layers.

  #### Parameters

  - ##### Optional vault: IConfigVault

    Interface for loading and saving to secure storage.

  #### Returns Promise<void>

### loadCached

- loadCached(opts?: { global: boolean; user: boolean }): void

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

  Copy secure config properties from cached secure properties into the specified layer. To load secure config properties directly from the vault, use the asynchronous method `load` instead.

  internal

  #### Parameters

  - ##### Optional opts: { global: boolean; user: boolean }

    The user and global flags that specify one of the four config files (aka layers).

    - ##### global: boolean

    - ##### user: boolean

  #### Returns void

### rmUnusedProps

- rmUnusedProps(): string[]

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:304

  Delete secure properties stored for team config files that do not exist.

  #### Returns string[]

  Array of file paths for which properties were deleted

### save

- save(allLayers?: boolean): Promise<void>

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:111

  Save the secure application properties into secure storage using the vault interface from our config object.

  #### Parameters

  - ##### Optional allLayers: boolean

    Specify true to save all config layers instead of only the active one

  #### Returns Promise<void>

### secureFields

- secureFields(opts?: { global: boolean; user: boolean } | boolean): string[]

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:198

  List full paths of all secure properties found in a team config file.

  default

    opts = false

  #### Parameters

  - ##### Default value opts: { global: boolean; user: boolean } | boolean = false

    Specify `true` to get secure fields for all layers. Specify `false` to get secure fields for the active layer

  #### Returns string[]

  Array of secure property paths (e.g., "profiles.lpar1.properties.password")

### secureInfoForProp

- secureInfoForProp(propertyPath: string, findUp?: boolean): { path: string; prop: string }

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

  Retrieve info that can be used to store a profile property securely.

  For example, to securely store "profiles.lpar1.properties.password", the name "password" would be stored in "profiles.lpar1.secure".

  internal

  #### Parameters

  - ##### propertyPath: string

    The full path of the profile property

  - ##### Optional findUp: boolean

    Specify true to search up in the config file for higher level secure arrays

  #### Returns { path: string; prop: string }

  Object with the following attributes:

  - `path` The JSON path of the secure array
  - `prop` The name of the property

  - ##### path: string

  - ##### prop: string

### securePropsForLayer

- securePropsForLayer(layerPath: string): IConfigSecureProperties

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:258

  Retrieve secure properties for a given layer path

  #### Parameters

  - ##### layerPath: string

    Path of the layer to get secure properties for

  #### Returns IConfigSecureProperties

  the secure properties for the given layer, or null if not found

### securePropsForProfile

- securePropsForProfile(profileName: string): string[]

- - Defined in @zowe/imperative/src/config/src/api/ConfigSecure.ts:215

  List names of secure properties for a profile. They may be defined at the profile's level, or at a higher level if the config is nested.

  #### Parameters

  - ##### profileName: string

    Profile name to search for

  #### Returns string[]

  Array of secure property names

Generated using TypeDoc