コード例 #1
0
  public static void main(String[] args) throws IOException {
    try (OpenShiftClient client = new DefaultOpenShiftClient()) {
      try {
        client
            .namespaces()
            .createNew()
            .withNewMetadata()
            .withName("thisisatest")
            .endMetadata()
            .done();

        Template t =
            client.unmarshal(
                TemplateExample.class.getResourceAsStream("/test-template.yml"), Template.class);

        for (Parameter p : t.getParameters()) {
          System.out.println(p.getName());
        }

        t =
            client
                .templates()
                .load(TemplateExample.class.getResourceAsStream("/test-template.yml"))
                .get();
        t =
            client
                .templates()
                .inNamespace("thisisatest")
                .load(TemplateExample.class.getResourceAsStream("/test-template.yml"))
                .create();
        t = client.templates().inNamespace("thisisatest").withName("eap6-basic-sti").get();
        System.out.println(t.getMetadata().getName());

        KubernetesList l =
            client.templates().inNamespace("thisisatest").withName("eap6-basic-sti").process();
        System.out.println(l.getItems().size());

        l = client.lists().load(TemplateExample.class.getResourceAsStream("/test-list.yml")).get();
        System.out.println(l.getItems().size());

        l =
            client
                .lists()
                .inNamespace("thisisatest")
                .load(TemplateExample.class.getResourceAsStream("/test-list.yml"))
                .create();
      } finally {
        // And finally clean up the namespace
        client.namespaces().withName("thisisatest").delete();
        logger.info("Deleted namespace");
      }
    }
  }
コード例 #2
0
 @Override
 public ClientMixedOperation<
         Template,
         TemplateList,
         DoneableTemplate,
         ClientTemplateResource<Template, KubernetesList, DoneableTemplate>>
     templates() {
   return delegate.templates();
 }