feat: storage policy API and mirage changes (#2054)
* feat: 🎸 add storage policy API and mirage
This commit is contained in:
1 parent
d4adbe4317
commit
e3406d9a95
14 files changed
+261
-2
No files matched your search
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import BaseModel from '../../models/base';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
/**
|
||||
* Storage Policy is a resource that manages the lifecycle of Session Recordings,
|
||||
* particularly to meet compliance frameworks.
|
||||
*/
|
||||
export default class GeneratedPolicyModel extends BaseModel {
|
||||
// =attributes
|
||||
|
||||
@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;
|
||||
|
||||
@attr('object', {
|
||||
isNestedAttribute: true,
|
||||
description:
|
||||
'Days is the number of days for which a session recording will be retained.',
|
||||
})
|
||||
retain_for;
|
||||
|
||||
@attr('object', {
|
||||
isNestedAttribute: true,
|
||||
description:
|
||||
'Days is the number of days for which a session recording will be automatically deleted.',
|
||||
})
|
||||
delete_after;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import GeneratedPolicyModel from '../generated/models/policy';
|
||||
|
||||
export default class PolicyModel extends GeneratedPolicyModel {}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
import { TrackedObject } from 'tracked-built-ins';
|
||||
|
||||
export default class ObjectTransform extends Transform {
|
||||
/**
|
||||
* @param serialized
|
||||
* @returns {object}
|
||||
*/
|
||||
deserialize(serialized) {
|
||||
if (Object.keys(serialized).length) {
|
||||
const obj = new TrackedObject(serialized);
|
||||
return obj;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param deserialized
|
||||
* @returns {object}
|
||||
*/
|
||||
serialize(deserialized) {
|
||||
if (Object.keys(deserialized).length) {
|
||||
return deserialized;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user