From befe1cef679c2fa31fd2d3ec20399968ba1ccf68 Mon Sep 17 00:00:00 2001 From: Frederic Espiau Date: Wed, 12 Feb 2020 15:10:58 +0100 Subject: [PATCH] feat(hosting): add extraSqlPerso path Signed-off-by: Frederic Espiau --- .../extraSqlPerso/extraSqlPerso.service.js | 5 ++ .../extraSqlPerso/extraSqlPerso.v6.service.js | 63 +++++++++++++++++++ src/api/hosting/web/web.service.js | 3 + 3 files changed, 71 insertions(+) create mode 100644 src/api/hosting/web/extraSqlPerso/extraSqlPerso.service.js create mode 100644 src/api/hosting/web/extraSqlPerso/extraSqlPerso.v6.service.js diff --git a/src/api/hosting/web/extraSqlPerso/extraSqlPerso.service.js b/src/api/hosting/web/extraSqlPerso/extraSqlPerso.service.js new file mode 100644 index 00000000..d65c2ad4 --- /dev/null +++ b/src/api/hosting/web/extraSqlPerso/extraSqlPerso.service.js @@ -0,0 +1,5 @@ +angular.module('ovh-api-services').service('OvhApiHostingWebExtraSqlPerso', ($injector) => ({ + v6() { + return $injector.get('OvhApiHostingWebExtraSqlPersoV6'); + }, +})); diff --git a/src/api/hosting/web/extraSqlPerso/extraSqlPerso.v6.service.js b/src/api/hosting/web/extraSqlPerso/extraSqlPerso.v6.service.js new file mode 100644 index 00000000..bfb2c37a --- /dev/null +++ b/src/api/hosting/web/extraSqlPerso/extraSqlPerso.v6.service.js @@ -0,0 +1,63 @@ +angular.module('ovh-api-services').service('OvhApiHostingWebExtraSqlPersoV6', ($cacheFactory, $resource) => { + const cache = $cacheFactory('OvhApiHostingWebExtraSqlPersoV6'); + const queryCache = $cacheFactory('OvhApiHostingWebExtraSqlPersoV6Query'); + + 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; +}); diff --git a/src/api/hosting/web/web.service.js b/src/api/hosting/web/web.service.js index 8703bc25..8b1fd783 100644 --- a/src/api/hosting/web/web.service.js +++ b/src/api/hosting/web/web.service.js @@ -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'); },