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 private database routes
Browse files Browse the repository at this point in the history
  • Loading branch information
euhmeuh authored and antleblanc committed Oct 11, 2018
1 parent f1e4eb3 commit 2aec679
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/hosting/privateDatabase/hosting-private-database.service.js
Original file line number Diff line number Diff line change
@@ -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");
}
};
});
47 changes: 47 additions & 0 deletions src/hosting/privateDatabase/hosting-private-database.v6.service.js
Original file line number Diff line number Diff line change
@@ -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;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
angular.module("ovh-api-services").service("OvhApiHostingPrivateDatabaseWhitelist", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiHostingPrivateDatabaseWhitelistV6");
}
};
});
Original file line number Diff line number Diff line change
@@ -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;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
angular.module("ovh-api-services").service("OvhApiOrderPrivateDatabase", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiOrderPrivateDatabaseV6");
}
};
});
Original file line number Diff line number Diff line change
@@ -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"
}
}
});
});

0 comments on commit 2aec679

Please sign in to comment.