Icu 5229 credential model (#1197)

* feat: 🎸 Create Credential Model in API

✅ Closes: ICU-5229

Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
This commit is contained in:
lisbet-alvarezandCameron Perera authored and GitHub committed 2022-07-19 13:02:04 -07:00
1 parent ca1b2ce278
commit bd0189cf10
4 files changed
+80

No files matched your search

@@ -0,0 +1,63 @@
import BaseModel from '../../models/base';
import { attr } from '@ember-data/model';
/**
* A credential is a data structure containing one or more secrets that binds an
* identity to a set of permissions or capabilities on a host for a session.
*/
export default class GeneratedCredentialModel extends BaseModel {
// =attributes
@attr('string', {
description:
'The ID of the Credential Store of which this Credential is a part.',
})
credential_store_id;
@attr('string', {
description: 'The type of the resource, to help differentiate schemas',
})
type;
@attr('string', {
description: 'Optional name for identification purposes',
})
name;
@attr('string', {
description: 'Optional user-set description for identification purposes',
})
description;
@attr('date', {
description: 'The time this resource was created\nOutput only.',
readOnly: true,
})
created_time;
@attr('date', {
description: 'The time this resource was last updated\nOutput only.',
readOnly: true,
})
updated_time;
@attr('number', {
description: 'Current version number of this resource.',
})
version;
// =attributes (username_password)
@attr('string', {
for: 'username_password',
isNestedAttribute: true,
description: 'The password hmac for credential.',
})
password_hmac;
@attr('string', {
for: 'username_password',
isNestedAttribute: true,
description: 'The username for credential.',
})
username;
}
+3
View File
@@ -0,0 +1,3 @@
import GeneratedCredentialModel from '../generated/models/credential';
export default class CredentialModel extends GeneratedCredentialModel {}
+1
View File
@@ -0,0 +1 @@
export { default } from 'api/models/credential';
@@ -0,0 +1,13 @@
import { module, test } from 'qunit';
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', {});
assert.ok(model);
});
});