This repository has been archived by the owner on Apr 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kube): add routes for kubernetes
- Loading branch information
Showing
8 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
40
src/kube/publiccloud/node/kube-publiccloud-node.v6.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); |
8 changes: 8 additions & 0 deletions
8
src/kube/publiccloud/project/kube-publiccloud-project.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
}; | ||
}); |
17 changes: 17 additions & 0 deletions
17
src/kube/publiccloud/project/kube-publiccloud-project.v6.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); |