github.com/outbrain/consul@v1.4.5/ui-v2/app/models/token.js (about) 1 import Model from 'ember-data/model'; 2 import attr from 'ember-data/attr'; 3 import writable from 'consul-ui/utils/model/writable'; 4 5 export const PRIMARY_KEY = 'uid'; 6 export const SLUG_KEY = 'AccessorID'; 7 8 const model = Model.extend({ 9 [PRIMARY_KEY]: attr('string'), 10 [SLUG_KEY]: attr('string'), 11 SecretID: attr('string'), 12 // Legacy 13 Type: attr('string'), 14 Name: attr('string', { 15 defaultValue: '', 16 }), 17 Rules: attr('string'), 18 // End Legacy 19 Legacy: attr('boolean'), 20 Description: attr('string', { 21 defaultValue: '', 22 }), 23 Datacenter: attr('string'), 24 Local: attr('boolean'), 25 Policies: attr({ 26 defaultValue: function() { 27 return []; 28 }, 29 }), 30 CreateTime: attr('date'), 31 CreateIndex: attr('number'), 32 ModifyIndex: attr('number'), 33 }); 34 // Name and Rules is only for legacy tokens 35 export const ATTRS = writable(model, [ 36 'Name', 37 'Rules', 38 'Type', 39 'Local', 40 'Description', 41 'Policies', 42 // SecretID isn't writable but we need it to identify an 43 // update via the old API, see TokenAdapter dataForRequest 44 'SecretID', 45 'AccessorID', 46 ]); 47 export default model;