From 2aec679542e1672f59ebe58d6b194518c8797ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Martin?= Date: Thu, 11 Oct 2018 13:33:29 +0200 Subject: [PATCH] feat(hosting): add private database routes --- .../hosting-private-database.service.js | 12 ++++ .../hosting-private-database.v6.service.js | 47 +++++++++++++ ...ting-private-database-whitelist.service.js | 9 +++ ...g-private-database-whitelist.v6.service.js | 66 ++++++++++++++++++ .../order-hosting-private-database.service.js | 9 +++ ...der-hosting-private-database.v6.service.js | 68 +++++++++++++++++++ 6 files changed, 211 insertions(+) create mode 100644 src/hosting/privateDatabase/hosting-private-database.service.js create mode 100644 src/hosting/privateDatabase/hosting-private-database.v6.service.js create mode 100644 src/hosting/privateDatabase/whitelist/hosting-private-database-whitelist.service.js create mode 100644 src/hosting/privateDatabase/whitelist/hosting-private-database-whitelist.v6.service.js create mode 100644 src/order/hosting/privateDatabase/order-hosting-private-database.service.js create mode 100644 src/order/hosting/privateDatabase/order-hosting-private-database.v6.service.js diff --git a/src/hosting/privateDatabase/hosting-private-database.service.js b/src/hosting/privateDatabase/hosting-private-database.service.js new file mode 100644 index 00000000..c439ac84 --- /dev/null +++ b/src/hosting/privateDatabase/hosting-private-database.service.js @@ -0,0 +1,12 @@ +angular.module("ovh-api-services").service("OvhApiHostingPrivateDatabase", function ($injector) { + "use strict"; + + return { + v6: function () { + return $injector.get("OvhApiHostingPrivateDatabaseV6"); + }, + Whitelist: function () { + return $injector.get("OvhApiHostingPrivateDatabaseWhitelist"); + } + }; +}); diff --git a/src/hosting/privateDatabase/hosting-private-database.v6.service.js b/src/hosting/privateDatabase/hosting-private-database.v6.service.js new file mode 100644 index 00000000..31266f78 --- /dev/null +++ b/src/hosting/privateDatabase/hosting-private-database.v6.service.js @@ -0,0 +1,47 @@ +angular.module("ovh-api-services").service("OvhApiHostingPrivateDatabaseV6", function ($resource, $cacheFactory) { + "use strict"; + + var cache = $cacheFactory("OvhApiHostingPrivateDatabaseV6Cache"); + + var interceptor = { + response: function (response) { + cache.removeAll(); + return response; + } + }; + + var resource = $resource("/hosting/privateDatabase/:serviceName", { + serviceName: "@serviceName" + }, { + query: { + method: "GET", + isArray: true, + cache: cache + }, + get: { + method: "GET", + cache: cache + }, + put: { + method: "PUT", + interceptor: interceptor + }, + availableOrderCapacities: { + method: "GET", + url: "/hosting/privateDatabase/availableOrderCapacities", + params: { + offer: "@offer" + } + } + }); + + resource.resetAllCache = function () { + resource.resetCache(); + }; + + resource.resetCache = function () { + cache.removeAll(); + }; + + return resource; +}); diff --git a/src/hosting/privateDatabase/whitelist/hosting-private-database-whitelist.service.js b/src/hosting/privateDatabase/whitelist/hosting-private-database-whitelist.service.js new file mode 100644 index 00000000..bfd026f2 --- /dev/null +++ b/src/hosting/privateDatabase/whitelist/hosting-private-database-whitelist.service.js @@ -0,0 +1,9 @@ +angular.module("ovh-api-services").service("OvhApiHostingPrivateDatabaseWhitelist", function ($injector) { + "use strict"; + + return { + v6: function () { + return $injector.get("OvhApiHostingPrivateDatabaseWhitelistV6"); + } + }; +}); diff --git a/src/hosting/privateDatabase/whitelist/hosting-private-database-whitelist.v6.service.js b/src/hosting/privateDatabase/whitelist/hosting-private-database-whitelist.v6.service.js new file mode 100644 index 00000000..8d549eea --- /dev/null +++ b/src/hosting/privateDatabase/whitelist/hosting-private-database-whitelist.v6.service.js @@ -0,0 +1,66 @@ +angular.module("ovh-api-services").service("OvhApiHostingPrivateDatabaseWhitelistV6", function ($resource, $cacheFactory) { + "use strict"; + + var cache = $cacheFactory("OvhApiHostingPrivateDatabaseWhitelistV6Cache"); + + var interceptor = { + response: function (response) { + cache.removeAll(); + return response; + } + }; + + var resource = $resource("/hosting/privateDatabase/:serviceName/whitelist", { + serviceName: "@serviceName" + }, { + query: { + method: "GET", + isArray: true, + cache: cache, + params: { + ip: "@ip", + service: "@service", + sftp: "@sftp" + } + }, + post: { + method: "POST", + interceptor: interceptor + }, + getIp: { + method: "GET", + url: "/hosting/privateDatabase/:serviceName/whitelist/:ip", + params: { + ip: "@ip" + }, + cache: cache + }, + putIp: { + method: "PUT", + url: "/hosting/privateDatabase/:serviceName/whitelist/:ip", + params: { + ip: "@ip", + whitelist: "@whitelist" + }, + interceptor: interceptor + }, + deleteIp: { + method: "DELETE", + url: "/hosting/privateDatabase/:serviceName/whitelist/:ip", + params: { + ip: "@ip" + }, + interceptor: interceptor + } + }); + + resource.resetAllCache = function () { + resource.resetCache(); + }; + + resource.resetCache = function () { + cache.removeAll(); + }; + + return resource; +}); diff --git a/src/order/hosting/privateDatabase/order-hosting-private-database.service.js b/src/order/hosting/privateDatabase/order-hosting-private-database.service.js new file mode 100644 index 00000000..85f642eb --- /dev/null +++ b/src/order/hosting/privateDatabase/order-hosting-private-database.service.js @@ -0,0 +1,9 @@ +angular.module("ovh-api-services").service("OvhApiOrderPrivateDatabase", function ($injector) { + "use strict"; + + return { + v6: function () { + return $injector.get("OvhApiOrderPrivateDatabaseV6"); + } + }; +}); diff --git a/src/order/hosting/privateDatabase/order-hosting-private-database.v6.service.js b/src/order/hosting/privateDatabase/order-hosting-private-database.v6.service.js new file mode 100644 index 00000000..e22dcf70 --- /dev/null +++ b/src/order/hosting/privateDatabase/order-hosting-private-database.v6.service.js @@ -0,0 +1,68 @@ +angular.module("ovh-api-services").service("OvhApiOrderPrivateDatabaseV6", function ($resource) { + "use strict"; + + return $resource("/order/hosting/privateDatabase/:serviceName", { + serviceName: "@serviceName" + }, { + query: { + method: "GET", + isArray: true + }, + get: { + method: "GET", + isArray: true + }, + getNew: { + method: "GET", + url: "/order/hosting/privateDatabase/:serviceName/new", + isArray: true, + params: { + datacenter: "@datacenter", + offer: "@offer", + ram: "@ram", + version: "@version" + } + }, + getNewDetails: { + method: "GET", + url: "/order/hosting/privateDatabase/:serviceName/new/:duration", + params: { + duration: "@duration", + datacenter: "@datacenter", + offer: "@offer", + ram: "@ram", + version: "@version" + } + }, + orderNew: { + method: "POST", + url: "/order/hosting/privateDatabase/:serviceName/new/:duration", + params: { + duration: "@duration" + } + }, + getRam: { + method: "GET", + url: "/order/hosting/privateDatabase/:serviceName/ram", + isArray: true, + params: { + ram: "@ram" + } + }, + getRamDetails: { + method: "GET", + url: "/order/hosting/privateDatabase/:serviceName/ram/:duration", + params: { + duration: "@duration", + ram: "@ram" + } + }, + orderRam: { + method: "POST", + url: "/order/hosting/privateDatabase/:serviceName/ram/:duration", + params: { + duration: "@duration" + } + } + }); +});