Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
feat(hosting): add extraSqlPerso path
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Espiau <[email protected]>
  • Loading branch information
Frederic Espiau committed Feb 12, 2020
1 parent 140a8e5 commit b1c916f
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/api/hosting/web/extraSqlPerso/extraSqlPerso.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiHostingWebExtraSqlPerso', ($injector) => ({
v6() {
return $injector.get('OvhApiHostingWebExtraSqlPersoV6');
},
}));
63 changes: 63 additions & 0 deletions src/api/hosting/web/extraSqlPerso/extraSqlPerso.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
angular.module('ovh-api-services').service('OvhApiHostingWebExtraSqlPersoV6', ($cacheFactory, $resource) => {
const cache = $cacheFactory('OvhApiAnalyticsPlatformsV6');
const queryCache = $cacheFactory('OvhApiAnalyticsPlatformsV6Query');

const interceptor = {
response(response) {
cache.resetCache();
queryCache.resetCache();
return response.data;
},
};

const resource = $resource('/hosting/web/:serviceName/extraSqlPerso/:name', {
serviceName: '@serviceName',
name: '@name',
}, {
query: {
method: 'GET',
isArray: true,
cache: queryCache,
},

get: {
method: 'GET',
cache,
},

queryDatabases: {
url: '/hosting/web/:serviceName/extraSqlPerso/:name/databases',
method: 'GET',
isArray: true,
cache: queryCache,
},

getServiceInfos: {
url: '/hosting/web/:serviceName/extraSqlPerso/:name/serviceInfos',
method: 'GET',
cache,
},

updateServiceInfos: {
url: '/hosting/web/:serviceName/extraSqlPerso/:name/serviceInfosUpdate',
method: 'POST',
interceptor,
},

terminate: {
url: '/hosting/web/:serviceName/extraSqlPerso/:name/terminate',
method: 'POST',
interceptor,
},
});

resource.resetCache = function resetCache() {
cache.removeAll();
};

resource.resetQueryCache = function resetQueryCache() {
queryCache.removeAll();
};

return resource;
});
3 changes: 3 additions & 0 deletions src/api/hosting/web/web.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ angular.module('ovh-api-services').service('OvhApiHostingWeb', ($injector) => ({
Database() {
return $injector.get('OvhApiHostingWebDatabase');
},
ExtraSqlPerso() {
return $injector.get('OvhApiHostingWebExtraSqlPerso');
},
ModuleList() {
return $injector.get('OvhApiHostingWebModuleList');
},
Expand Down

0 comments on commit b1c916f

Please sign in to comment.