diff --git a/addons/api/addon/generated/models/credential.js b/addons/api/addon/generated/models/credential.js index e596d15bd..898beb83d 100644 --- a/addons/api/addon/generated/models/credential.js +++ b/addons/api/addon/generated/models/credential.js @@ -46,6 +46,14 @@ export default class GeneratedCredentialModel extends BaseModel { }) version; + // =attributes (username_password, ssh_private_key) + @attr('string', { + for: ['username_password', 'ssh_private_key'], + isNestedAttribute: true, + description: 'The username for credential.', + }) + username; + // =attributes (username_password) @attr('string', { for: 'username_password', @@ -54,10 +62,18 @@ export default class GeneratedCredentialModel extends BaseModel { }) password; + // =attributes (ssh_private_key) @attr('string', { - for: 'username_password', + for: 'ssh_private_key', isNestedAttribute: true, - description: 'The username for credential.', + description: 'The private key for credential.', }) - username; + private_key; + + @attr('string', { + for: 'ssh_private_key', + isNestedAttribute: true, + description: 'The passphrase for credential.', + }) + passphrase; } diff --git a/addons/api/addon/serializers/credential.js b/addons/api/addon/serializers/credential.js index 7aa3f19e2..8b6ddb419 100644 --- a/addons/api/addon/serializers/credential.js +++ b/addons/api/addon/serializers/credential.js @@ -5,6 +5,10 @@ export default class CredentialSerializer extends ApplicationSerializer { serialize() { const serialized = super.serialize(...arguments); delete serialized['attributes']['password_hmac']; + if (serialized.type === 'username_password') { + delete serialized['attributes']['private_key']; + delete serialized['attributes']['passphrase']; + } return serialized; } diff --git a/addons/api/tests/unit/models/credential-test.js b/addons/api/tests/unit/models/credential-test.js index c7f3b8863..7cf89e154 100644 --- a/addons/api/tests/unit/models/credential-test.js +++ b/addons/api/tests/unit/models/credential-test.js @@ -4,10 +4,9 @@ import { setupTest } from 'ember-qunit'; module('Unit | Model | credential', function (hooks) { setupTest(hooks); - // Replace this with your real tests. test('it exists', function (assert) { - let store = this.owner.lookup('service:store'); - let model = store.createRecord('credential', {}); + const store = this.owner.lookup('service:store'); + const model = store.createRecord('credential', {}); assert.ok(model); }); });