2020-11-09 17:29:12 +00:00
|
|
|
import Model, { attr } from '@ember-data/model';
|
2020-09-18 10:14:06 +00:00
|
|
|
import { computed } from '@ember/object';
|
|
|
|
import { fragmentArray } from 'ember-data-model-fragments/attributes';
|
2021-01-27 10:41:24 +00:00
|
|
|
import { nullValue } from 'consul-ui/decorators/replace';
|
2018-05-22 15:03:45 +00:00
|
|
|
|
|
|
|
export const PRIMARY_KEY = 'uid';
|
|
|
|
export const SLUG_KEY = 'ID';
|
2020-09-18 10:14:06 +00:00
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
export default class Intention extends Model {
|
|
|
|
@attr('string') uid;
|
|
|
|
@attr('string') ID;
|
|
|
|
|
|
|
|
@attr('string') Datacenter;
|
|
|
|
@attr('string') Description;
|
2021-09-24 16:31:58 +00:00
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr('string', { defaultValue: () => '*' }) SourceName;
|
|
|
|
@attr('string', { defaultValue: () => '*' }) DestinationName;
|
2021-09-24 16:31:58 +00:00
|
|
|
@attr('string', { defaultValue: () => 'default' }) SourceNS;
|
|
|
|
@attr('string', { defaultValue: () => 'default' }) DestinationNS;
|
|
|
|
@attr('string', { defaultValue: () => 'default' }) SourcePartition;
|
|
|
|
@attr('string', { defaultValue: () => 'default' }) DestinationPartition;
|
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr('number') Precedence;
|
|
|
|
@attr('string', { defaultValue: () => 'consul' }) SourceType;
|
2021-01-27 10:41:24 +00:00
|
|
|
@nullValue(undefined) @attr('string') Action;
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr('string') LegacyID;
|
|
|
|
@attr('boolean', { defaultValue: () => true }) Legacy;
|
|
|
|
@attr('number') SyncTime;
|
|
|
|
@attr('date') CreatedAt;
|
|
|
|
@attr('date') UpdatedAt;
|
|
|
|
@attr('number') CreateIndex;
|
|
|
|
@attr('number') ModifyIndex;
|
|
|
|
@attr() Meta; // {}
|
2021-02-19 16:42:16 +00:00
|
|
|
@attr({ defaultValue: () => [] }) Resources; // []
|
2020-11-09 17:29:12 +00:00
|
|
|
@fragmentArray('intention-permission') Permissions;
|
|
|
|
|
|
|
|
@computed('Meta')
|
|
|
|
get IsManagedByCRD() {
|
2020-09-18 10:14:06 +00:00
|
|
|
const meta = Object.entries(this.Meta || {}).find(
|
|
|
|
([key, value]) => key === 'external-source' && value === 'kubernetes'
|
|
|
|
);
|
|
|
|
return typeof meta !== 'undefined';
|
2020-11-09 17:29:12 +00:00
|
|
|
}
|
|
|
|
}
|