2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
import Model, { attr } from '@ember-data/model';
|
2020-09-01 18:13:11 +00:00
|
|
|
import { computed } from '@ember/object';
|
2018-10-19 15:17:02 +00:00
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
export const MANAGEMENT_ID = '00000000-0000-0000-0000-000000000001';
|
2018-10-19 15:17:02 +00:00
|
|
|
export const PRIMARY_KEY = 'uid';
|
|
|
|
export const SLUG_KEY = 'ID';
|
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
export default class Policy extends Model {
|
|
|
|
@attr('string') uid;
|
|
|
|
@attr('string') ID;
|
2020-09-01 18:13:11 +00:00
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr('string') Datacenter;
|
|
|
|
@attr('string') Namespace;
|
2021-09-15 18:50:11 +00:00
|
|
|
@attr('string') Partition;
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr('string', { defaultValue: () => '' }) Name;
|
|
|
|
@attr('string', { defaultValue: () => '' }) Description;
|
|
|
|
@attr('string', { defaultValue: () => '' }) Rules;
|
|
|
|
@attr('number') SyncTime;
|
|
|
|
@attr('number') CreateIndex;
|
|
|
|
@attr('number') ModifyIndex;
|
|
|
|
@attr() Datacenters; // string[]
|
|
|
|
@attr() meta; // {}
|
|
|
|
// frontend only for templated policies (Identities)
|
|
|
|
@attr('string', { defaultValue: () => '' }) template;
|
2018-10-19 15:17:02 +00:00
|
|
|
// frontend only for ordering where CreateIndex can't be used
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr('number', { defaultValue: () => new Date().getTime() }) CreateTime;
|
2019-05-01 18:09:29 +00:00
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
@computed('ID')
|
|
|
|
get isGlobalManagement() {
|
|
|
|
return this.ID === MANAGEMENT_ID;
|
|
|
|
}
|
|
|
|
}
|