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

Commit

Permalink
feat: enterprise cloud database apis (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshkumar1989 authored and Jisay committed Sep 27, 2019
1 parent f3c7ee6 commit 944a193
Show file tree
Hide file tree
Showing 36 changed files with 658 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/api/cloudDb/cloudDb.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module('ovh-api-services').service('OvhApiCloudDB', $injector => ({
v6() {
return $injector.get('OvhApiCloudDBV6');
},
Enterprise() {
return $injector.get('OvhApiCloudDBEnterprise');
},
}));
17 changes: 17 additions & 0 deletions src/api/cloudDb/cloudDb.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
angular.module('ovh-api-services').service('OvhApiCloudDBV6', ($resource, $cacheFactory) => {
const queryCache = $cacheFactory('OvhApiCloudDBV6Query');

const cloudDbResource = $resource('/cloudDB', {}, {
query: {
method: 'GET',
isArray: true,
cache: queryCache,
},
});

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

return cloudDbResource;
});
4 changes: 4 additions & 0 deletions src/api/cloudDb/enterprise/backup/backup.iceberg.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseBackupIceberg', iceberg => iceberg('/cloudDB/enterprise/cluster/:clusterId/backup/:backupId', {
clusterId: '@clusterId',
backupId: '@backupId',
}));
8 changes: 8 additions & 0 deletions src/api/cloudDb/enterprise/backup/backup.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseBackup', $injector => ({
v6() {
return $injector.get('OvhApiCloudDBEnterpriseBackupV6');
},
Iceberg() {
return $injector.get('OvhApiCloudDBEnterpriseBackupIceberg');
},
}));
36 changes: 36 additions & 0 deletions src/api/cloudDb/enterprise/backup/backup.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseBackupV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiCloudDBEnterpriseBackupV6');
const queryCache = $cacheFactory('OvhApiCloudDBEnterpriseBackupV6Query');
const interceptor = {
response(response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response;
},
};

const backupResource = $resource('/cloudDB/enterprise/cluster/:clusterId/backup/:backupId', {
clusterId: '@clusterId',
backupId: '@backupId',
}, {
query: { method: 'GET', isArray: true, cache: queryCache },
get: { method: 'GET', cache },
create: { method: 'POST', interceptor },
delete: { method: 'DELETE', interceptor },
});

backupResource.resetAllCache = function () {
backupResource.resetCache();
backupResource.resetQueryCache();
};

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

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

return backupResource;
});
5 changes: 5 additions & 0 deletions src/api/cloudDb/enterprise/endpoint/endpoint.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseEndpoint', $injector => ({
v6() {
return $injector.get('OvhApiCloudDBEnterpriseEndpointV6');
},
}));
27 changes: 27 additions & 0 deletions src/api/cloudDb/enterprise/endpoint/endpoint.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseEndpointV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiCloudDBEnterpriseEndpointV6');
const queryCache = $cacheFactory('OvhApiCloudDBEnterpriseEndpointV6Query');

const endpointResource = $resource('/cloudDB/enterprise/cluster/:clusterId/endpoint/:endpointId', {
clusterId: '@clusterId',
endpointId: '@endpointId',
}, {
query: { method: 'GET', isArray: true, cache: queryCache },
get: { method: 'GET', cache },
});

endpointResource.resetAllCache = function () {
endpointResource.resetCache();
endpointResource.resetQueryCache();
};

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

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

return endpointResource;
});
41 changes: 41 additions & 0 deletions src/api/cloudDb/enterprise/enterprise-cloud-database.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterprise', $injector => ({
Backup() {
return $injector.get('OvhApiCloudDBEnterpriseBackup');
},
Endpoint() {
return $injector.get('OvhApiCloudDBEnterpriseEndpoint');
},
Host() {
return $injector.get('OvhApiCloudDBEnterpriseHost');
},
Logs() {
return $injector.get('OvhApiCloudDBEnterpriseLogs');
},
Maintenance() {
return $injector.get('OvhApiCloudDBEnterpriseMaintenance');
},
MaintenanceWindow() {
return $injector.get('OvhApiCloudDBEnterpriseMaintenanceWindow');
},
Offers() {
return $injector.get('OvhApiCloudDBEnterpriseOffers');
},
Region() {
return $injector.get('OvhApiCloudDBEnterpriseRegion');
},
Restore() {
return $injector.get('OvhApiCloudDBEnterpriseRestore');
},
SecurityGroup() {
return $injector.get('OvhApiCloudDBEnterpriseSecurityGroup');
},
ServiceInfos() {
return $injector.get('OvhApiCloudDBEnterpriseServiceInfos');
},
User() {
return $injector.get('OvhApiCloudDBEnterpriseUser');
},
v6() {
return $injector.get('OvhApiCloudDBEnterpriseClusterV6');
},
}));
39 changes: 39 additions & 0 deletions src/api/cloudDb/enterprise/enterprise-cloud-database.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseClusterV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiCloudDBEnterpriseClusterV6');
const queryCache = $cacheFactory('OvhApiCloudDBEnterpriseClusterV6Query');
const interceptor = {
response(response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response;
},
};

const enterpriseCloudResource = $resource('/cloudDB/enterprise/cluster/:clusterId', {
clusterId: '@clusterId',
}, {
query: { method: 'GET', isArray: true, cache: queryCache },
get: { method: 'GET', cache },
update: { method: 'PUT', interceptor },
scale: {
url: '/cloudDB/enterprise/cluster/:clusterId/scale',
method: 'POST',
interceptor,
},
});

