Skip to content

Commit

Permalink
fix: πŸ› dynamic storage bucket showing as static (#1933)
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronperera authored Sep 28, 2023
1 parent 58cd75e commit 406e45f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion addons/api/addon/models/storage-bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ export default class StorageBucketModel extends GeneratedStorageBucketModel {
* @type {string}
*/
get credentialType() {
if (!this.#credentialType) return 'static';
if (!this.#credentialType) {
if (this.role_arn) {
this.#credentialType = TYPE_CREDENTIAL_DYNAMIC;
} else {
this.#credentialType = TYPE_CREDENTIAL_STATIC;
}
}
return this.#credentialType;
}

Expand Down
12 changes: 11 additions & 1 deletion addons/api/tests/unit/models/storage-bucket-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module('Unit | Model | storage bucket', function (hooks) {
});

test('it has credentialType property and returns the expected values', async function (assert) {
assert.expect(2);
assert.expect(4);
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('storage-bucket', {
role_arn: 'test-role-arn',
Expand All @@ -58,8 +58,18 @@ module('Unit | Model | storage bucket', function (hooks) {
access_key_id: 'test-access-key-id',
credentialType: TYPE_CREDENTIAL_STATIC,
});
const modelC = store.createRecord('storage-bucket', {
role_arn: null,
access_key_id: 'test-access-key-id',
});
const modelD = store.createRecord('storage-bucket', {
role_arn: 'test-role-arn',
access_key_id: null,
});
assert.strictEqual(modelA.credentialType, TYPE_CREDENTIAL_DYNAMIC);
assert.strictEqual(modelB.credentialType, TYPE_CREDENTIAL_STATIC);
assert.strictEqual(modelC.credentialType, TYPE_CREDENTIAL_STATIC);
assert.strictEqual(modelD.credentialType, TYPE_CREDENTIAL_DYNAMIC);
});

test('it has isAWS property and returns the expected values', async function (assert) {
Expand Down

2 comments on commit 406e45f

@vercel
Copy link

@vercel vercel bot commented on 406e45f Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

boundary-ui-desktop – ./ui/desktop

boundary-ui-desktop.vercel.app
boundary-ui-desktop-git-main-hashicorp.vercel.app
boundary-ui-desktop-hashicorp.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 406e45f Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

boundary-ui – ./ui/admin

boundary-ui-hashicorp.vercel.app
boundary-ui.vercel.app
boundary-ui-git-main-hashicorp.vercel.app

Please sign in to comment.