open-nomad/ui/app/models/token.js
2023-04-10 15:36:59 +00:00

27 lines
632 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { alias } from '@ember/object/computed';
import Model from '@ember-data/model';
import { attr } from '@ember-data/model';
import { hasMany } from '@ember-data/model';
export default class Token extends Model {
@attr('string') secret;
@attr('string') name;
@attr('boolean') global;
@attr('date') createTime;
@attr('string') type;
@hasMany('policy') policies;
@attr() policyNames;
@attr('date') expirationTime;
@alias('id') accessor;
get isExpired() {
return this.expirationTime && this.expirationTime < new Date();
}
}