2018-10-26 16:36:15 +00:00
|
|
|
import RepositoryService from 'consul-ui/services/repository';
|
2021-02-23 08:56:42 +00:00
|
|
|
import dataSource from 'consul-ui/decorators/data-source';
|
|
|
|
|
2018-10-26 16:36:15 +00:00
|
|
|
const modelName = 'service';
|
2021-02-23 08:56:42 +00:00
|
|
|
export default class ServiceService extends RepositoryService {
|
2020-11-09 09:25:35 +00:00
|
|
|
getModelName() {
|
2018-10-26 16:36:15 +00:00
|
|
|
return modelName;
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
|
2021-09-15 18:50:11 +00:00
|
|
|
@dataSource('/:partition/:ns/:dc/services')
|
2021-02-23 08:56:42 +00:00
|
|
|
async findAllByDatacenter() {
|
2021-09-15 18:50:11 +00:00
|
|
|
return super.findAll(...arguments);
|
2021-02-23 08:56:42 +00:00
|
|
|
}
|
|
|
|
|
2022-10-10 07:50:00 +00:00
|
|
|
@dataSource('/:partition/:ns/:dc/services/:peer')
|
|
|
|
async findAllImportedServices() {
|
|
|
|
return super.findAll(...arguments);
|
|
|
|
}
|
|
|
|
|
2021-09-15 18:50:11 +00:00
|
|
|
@dataSource('/:partition/:ns/:dc/gateways/for-service/:gateway')
|
2021-02-23 08:56:42 +00:00
|
|
|
findGatewayBySlug(params, configuration = {}) {
|
2020-05-29 15:07:36 +00:00
|
|
|
if (typeof configuration.cursor !== 'undefined') {
|
2021-02-23 08:56:42 +00:00
|
|
|
params.index = configuration.cursor;
|
|
|
|
params.uri = configuration.uri;
|
2020-05-29 15:07:36 +00:00
|
|
|
}
|
2021-02-23 08:56:42 +00:00
|
|
|
return this.store.query(this.getModelName(), params);
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
}
|