open-consul/ui/packages/consul-ui/app/models/intention-permission-http.js
John Cowen 5c18dc099f
ui: Move ember-data classes to use native JS classes/decorators (#9136)
* ui: Upgrade ember-data models to use native classes/decorators

* ui: Update remaining ember-data imports

* ui: Move ember-data Adapters to use native classes

* ui: Upgrade serializers to native classes/decorators

* ui: remove meta from roles, they never had it to start with
2020-11-09 17:29:12 +00:00

31 lines
943 B
JavaScript

import Fragment from 'ember-data-model-fragments/fragment';
import { fragmentArray, array } from 'ember-data-model-fragments/attributes';
import { attr } from '@ember-data/model';
import { computed } from '@ember/object';
import { or } from '@ember/object/computed';
export const schema = {
PathType: {
allowedValues: ['PathPrefix', 'PathExact', 'PathRegex'],
},
Methods: {
allowedValues: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
},
};
export default class IntentionPermissionHttp extends Fragment {
@attr('string') PathExact;
@attr('string') PathPrefix;
@attr('string') PathRegex;
@fragmentArray('intention-permission-http-header') Header;
@array('string') Methods;
@or(...schema.PathType.allowedValues) Path;
@computed(...schema.PathType.allowedValues)
get PathType() {
return schema.PathType.allowedValues.find(prop => typeof this[prop] === 'string');
}
}