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

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

    String namespace = "default";
    if (args.length > 0) {
      namespace = args[0];
    }
    try (KubernetesClient client = new KubernetesClientBuilder().build()) {
      NetworkPolicy networkPolicy = new NetworkPolicyBuilder()
          .withNewMetadata()
          .withName("test-network-policy")
          .endMetadata()
          .withNewSpec()
          .withNewPodSelector()
          .withMatchLabels(Collections.singletonMap("role", "db"))
          .endPodSelector()
          .endSpec()
          .build();

      // create policy using NetworkPolicyBuilder object
      networkPolicy = client.network()
          .v1()
          .networkPolicies()
          .inNamespace(namespace)
          .resource(networkPolicy)
          .createOrReplace();
      logger.info("NetworkPolicy {}/{} created via builders", namespace, networkPolicy.getMetadata().getName());

      // crate policy using YAML resource
      networkPolicy = client.network()
          .v1()
          .networkPolicies()
          .inNamespace(namespace)
          .load(NetworkPolicyExample.class.getResourceAsStream("/network-policy.yml"))
          .createOrReplace();
      logger.info("NetworkPolicy {}/{} created via YAML manifest", namespace, networkPolicy.getMetadata().getName());

    }
  
<no_super_class>