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-09-30 11:33:01 +00:00
|
|
|
import RepositoryService from 'consul-ui/services/repository';
|
|
|
|
const modelName = 'intention-permission';
|
2020-11-09 09:25:35 +00:00
|
|
|
export default class IntentionPermissionService extends RepositoryService {
|
|
|
|
getModelName() {
|
2020-09-30 11:33:01 +00:00
|
|
|
return modelName;
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
create(obj = {}) {
|
2020-09-30 11:33:01 +00:00
|
|
|
// intention-permission and intention-permission-http
|
|
|
|
// are currently treated as one and the same
|
|
|
|
return this.store.createFragment(this.getModelName(), {
|
|
|
|
...obj,
|
|
|
|
HTTP: this.store.createFragment('intention-permission-http', obj.HTTP || {}),
|
|
|
|
});
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
persist(item) {
|
2020-09-30 11:33:01 +00:00
|
|
|
return item.execute();
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
}
|