enterpriseCloudResource.resetAllCache = function () {
enterpriseCloudResource.resetCache();
enterpriseCloudResource.resetQueryCache();
};

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

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

return enterpriseCloudResource;
});
5 changes: 5 additions & 0 deletions src/api/cloudDb/enterprise/host/host.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseHost', $injector => ({
v6() {
return $injector.get('OvhApiCloudDBEnterpriseHostV6');
},
}));
27 changes: 27 additions & 0 deletions src/api/cloudDb/enterprise/host/host.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseHostV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiCloudDBEnterpriseHostV6');
const queryCache = $cacheFactory('OvhApiCloudDBEnterpriseHostV6Query');

const hostResource = $resource('/cloudDB/enterprise/cluster/:clusterId/host/:hostId', {
clusterId: '@clusterId',
hostId: '@hostId',
}, {
query: { method: 'GET', isArray: true, cache: queryCache },
get: { method: 'GET', cache },
});

hostResource.resetAllCache = function () {
hostResource.resetCache();
hostResource.resetQueryCache();
};

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

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

return hostResource;
});
5 changes: 5 additions & 0 deletions src/api/cloudDb/enterprise/logs/logs.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseLogs', $injector => ({
v6() {
return $injector.get('OvhApiCloudDBEnterpriseLogsV6');
},
}));
35 changes: 35 additions & 0 deletions src/api/cloudDb/enterprise/logs/logs.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseLogsV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiCloudDBEnterpriseLogsV6');
const queryCache = $cacheFactory('OvhApiCloudDBEnterpriseLogsV6Query');
const interceptor = {
response(response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response;
},
};

const logsResource = $resource('/cloudDB/enterprise/cluster/:clusterId/logs/:logsId', {
clusterId: '@clusterId',
logsId: '@logsId',
}, {
query: { method: 'GET', isArray: true, cache: queryCache },
get: { method: 'GET', cache },
delete: { method: 'DELETE', interceptor },
});

logsResource.resetAllCache = function () {
logsResource.resetCache();
logsResource.resetQueryCache();
};

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

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

return logsResource;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseMaintenanceWindow', $injector => ({
v6() {
return $injector.get('OvhApiCloudDBEnterpriseMaintenanceWindowV6');
},
}));
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseMaintenanceWindowV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiCloudDBEnterpriseMaintenanceWindowV6');
const interceptor = {
response(response) {
cache.remove(response.config.url);
return response;
},
};

const maintenanceWindowResource = $resource('/cloudDB/enterprise/cluster/:clusterId/maintenanceWindow', {
clusterId: '@clusterId',
}, {
get: { method: 'GET', cache },
create: { method: 'POST', interceptor },
update: { method: 'PUT', interceptor },
delete: { method: 'DELETE', interceptor },
});

maintenanceWindowResource.resetAllCache = function () {
maintenanceWindowResource.resetCache();
maintenanceWindowResource.resetQueryCache();
};

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

return maintenanceWindowResource;
});
5 changes: 5 additions & 0 deletions src/api/cloudDb/enterprise/maintenance/maintenance.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseMaintenance', $injector => ({
v6() {
return $injector.get('OvhApiCloudDBEnterpriseMaintenanceV6');
},
}));
35 changes: 35 additions & 0 deletions src/api/cloudDb/enterprise/maintenance/maintenance.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseMaintenanceV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiCloudDBEnterpriseMaintenanceV6');
const queryCache = $cacheFactory('OvhApiCloudDBEnterpriseMaintenanceV6Query');
const interceptor = {
response(response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response;
},
};

const maintenanceResource = $resource('/cloudDB/enterprise/cluster/:clusterId/maintenance/:maintenanceId', {
clusterId: '@clusterId',
maintenanceId: '@maintenanceId',
}, {
query: { method: 'GET', isArray: true, cache: queryCache },
get: { method: 'GET', cache },
delete: { method: 'DELETE', interceptor },
});

maintenanceResource.resetAllCache = function () {
maintenanceResource.resetCache();
maintenanceResource.resetQueryCache();
};

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

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

return maintenanceResource;
});
5 changes: 5 additions & 0 deletions src/api/cloudDb/enterprise/offers/offers.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseOffers', $injector => ({
v6() {
return $injector.get('OvhApiCloudDBEnterpriseOffersV6');
},
}));
39 changes: 39 additions & 0 deletions src/api/cloudDb/enterprise/offers/offers.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseOffersV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiCloudDBEnterpriseOffersV6');
const queryCache = $cacheFactory('OvhApiCloudDBEnterpriseOffersV6Query');

const offersResource = $resource('/cloudDB/enterprise/offer/:name', {
name: '@name',
}, {
query: { method: 'GET', isArray: true, cache: queryCache },
get: { method: 'GET', cache },
getRegions: {
method: 'GET',
isArray: true,
cache,
url: '/cloudDB/enterprise/offer/:name/region',
},
getAvailableHostCount: {
method: 'GET',
url: '/cloudDB/enterprise/offer/:name/region/:regionName',
params: {
regionName: '@regionName',
},
},
});

offersResource.resetAllCache = function () {
offersResource.resetCache();
offersResource.resetQueryCache();
};

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

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

return offersResource;
});
5 changes: 5 additions & 0 deletions src/api/cloudDb/enterprise/region/region.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiCloudDBEnterpriseRegion', $injector => ({
v6() {
return $injector.get('OvhApiCloudDBEnterpriseRegionV6');
},
}));
Loading

0 comments on commit 944a193

Please sign in to comment.