6363import io .github .kubesys .client .core .KubernetesRuleBase ;
6464import io .github .kubesys .client .utils .ReqUtil ;
6565import io .github .kubesys .client .utils .SSLUtil ;
66+ import io .github .kubesys .client .utils .URLUtil ;
6667
6768/**
6869 * This class is used for creating a connection between users' application and Kubernetes server.
@@ -356,6 +357,28 @@ public boolean hasResource(String kind, String namespace, String name) throws Ex
356357 public JsonNode listResources (String kind ) throws Exception {
357358 return listResources (kind , KubernetesConstants .VALUE_ALL_NAMESPACES , null , null , 0 , null );
358359 }
360+
361+ /**
362+ * list all Kubernetes resources using kind
363+ *
364+ * @param kind kind
365+ * @return json json
366+ * @throws Exception Kubernetes cannot parsing this jsonStr
367+ */
368+ public JsonNode listResourcesWithField (String kind , Map <String , String > fields ) throws Exception {
369+ return listResources (kind , KubernetesConstants .VALUE_ALL_NAMESPACES , URLUtil .fromMap (fields ), null , 0 , null );
370+ }
371+
372+ /**
373+ * list all Kubernetes resources using kind
374+ *
375+ * @param kind kind
376+ * @return json json
377+ * @throws Exception Kubernetes cannot parsing this jsonStr
378+ */
379+ public JsonNode listResourcesWithLabel (String kind , Map <String , String > labels ) throws Exception {
380+ return listResources (kind , KubernetesConstants .VALUE_ALL_NAMESPACES , null , URLUtil .fromMap (labels ), 0 , null );
381+ }
359382
360383 /**
361384 * list all Kubernetes resources using kind and namespace
@@ -368,6 +391,29 @@ public JsonNode listResources(String kind) throws Exception {
368391 public JsonNode listResources (String kind , String namespace ) throws Exception {
369392 return listResources (kind , namespace , null , null , 0 , null );
370393 }
394+
395+ /**
396+ * list all Kubernetes resources using kind
397+ *
398+ * @param kind kind
399+ * @return json json
400+ * @throws Exception Kubernetes cannot parsing this jsonStr
401+ */
402+ public JsonNode listResourcesWithField (String kind , String namespace , Map <String , String > fields ) throws Exception {
403+ return listResources (kind , namespace , URLUtil .fromMap (fields ), null , 0 , null );
404+ }
405+
406+ /**
407+ * list all Kubernetes resources using kind and namespace
408+ *
409+ * @param kind kind
410+ * @param namespace namespace
411+ * @return json json
412+ * @throws Exception Kubernetes cannot parsing this jsonStr
413+ */
414+ public JsonNode listResourcesWithLabel (String kind , String namespace , Map <String , String > labels ) throws Exception {
415+ return listResources (kind , namespace , null , URLUtil .fromMap (labels ), 0 , null );
416+ }
371417
372418 /**
373419 * list all Kubernetes resources using kind, namespace, fieldSelector and
0 commit comments