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

Commit

Permalink
feat(kube): add routes for kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
marie-j committed Sep 25, 2018
1 parent e63c186 commit 69db548
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cloud/project/flavor/cloud-project-flavor.v6.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ angular.module("ovh-api-services").service("OvhApiCloudProjectFlavorV6", functio
method: "GET",
cache: cache,
isArray: true,
queryParams: {
region: "@region"
},
transformResponse: function (flvs, headers, status) {
var flavors = flvs;

Expand Down
11 changes: 11 additions & 0 deletions src/kube/kube.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
angular.module("ovh-api-services").service("OvhApiKube", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiKubeV6");
},
PublicCloud: function () {
return $injector.get("OvhApiKubePublicCloud");
}
};
});
41 changes: 41 additions & 0 deletions src/kube/kube.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
angular.module("ovh-api-services").service("OvhApiKubeV6", function ($resource, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiKubeV6");
var queryCache = $cacheFactory("OvhApiKubeV6Query");

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

var kubeResource = $resource("/kube/:serviceName", {
serviceName: "@serviceName"
}, {
query: { method: "GET", isArray: true, cache: queryCache },
get: { method: "GET", cache: cache },
getServiceInfos: {
url: "/kube/:serviceName/serviceInfos",
method: "GET",
cache: cache
},
putServiceInfos: {
url: "/kube/:serviceName/serviceInfos",
method: "PUT",
interceptor: interceptor
}
});

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

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

return kubeResource;
});
11 changes: 11 additions & 0 deletions src/kube/publiccloud/kube-publiccloud.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
angular.module("ovh-api-services").service("OvhApiKubePublicCloud", function ($injector) {
"use strict";
return {
Node: function () {
return $injector.get("OvhApiKubePublicCloudNode");
},
Project: function () {
return $injector.get("OvhApiKubePublicCloudProject");
}
};
});
8 changes: 8 additions & 0 deletions src/kube/publiccloud/node/kube-publiccloud-node.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module("ovh-api-services").service("OvhApiKubePublicCloudNode", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiKubePublicCloudNodeV6");
}
};
});
40 changes: 40 additions & 0 deletions src/kube/publiccloud/node/kube-publiccloud-node.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
angular.module("ovh-api-services").service("OvhApiKubePublicCloudNodeV6", function ($resource, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiKubePublicCloudNodeV6");
var queryCache = $cacheFactory("OvhApiKubePublicCloudNodeV6Query");

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

var nodeResource = $resource("/kube/:serviceName/publiccloud/node/:nodeId", {
serviceName: "@serviceName",
nodeId: "@nodeId"
}, {
query: { method: "GET", isArray: true, cache: queryCache },
get: { method: "GET", cache: cache },
save: {
method: "POST",
interceptor: interceptor,
params: {
flavorName: "@flavorName"
}
},
"delete": { method: "DELETE", interceptor: interceptor }
});

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

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

return nodeResource;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module("ovh-api-services").service("OvhApiKubePublicCloudProject", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiKubePublicCloudProjectV6");
}
};
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
angular.module("ovh-api-services").service("OvhApiKubePublicCloudProjectV6", function ($resource, $cacheFactory) {
"use strict";

var queryCache = $cacheFactory("OvhApiKubePublicCloudProjectV6Query");

var projectResource = $resource("/kube/:serviceName/publiccloud/project", {
serviceName: "@serviceName"
}, {
query: { method: "GET", isArray: true, cache: queryCache }
});

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

return projectResource;
});

0 comments on commit 69db548

Please sign in to comment.