MCPcopy Create free account
hub / github.com/KubeHelper/kubehelper / KubeAPI

Class KubeAPI

src/main/java/com/kubehelper/common/KubeAPI.java:58–381  ·  view source on GitHub ↗

@author JDev

Source from the content-addressed store, hash-verified

56 * @author JDev
57 */
58@Service
59public class KubeAPI {
60
61 private static Logger logger = LoggerFactory.getLogger(KubeAPI.class);
62
63 @Autowired
64 private CoreV1Api apiV1;
65
66 @Autowired
67 private AppsV1Api appsV1Api;
68
69 @Autowired
70 private BatchV1Api batchV1Api;
71
72 @Autowired
73 private RbacAuthorizationV1beta1Api rbacAuthorizationV1beta1Api;
74
75 @Autowired
76 private NetworkingV1Api networkingApi;
77
78 @Autowired
79 private PolicyV1beta1Api policyV1beta1Api;
80
81
82 public V1DeploymentList getV1DeploymentList(String selectedNamespace, PageModel model) {
83 try {
84 if ("all".equals(selectedNamespace)) {
85 return appsV1Api.listDeploymentForAllNamespaces(null, null, null, null, null, null, null, null, null);
86 } else {
87 return appsV1Api.listNamespacedDeployment(selectedNamespace, null, null, null, null, null, null, null, null, null);
88 }
89 } catch (ApiException e) {
90 String errorMessage = String.format("Error at getV1DeploymentList: namespace=%s. Message: %s", selectedNamespace, e.getMessage());
91 model.addException(errorMessage, e);
92 logger.error(errorMessage, e);
93 }
94 return new V1DeploymentList();
95 }
96
97 public V1DaemonSetList getV1DaemonSetList(String selectedNamespace, PageModel model) {
98 try {
99 if ("all".equals(selectedNamespace)) {
100 return appsV1Api.listDaemonSetForAllNamespaces(null, null, null, null, null, null, null, null, null);
101 } else {
102 return appsV1Api.listNamespacedDaemonSet(selectedNamespace, null, null, null, null, null, null, null, null, null);
103 }
104 } catch (ApiException e) {
105 String errorMessage = String.format("Error at getV1DaemonSetList: namespace=%s. Message: %s", selectedNamespace, e.getMessage());
106 model.addException(errorMessage, e);
107 logger.error(errorMessage, e);
108 }
109 return new V1DaemonSetList();
110 }
111
112 public V1ReplicaSetList getV1ReplicaSetList(String selectedNamespace, PageModel model) {
113 try {
114 if ("all".equals(selectedNamespace)) {
115 return appsV1Api.listReplicaSetForAllNamespaces(null, null, null, null, null, null, null, null, null);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected