class VirtualServiceExample {

  private static final String NAMESPACE = "test";

  public static void main(String[] args) {<FILL_FUNCTION_BODY>}

  public static void createResource(IstioClient client) {
    System.out.println("Creating a virtual service");
    // Example from: https://istio.io/latest/docs/reference/config/networking/virtual-service/
    final String reviewsHost = "reviews.prod.svc.cluster.local";
    client.v1beta1().virtualServices().inNamespace(NAMESPACE).create(new VirtualServiceBuilder()
        .withNewMetadata()
        .withName("reviews-route")
        .endMetadata()
        .withNewSpec()
        .addToHosts(reviewsHost)
        .addNewHttp()
        .withName("reviews-v2-routes")
        .addNewMatch().withNewUri().withNewStringMatchPrefixType("/wpcatalog").endUri().endMatch()
        .addNewMatch().withNewUri().withNewStringMatchPrefixType("/consumercatalog").endUri().endMatch()
        .withNewRewrite().withUri("/newcatalog").endRewrite()
        .addNewRoute()
        .withNewDestination().withHost(reviewsHost).withSubset("v2").endDestination()
        .endRoute()
        .endHttp()
        .addNewHttp()
        .withName("reviews-v2-routes")
        .addNewRoute()
        .withNewDestination().withHost(reviewsHost).withSubset("v1").endDestination()
        .endRoute()
        .endHttp()
        .endSpec()
        .build());

    System.out.println("Listing Virtual Service Instances:");
    VirtualServiceList list = client.v1beta1().virtualServices().inNamespace(NAMESPACE).list();
    list.getItems().forEach(b -> System.out.println(b.getMetadata().getName()));
    System.out.println("Done");
  }
}

    try {
      IstioClient client = ClientFactory.newClient(args);
      createResource(client);
      System.exit(0);
    } catch (KubernetesClientException ex) {
      System.err.println("Failed with " + ex.getMessage());
      System.exit(1);
    }
  
<no_super_class>