@@ -177,6 +177,30 @@ public KubernetesClient(String url, String token, KubernetesAnalyzer analyzer) t
177177 *
178178 **********************************************************/
179179
180+ /**
181+ * create a Kubernetes resource using JSON. <br>
182+ *
183+ * for example, a json can be <br>
184+ * { <br>
185+ * "apiVersion": "v1", <br>
186+ * "kind": "Pod", <br>
187+ * "metadata": { <br>
188+ * "name": "busybox", <br>
189+ * "namespace": "default", <br>
190+ * "labels": { <br>
191+ * "test": "test" <br>
192+ * } <br>
193+ * } <br>
194+ * } <br>
195+ *
196+ * @param json json object, which must meet the Kubernetes' specification
197+ * @return json Kubernetes may add come fields according to Kubernetes' context
198+ * @throws Exception see link HttpCaller.getResponse
199+ */
200+ public JsonNode createResource (String json ) throws Exception {
201+ return createResource (new ObjectMapper ().readTree (json ));
202+ }
203+
180204 /**
181205 * create a Kubernetes resource using JSON. <br>
182206 *
@@ -204,6 +228,30 @@ public JsonNode createResource(JsonNode json) throws Exception {
204228 return requester .getResponse (request );
205229 }
206230
231+ /**
232+ * delete a Kubernetes resource using JSON <br>
233+ *
234+ * for example, a json can be <br>
235+ * { <br>
236+ * "apiVersion": "v1", <br>
237+ * "kind": "Pod", <br>
238+ * "metadata": { <br>
239+ * "name": "busybox", <br>
240+ * "namespace": "default", <br>
241+ * "labels": { <br>
242+ * "test": "test" <br>
243+ * } <br>
244+ * } <br>
245+ * } <br>
246+ *
247+ * @param json json object, which must meet the Kubernetes' specification
248+ * @return json the deleted object with json style
249+ * @throws Exception see HttpCaller.getResponse
250+ */
251+ public JsonNode deleteResource (String json ) throws Exception {
252+ return deleteResource (new ObjectMapper ().readTree (json ));
253+ }
254+
207255 /**
208256 * delete a Kubernetes resource using JSON <br>
209257 *
@@ -262,6 +310,30 @@ public JsonNode deleteResource(String kind, String namespace, String name) throw
262310 return requester .getResponse (request );
263311 }
264312
313+ /**
314+ * update a Kubernetes resource using JSON
315+ *
316+ * for example, a json can be <br>
317+ * { <br>
318+ * "apiVersion": "v1", <br>
319+ * "kind": "Pod", <br>
320+ * "metadata": { <br>
321+ * "name": "busybox", <br>
322+ * "namespace": "default", <br>
323+ * "labels": { <br>
324+ * "test": "test" <br>
325+ * } <br>
326+ * } <br>
327+ * } <br>
328+ *
329+ * @param json json object, which must meet the Kubernetes' specification
330+ * @return json updated object with json style
331+ * @throws Exception see HttpCaller.getResponse
332+ */
333+ public JsonNode updateResource (String json ) throws Exception {
334+ return updateResource (new ObjectMapper ().readTree (json ));
335+ }
336+
265337 /**
266338 * update a Kubernetes resource using JSON
267339 *
@@ -473,6 +545,17 @@ public JsonNode listResources(String kind, String namespace, String fieldSelecto
473545 }
474546
475547
548+ /**
549+ * update a Kubernetes resource status using JSON
550+ *
551+ * @param json json
552+ * @return json json
553+ * @throws Exception Kubernetes cannot parsing this jsonStr
554+ */
555+ public JsonNode updateResourceStatus (String json ) throws Exception {
556+ return updateResourceStatus (new ObjectMapper ().readTree (json ));
557+ }
558+
476559 /**
477560 * update a Kubernetes resource status using JSON
478561 *
0 commit comments