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

Commit

Permalink
feat(dedicatedCloud): add routes (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
antleblanc authored Aug 2, 2018
1 parent 7d44fc2 commit c923ca8
Show file tree
Hide file tree
Showing 44 changed files with 893 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudAllowedNetwork", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiDedicatedCloudAllowedNetworkV6");
}
};

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudAllowedNetworkV6", function ($resource, $cacheFactory) {
"use strict";

var queryCache = $cacheFactory("OvhApiDedicatedCloudAllowedNetworkV6Query");
var cache = $cacheFactory("OvhApiDedicatedCloudAllowedNetworkV6");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.data;
}
};

var networkAllowedResource = $resource("/dedicatedCloud/:serviceName/allowedNetwork/:networkAccessId", {
serviceName: "@serviceName",
networkAccessId: "@networkAccessId"
}, {
get: { method: "GET", cache: cache },
query: { method: "GET", cache: queryCache, isArray: true },
put: { method: "PUT", interceptor: interceptor },
save: { method: "POST", interceptor: interceptor },
"delete": { method: "DELETE", interceptor: interceptor }
});

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

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

return networkAllowedResource;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudDatacenterBackup", function ($injector) {

"use strict";

return {
v6: function () {
return $injector.get("OvhApiDedicatedCloudDatacenterBackupV6");
}
};

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudDatacenterBackupV6", function ($resource, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiDedicatedCloudDatacenterBackupV6");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
return response.data;
}
};

var baseUrl = "/dedicatedCloud/:serviceName/datacenter/:datacenterId/backup";

var backupResource = $resource(baseUrl, {
serviceName: "@serviceName",
datacenterId: "@datacenterId"
}, {
get: { method: "GET", cache: cache },
disable: {
url: baseUrl + "/disable",
method: "POST",
interceptor: interceptor
},
enable: {
url: baseUrl + "/enable",
method: "POST",
interceptor: interceptor
},
changeProperties: {
url: baseUrl + "/changeProperties",
method: "POST",
interceptor: interceptor
}
});

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

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

return backupResource;
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ angular.module("ovh-api-services").service("OvhApiDedicatedCloudDatacenter", fun
},
Host: function () {
return $injector.get("OvhApiDedicatedCloudDatacenterHost");
},
DisasterRecovery: function () {
return $injector.get("OvhApiDedicatedCloudDatacenterDisasterRecovery");
},
Backup: function () {
return $injector.get("OvhApiDedicatedCloudDatacenterBackup");
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudDatacenterDisasterRecovery", function ($injector) {

"use strict";

return {
Zerto: function () {
return $injector.get("OvhApiDedicatedCloudDatacenterDisasterRecoveryZerto");
}
};

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudDatacenterDisasterRecoveryZerto", function ($injector) {

"use strict";

return {
v6: function () {
return $injector.get("OvhApiDedicatedCloudDatacenterDisasterRecoveryZertoV6");
}
};

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudDatacenterDisasterRecoveryZertoV6", function ($resource, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiDedicatedCloudDatacenterDisasterRecoveryZertoV6");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
return response.data;
}
};

var baseUrl = "/dedicatedCloud/:serviceName/datacenter/:datacenterId/disasterRecovery/zerto";

var zertoResource = $resource(baseUrl, {
serviceName: "@serviceName",
datacenterId: "@datacenterId"
}, {
// Method is a POST but acts like a GET
get: {
url: baseUrl + "/state",
method: "POST",
cache: cache,
hasBody: false
},
disable: {
url: baseUrl + "/disable",
method: "POST",
interceptor: interceptor
},
enable: {
url: baseUrl + "/enable",
method: "POST",
interceptor: interceptor
},
generateZsspPassword: {
url: baseUrl + "/generateZsspPassword",
method: "POST",
interceptor: interceptor
}
});

zertoResource.resetAllCache = function () {
zertoResource.resetCache();
};

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

