2021-02-17 18:56:56 +00:00
|
|
|
import RepositoryService from 'consul-ui/services/repository';
|
|
|
|
import statusFactory from 'consul-ui/utils/acls-status';
|
|
|
|
import isValidServerErrorFactory from 'consul-ui/utils/http/acl/is-valid-server-error';
|
|
|
|
import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/auth-method';
|
2021-02-23 08:56:42 +00:00
|
|
|
import dataSource from 'consul-ui/decorators/data-source';
|
2021-02-17 18:56:56 +00:00
|
|
|
|
|
|
|
const isValidServerError = isValidServerErrorFactory();
|
|
|
|
const status = statusFactory(isValidServerError, Promise);
|
|
|
|
const MODEL_NAME = 'auth-method';
|
|
|
|
|
|
|
|
export default class AuthMethodService extends RepositoryService {
|
|
|
|
getModelName() {
|
|
|
|
return MODEL_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
getPrimaryKey() {
|
|
|
|
return PRIMARY_KEY;
|
|
|
|
}
|
|
|
|
|
|
|
|
getSlugKey() {
|
|
|
|
return SLUG_KEY;
|
|
|
|
}
|
|
|
|
|
2021-02-23 08:56:42 +00:00
|
|
|
@dataSource('/:ns/:dc/auth-methods')
|
|
|
|
async findAllByDatacenter() {
|
|
|
|
return super.findAllByDatacenter(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
@dataSource('/:ns/:dc/auth-method/:id')
|
|
|
|
async findBySlug() {
|
|
|
|
return super.findBySlug(...arguments);
|
|
|
|
}
|
|
|
|
|
2021-02-17 18:56:56 +00:00
|
|
|
status(obj) {
|
|
|
|
return status(obj);
|
|
|
|
}
|
|
|
|
}
|