2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
*/
|
|
|
|
|
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';
|
|
|
|
import { MANAGEMENT_ID } from 'consul-ui/models/policy';
|
2018-10-19 15:17:02 +00:00
|
|
|
|
|
|
|
export const PRIMARY_KEY = 'uid';
|
|
|
|
export const SLUG_KEY = 'AccessorID';
|
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
export default class Token extends Model {
|
|
|
|
@attr('string') uid;
|
|
|
|
@attr('string') AccessorID;
|
|
|
|
|
|
|
|
@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') IDPName;
|
|
|
|
@attr('string') SecretID;
|
|
|
|
|
2023-02-06 23:27:49 +00:00
|
|
|
@attr('boolean') Legacy;
|
2020-11-09 17:29:12 +00:00
|
|
|
@attr('boolean') Local;
|
|
|
|
@attr('string', { defaultValue: () => '' }) Description;
|
|
|
|
@attr() meta; // {}
|
|
|
|
|
|
|
|
@attr({ defaultValue: () => [] }) Policies;
|
|
|
|
@attr({ defaultValue: () => [] }) Roles;
|
|
|
|
@attr({ defaultValue: () => [] }) ServiceIdentities;
|
|
|
|
@attr({ defaultValue: () => [] }) NodeIdentities;
|
|
|
|
@attr('date') CreateTime;
|
|
|
|
@attr('string') Hash;
|
|
|
|
@attr('number') CreateIndex;
|
|
|
|
@attr('number') ModifyIndex;
|
|
|
|
|
2023-02-06 23:27:49 +00:00
|
|
|
// Legacy
|
|
|
|
@attr('string') Type;
|
|
|
|
@attr('string', { defaultValue: () => '' }) Name;
|
|
|
|
@attr('string') Rules;
|
|
|
|
// End Legacy
|
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
@computed('Policies.[]')
|
|
|
|
get isGlobalManagement() {
|
2022-09-15 08:43:17 +00:00
|
|
|
return (this.Policies || []).find((item) => item.ID === MANAGEMENT_ID);
|
2020-11-09 17:29:12 +00:00
|
|
|
}
|
2021-07-30 17:52:37 +00:00
|
|
|
|
|
|
|
@computed('SecretID')
|
|
|
|
get hasSecretID() {
|
|
|
|
return this.SecretID !== '' && this.SecretID !== '<hidden>';
|
|
|
|
}
|
2020-11-09 17:29:12 +00:00
|
|
|
}
|