return zertoResource;
});
35 changes: 31 additions & 4 deletions src/dedicatedCloud/dedicatedCloud.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,41 @@ angular.module("ovh-api-services").service("OvhApiDedicatedCloud", function ($in
v6: function () {
return $injector.get("OvhApiDedicatedCloudV6");
},
User: function () {
return $injector.get("OvhApiDedicatedCloudUser");
AllowedNetwork: function () {
return $injector.get("OvhApiDedicatedCloudAllowedNetwork");
},
Datacenter: function () {
return $injector.get("OvhApiDedicatedCloudDatacenter");
},
Federation: function () {
return $injector.get("OvhApiDedicatedCloudFederation");
},
Filer: function () {
return $injector.get("OvhApiDedicatedCloudFiler");
},
Datacenter: function () {
return $injector.get("OvhApiDedicatedCloudDatacenter");
Ip: function () {
return $injector.get("OvhApiDedicatedCloudIp");
},
Location: function () {
return $injector.get("OvhApiDedicatedCloudLocation");
},
Option: function () {
return $injector.get("OvhApiDedicatedCloudOption");
},
Task: function () {
return $injector.get("OvhApiDedicatedCloudTask");
},
User: function () {
return $injector.get("OvhApiDedicatedCloudUser");
},
Vlan: function () {
return $injector.get("OvhApiDedicatedCloudVlan");
},
VMEncryption: function () {
return $injector.get("OvhApiDedicatedCloudVMEncryption");
},
VRack: function () {
return $injector.get("OvhApiDedicatedCloudVRack");
}
};

Expand Down
5 changes: 5 additions & 0 deletions src/dedicatedCloud/dedicatedCloud.v6.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ angular.module("ovh-api-services").service("OvhApiDedicatedCloudV6", function ($
url: "/dedicatedCloud/:serviceName/confirmTermination",
method: "POST",
interceptor: interceptor
},
hcx: {
url: "/dedicatedCloud/:serviceName/hcx",
method: "GET",
cache: cache
}
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudFederationActiveDirectory", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiDedicatedCloudFederationActiveDirectoryV6");
}
};

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudFederationActiveDirectoryV6", function ($resource, $cacheFactory) {
"use strict";

var queryCache = $cacheFactory("OvhApiDedicatedCloudFederationActiveDirectoryV6Query");
var cache = $cacheFactory("OvhApiDedicatedCloudFederationActiveDirectoryV6");

var activeDirectoryResource = $resource("/dedicatedCloud/:serviceName/federation/activeDirectory/:activeDirectoryId", {
serviceName: "@serviceName",
activeDirectoryId: "@activeDirectoryId"
}, {
query: { method: "GET", cache: queryCache, isArray: true },
get: { method: "GET", cache: cache }
});

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

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

return activeDirectoryResource;
});
13 changes: 13 additions & 0 deletions src/dedicatedCloud/federation/dedicatedCloud-federation.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudFederation", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiDedicatedCloudFederationV6");
},
ActiveDirectory: function () {
return $injector.get("OvhApiDedicatedCloudFederationActiveDirectory");
}
};

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudFederationV6", function ($resource, $cacheFactory) {
"use strict";

var queryCache = $cacheFactory("OvhApiDedicatedCloudFederationV6Query");

var federationResource = $resource("/dedicatedCloud/:serviceName/federation", {
serviceName: "@serviceName"
}, {
query: { method: "GET", cache: queryCache }
});

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

return federationResource;
});
10 changes: 10 additions & 0 deletions src/dedicatedCloud/ip/dedicatedCloud-ip.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudIp", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiDedicatedCloudIpV6");
}
};

});
24 changes: 24 additions & 0 deletions src/dedicatedCloud/ip/dedicatedCloud-ip.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudIpV6", function ($resource, $cacheFactory) {
"use strict";

var queryCache = $cacheFactory("OvhApiDedicatedCloudIpV6Query");
var cache = $cacheFactory("OvhApiDedicatedCloudIpV6");

var ipResource = $resource("/dedicatedCloud/:serviceName/ip/:network", {
serviceName: "@serviceName",
network: "@network"
}, {
query: { method: "GET", cache: queryCache, isArray: true },
get: { method: "GET", cache: cache }
});

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

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

return ipResource;
});
19 changes: 19 additions & 0 deletions src/dedicatedCloud/location/dedicatedCloud-location.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
angular.module("ovh-api-services").service("OvhApiDedicatedCloudLocation", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiDedicatedCloudLocationV6");
},
Stock: function () {
return $injector.get("OvhApiDedicatedCloudLocationStock");
},
Hypervisor: function () {
return $injector.get("OvhApiDedicatedCloudLocationHypervisor");
},
HostProfile: function () {
return $injector.get("OvhApiDedicatedCloudLocationHostProfile");
}
};

});
Loading

0 comments on commit c923ca8

Please sign in to comment.