refactor: 💡sb dynamic credential type secret fields and how we serialize (#1907)

* refactor: 💡 secret fields and how we serialize
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2023-09-20 14:55:05 -07:00
1 parent 1b84a70ca0
commit d0a505558b
10 files changed
+85 -36

No files matched your search

+13 -7
View File
@@ -22,6 +22,9 @@ export const TYPES_CREDENTIALS = Object.freeze([
]);
export default class StorageBucketModel extends GeneratedStorageBucketModel {
// attributes
#credentialType;
/**
* True if the storage bucket is a plugin.
* @type {boolean}
@@ -31,18 +34,21 @@ export default class StorageBucketModel extends GeneratedStorageBucketModel {
}
/**
* If the storage bucket has role_arn, return dynamic
* otherwise return the default static type.
* Gets a value from credentialType
* @type {string}
*/
get credentialType() {
if (this.role_arn && !this.access_key_id) {
return TYPE_CREDENTIAL_DYNAMIC;
} else {
return TYPE_CREDENTIAL_STATIC;
}
if (!this.#credentialType) return 'static';
return this.#credentialType;
}
/**
* Sets a value to credentialType
* @type {string}
*/
set credentialType(type) {
this.#credentialType = type;
}
/**
* True if the storage bucket is an unknown type.
* @type {boolean}