vault/ui/lib/pki/addon/utils/action-params.js
Kianna ef9d6a42a7
UI: VAULT-13782 VAULT-13794 pki ui improvements for phase two (#19312)
* VAULT-13782 move keys tab next to issuers

* VAULT-13794 move private_key_format to key paramter toggle

* Fix failing tests!

* Move format and private key format out

* Address feedback and fix not valid after spacing

* Add more spacing and code cleanup

* Remove engines stylesheet

* Remove class conditional logic
2023-03-01 07:29:35 -08:00

17 lines
626 B
JavaScript

/**
* keyParamsByType
* @param {string} type - refers to `type` attribute on the pki/action model. Should be one of 'exported', 'internal', 'existing', 'kms'
* @returns array of valid key-related attribute names (camelCase). NOTE: Key params are not used on all action endpoints
*/
export function keyParamsByType(type) {
let fields = ['keyName', 'keyType', 'keyBits'];
if (type === 'existing') {
fields = ['keyRef'];
} else if (type === 'kms') {
fields = ['keyName', 'managedKeyName', 'managedKeyId'];
} else if (type === 'exported') {
fields = [...fields, 'privateKeyFormat'];
}
return fields;
}