class GenericKubernetesResourceExample {

  private static final Logger logger = LoggerFactory.getLogger(GenericKubernetesResourceExample.class);

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


    final ConfigBuilder configBuilder = new ConfigBuilder();
    configBuilder.withWatchReconnectInterval(500);
    configBuilder.withWatchReconnectLimit(5);
    try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) {

      String namespace = "default";
      CustomResourceDefinition prometheousRuleCrd = client.apiextensions().v1beta1().customResourceDefinitions()
          .load(GenericKubernetesResourceExample.class.getResourceAsStream("/prometheous-rule-crd.yml")).item();
      client.apiextensions().v1beta1().customResourceDefinitions().resource(prometheousRuleCrd).createOrReplace();
      logger.info("Successfully created Prometheous custom resource definition");

      // Creating Custom Resources Now:
      ResourceDefinitionContext crdContext = CustomResourceDefinitionContext.fromCrd(prometheousRuleCrd);

      client.load(GenericKubernetesResourceExample.class.getResourceAsStream("/prometheous-rule-cr.yml"))
          .inNamespace(namespace)
          .createOrReplace();
      logger.info("Created Custom Resource successfully too");

      // Listing all custom resources in given namespace:
      NonNamespaceOperation<GenericKubernetesResource, GenericKubernetesResourceList, Resource<GenericKubernetesResource>> resourcesInNamespace = client
          .genericKubernetesResources(crdContext).inNamespace(namespace);
      GenericKubernetesResourceList list = resourcesInNamespace.list();
      List<GenericKubernetesResource> items = list.getItems();
      logger.info("Custom Resources :- ");
      for (GenericKubernetesResource customResource : items) {
        ObjectMeta metadata = customResource.getMetadata();
        final String name = metadata.getName();
        logger.info(name);
      }

      // Watching custom resources now
      logger.info("Watching custom resources now");
      final CountDownLatch closeLatch = new CountDownLatch(1);
      Watch watch = resourcesInNamespace.watch(new Watcher<GenericKubernetesResource>() {
        @Override
        public void eventReceived(Action action, GenericKubernetesResource resource) {
          logger.info("{}: {}", action, resource);
        }

        @Override
        public void onClose(WatcherException e) {
          logger.debug("Watcher onClose");
          closeLatch.countDown();
          if (e != null) {
            logger.error(e.getMessage(), e);
          }
        }
      });
      closeLatch.await(10, TimeUnit.MINUTES);
      watch.close();

      // Cleanup
      logger.info("Deleting custom resources...");
      resourcesInNamespace.withName("prometheus-example-rules").delete();
      client.apiextensions().v1beta1().customResourceDefinitions()
          .withName(prometheousRuleCrd.getMetadata().getName()).delete();
    } catch (KubernetesClientException e) {
      logger.error("Could not create resource: {}", e.getMessage(), e);
    }
  
<no_super_class>