new-integration-tests/src/test/java/oracle/weblogic/kubernetes/assertions/impl/Kubernetes.java
public static void listServices(String namespace, String labelSelectors) throws ApiException {
    LoggingFacade logger = getLogger();
    V1ServiceList v1ServiceList
        = coreV1Api.listServiceForAllNamespaces(
        Boolean.FALSE, // allowWatchBookmarks requests watch events with type "BOOKMARK".
        null, // continue to query when there is more results to return.
        null, // selector to restrict the list of returned objects by their fields
        labelSelectors, // selector to restrict the list of returned objects by their labels.
        null, // maximum number of responses to return for a list call.
        Boolean.FALSE.toString(), // pretty print output.
        null, // shows changes that occur after that particular version of a resource.
        null, // Timeout for the list/watch call.
        Boolean.FALSE // Watch for changes to the described resources.
        );
    List<V1Service> items = v1ServiceList.getItems();
    logger.info(Arrays.toString(items.toArray()));
    for (V1Service service : items) {
      logger.info("Service Name : " + service.getMetadata().getName());
      logger.info("Service Namespace : " + service.getMetadata().getNamespace());
      logger.info("Service ResourceVersion : " + service.getMetadata().getResourceVersion());
      logger.info("Service SelfLink : " + service.getMetadata().getSelfLink());
      logger.info("Service Uid :" + service.getMetadata().getUid());
      logger.info("Service Spec Cluster IP : " + service.getSpec().getClusterIP());
      logger.info("Service Spec getExternalIPs : " + service.getSpec().getExternalIPs());
      logger.info("Service Spec getExternalName : " + service.getSpec().getExternalName());
      logger.info("Service Spec getPorts : " + service.getSpec().getPorts());
      logger.info("Service Spec getType : " + service.getSpec().getType());
      Map<String, String> labels = service.getMetadata().getLabels();
      if (labels != null) {
        for (Map.Entry<String, String> entry : labels.entrySet()) {
          logger.log(Level.INFO, "LABEL KEY: {0} LABEL VALUE: {1}",
              new Object[]{entry.getKey(), entry.getValue()});
        }
      }
    }
  }
/**
   * A utillity method to list all services in a given namespace.
   * This method can be used as diagnostic tool to get the details of services.
   * @param namespace in which to list all services
   * @param labelSelectors  with which the services are decorated
   * @throws ApiException when there is error in querying the cluster
   */
A utillity method to list all services in a given namespace.
This method can be used as diagnostic tool to get the details of services.
@param namespace in which to list all services
@param labelSelectors  with which the services are decorated
@throws ApiException when there is error in querying the cluster
A utillity method to list all services in a given namespace . This method can be used as diagnostic tool to get the details of services . @param namespace in which to list all services @param labelSelectors with which the services are decorated @throws ApiException when there is error in querying the cluster
public static void listServices(String namespace, String labelSelectors) throws ApiException {
    LoggingFacade logger = getLogger();
    V1ServiceList v1ServiceList
        = coreV1Api.listServiceForAllNamespaces(
        Boolean.FALSE, 
        null, 
        null, 
        labelSelectors, 
        null, 
        Boolean.FALSE.toString(), 
        null, 
        null, 
        Boolean.FALSE 
        );
    List<V1Service> items = v1ServiceList.getItems();
    logger.info(Arrays.toString(items.toArray()));
    for (V1Service service : items) {
      logger.info("Service Name : " + service.getMetadata().getName());
      logger.info("Service Namespace : " + service.getMetadata().getNamespace());
      logger.info("Service ResourceVersion : " + service.getMetadata().getResourceVersion());
      logger.info("Service SelfLink : " + service.getMetadata().getSelfLink());
      logger.info("Service Uid :" + service.getMetadata().getUid());
      logger.info("Service Spec Cluster IP : " + service.getSpec().getClusterIP());
      logger.info("Service Spec getExternalIPs : " + service.getSpec().getExternalIPs());
      logger.info("Service Spec getExternalName : " + service.getSpec().getExternalName());
      logger.info("Service Spec getPorts : " + service.getSpec().getPorts());
      logger.info("Service Spec getType : " + service.getSpec().getType());
      Map<String, String> labels = service.getMetadata().getLabels();
      if (labels != null) {
        for (Map.Entry<String, String> entry : labels.entrySet()) {
          logger.log(Level.INFO, "LABEL KEY: {0} LABEL VALUE: {1}",
              new Object[]{entry.getKey(), entry.getValue()});
        }
      }
    }
  }
public static void listServices ( String namespace , String labelSelectors ) throws ApiException { LoggingFacade logger = getLogger ( ) ; V1ServiceList v1ServiceList = coreV1Api . listServiceForAllNamespaces ( Boolean . FALSE , null , null , labelSelectors , null , Boolean . FALSE . toString ( ) , null , null , Boolean . FALSE ) ; List < V1Service > items = v1ServiceList . getItems ( ) ; logger . info ( Arrays . toString ( items . toArray ( ) ) ) ; for ( V1Service service : items ) { logger . info ( "Service Name : " + service . getMetadata ( ) . getName ( ) ) ; logger . info ( "Service Namespace : " + service . getMetadata ( ) . getNamespace ( ) ) ; logger . info ( "Service ResourceVersion : " + service . getMetadata ( ) . getResourceVersion ( ) ) ; logger . info ( "Service SelfLink : " + service . getMetadata ( ) . getSelfLink ( ) ) ; logger . info ( "Service Uid :" + service . getMetadata ( ) . getUid ( ) ) ; logger . info ( "Service Spec Cluster IP : " + service . getSpec ( ) . getClusterIP ( ) ) ; logger . info ( "Service Spec getExternalIPs : " + service . getSpec ( ) . getExternalIPs ( ) ) ; logger . info ( "Service Spec getExternalName : " + service . getSpec ( ) . getExternalName ( ) ) ; logger . info ( "Service Spec getPorts : " + service . getSpec ( ) . getPorts ( ) ) ; logger . info ( "Service Spec getType : " + service . getSpec ( ) . getType ( ) ) ; Map < String , String > labels = service . getMetadata ( ) . getLabels ( ) ; if ( labels != null ) { for ( Map . Entry < String , String > entry : labels . entrySet ( ) ) { logger . log ( Level . INFO , "LABEL KEY: {0} LABEL VALUE: {1}" , new Object [ ] { entry . getKey ( ) , entry . getValue ( ) } ) ; } } } }
A utillity method to list all services in a given namespace.
A utillity method to list all services in a given namespace .
// allowWatchBookmarks requests watch events with type "BOOKMARK". // continue to query when there is more results to return. // selector to restrict the list of returned objects by their fields // selector to restrict the list of returned objects by their labels. // maximum number of responses to return for a list call. // pretty print output. // shows changes that occur after that particular version of a resource. // Timeout for the list/watch call. // Watch for changes to the described resources.