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

Commit

Permalink
feat(cloud.project): add kubernetes routes under cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
marie-j authored and jleveugle committed May 9, 2019
1 parent 8705f43 commit eec80bd
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cloud/project/kube/cloud-project-kube.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ angular.module("ovh-api-services").service("OvhApiCloudProjectKube", function ($
return {
Aapi: function () {
return $injector.get("OvhApiCloudProjectKubeAapi");
},
v6: function () {
$injector.get("OvhApiCloudProjectKubeV6");
},
Node: function () {
$injector.get("OvhApiCloudProjectKubeNode");
}
};

Expand Down
71 changes: 71 additions & 0 deletions src/cloud/project/kube/cloud-project-kube.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
angular.module("ovh-api-services").service("OvhApiCloudProjectKubeV6", function ($cacheFactory, $resource) {
"use strict";

var cache = $cacheFactory("OvhApiCloudProjectKubeV6");
var queryCache = $cacheFactory("OvhApiCloudProjectKubeV6Query");

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

var kubeResource = $resource("/cloud/project/:serviceName/kube/:kubeId", {
serviceName: "@serviceName",
kubeId: "@kubeId"
}, {
query: { method: "GET", isArray: true, cache: queryCache },
get: { method: "GET", cache: cache },
save: {
method: "POST",
interceptor: interceptor
},
update: {
method: "PUT",
interceptor: interceptor,
params: {
name: "@name"
}
},
"delete": {
method: "DELETE",
interceptor: interceptor
},
getKubeConfig: {
url: "/cloud/project/:serviceName/kube/:kubeId/kubeconfig",
method: "GET",
cache: cache
},
reset: {
url: "/cloud/project/:serviceName/kube/:kubeId/reset",
method: "POST",
interceptor: interceptor
},
updateVersion: {
url: "/cloud/project/:serviceName/kube/:kubeId/update",
method: "POST",
interceptor: interceptor
},
updatePolicy: {
url: "/cloud/project/:serviceName/kube/:kubeId/updatePolicy",
method: "PUT",
interceptor: interceptor
},
getSchema: {
url: "/kube.json",
method: "GET"
}
});

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

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

return kubeResource;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module("ovh-api-services").service("OvhApiCloudProjectKubeNode", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiCloudProjectKubeNodeV6");
}
};
});
41 changes: 41 additions & 0 deletions src/cloud/project/kube/node/cloud-project-kube-node.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
angular.module("ovh-api-services").service("OvhApiCloudProjectKubeNodeV6", function ($resource, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiCloudProjectKubeNodeV6");
var queryCache = $cacheFactory("OvhApiCloudProjectKubeNodeV6Query");

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

var nodeResource = $resource("/cloud/project/:serviceName/kube/:kubeId/node/:nodeId", {
serviceName: "@serviceName",
kubeId: "@kubeId",
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;
});

0 comments on commit eec80bd

Please sign in to comment.