class AuthorizationPolicyExample {
  private static final String NAMESPACE = "test";

  public static void main(String[] args) {
    try {
      IstioClient client = ClientFactory.newClient(args);
      createResource(client);
      System.exit(0);
    } catch (KubernetesClientException ex) {
      System.err.println("Failed with " + ex.getMessage());
      System.exit(1);
    }
  }

  public static void createResource(IstioClient client) {<FILL_FUNCTION_BODY>}
}

    System.out.println("Creating a AuthorizationPolicy entry");
    client.v1beta1().authorizationPolicies().inNamespace(NAMESPACE).create(new AuthorizationPolicyBuilder()
        .withNewMetadata()
        .withName("httpbin")
        .endMetadata()
        .withNewSpec()
        .withSelector(new WorkloadSelectorBuilder().withMatchLabels(Collections.singletonMap("app", "httpbin")).build())
        .withAction(AuthorizationPolicyAction.DENY)
        .withRules(new RuleBuilder()
            .withFrom(
                new RuleFromBuilder()
                    .withSource(new SourceBuilder().withPrincipals("cluster.local/ns/default/sa/sleep").build())
                    .build(),
                new RuleFromBuilder().withSource(new SourceBuilder().withNamespaces("dev").build()).build())
            .withTo(new RuleToBuilder().withOperation(new OperationBuilder().withMethods("GET").build()).build())
            .withWhen(
                new ConditionBuilder().withKey("request.auth.claims[iss]").withValues("https://accounts.google.com").build())
            .build())
        .endSpec()
        .build());

    System.out.println("Listing AuthorizationPolicy instances:");
    AuthorizationPolicyList list = client.v1beta1().authorizationPolicies().inNamespace(NAMESPACE).list();
    list.getItems().forEach(b -> System.out.println(b.getMetadata().getName()));
    System.out.println("Done");
  
<no_super_class>