Update credentials (#2523)

* feat: 🎸 allow AWS host catalog credential type update
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2024-10-18 14:33:14 -07:00
1 parent 98d19ef591
commit 6956b30fd6
8 files changed
+132 -72

No files matched your search

+8 -1
View File
@@ -27,6 +27,13 @@ export const TYPES_CREDENTIALS = Object.freeze([
TYPE_CREDENTIAL_DYNAMIC,
]);
const DYNAMIC_CREDENTIAL_FIELDS = [
'role_arn',
'role_external_id',
'role_session_name',
'role_tags',
];
export default class HostCatalogModel extends GeneratedHostCatalogModel {
// =attributes
@@ -53,7 +60,7 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel {
*/
get credentialType() {
if (!this.#credentialType) {
if (this.role_arn) {
if (DYNAMIC_CREDENTIAL_FIELDS.some((field) => this[field])) {
this.#credentialType = TYPE_CREDENTIAL_DYNAMIC;
} else {
this.#credentialType = TYPE_CREDENTIAL_STATIC;