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");
      }
    }
  }
 @Override
 public ClientMixedOperation<
         BuildConfig,
         BuildConfigList,
         DoneableBuildConfig,
         ClientBuildConfigResource<BuildConfig, DoneableBuildConfig, Void, Void>>
     buildConfigs() {
   return delegate.buildConfigs();
 }
 @Override
 public ClientMixedOperation<
         ResourceQuota,
         ResourceQuotaList,
         DoneableResourceQuota,
         ClientResource<ResourceQuota, DoneableResourceQuota>>
     resourceQuotas() {
   return delegate.resourceQuotas();
 }
 @Override
 public ClientMixedOperation<
         ReplicationController,
         ReplicationControllerList,
         DoneableReplicationController,
         ClientRollableScallableResource<ReplicationController, DoneableReplicationController>>
     replicationControllers() {
   return delegate.replicationControllers();
 }
 @Override
 public ClientMixedOperation<
         ServiceAccount,
         ServiceAccountList,
         DoneableServiceAccount,
         ClientResource<ServiceAccount, DoneableServiceAccount>>
     serviceAccounts() {
   return delegate.serviceAccounts();
 }
 @Override
 public ClientMixedOperation<
         PersistentVolumeClaim,
         PersistentVolumeClaimList,
         DoneablePersistentVolumeClaim,
         ClientResource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>>
     persistentVolumeClaims() {
   return delegate.persistentVolumeClaims();
 }
 @Override
 public ClientMixedOperation<
         PersistentVolume,
         PersistentVolumeList,
         DoneablePersistentVolume,
         ClientResource<PersistentVolume, DoneablePersistentVolume>>
     persistentVolumes() {
   return delegate.persistentVolumes();
 }
 @Override
 public ClientNonNamespaceOperation<
         SecurityContextConstraints,
         SecurityContextConstraintsList,
         DoneableSecurityContextConstraints,
         ClientResource<SecurityContextConstraints, DoneableSecurityContextConstraints>>
     securityContextConstraints() {
   return delegate.securityContextConstraints();
 }
 @Override
 public ClientMixedOperation<
         Template,
         TemplateList,
         DoneableTemplate,
         ClientTemplateResource<Template, KubernetesList, DoneableTemplate>>
     templates() {
   return delegate.templates();
 }
 @Override
 public ClientMixedOperation<
         RoleBinding,
         RoleBindingList,
         DoneableRoleBinding,
         ClientResource<RoleBinding, DoneableRoleBinding>>
     roleBindings() {
   return delegate.roleBindings();
 }
 @Override
 public ClientMixedOperation<
         PolicyBinding,
         PolicyBindingList,
         DoneablePolicyBinding,
         ClientResource<PolicyBinding, DoneablePolicyBinding>>
     policyBindings() {
   return delegate.policyBindings();
 }
 @Override
 public ClientNonNamespaceOperation<
         OAuthClient,
         OAuthClientList,
         DoneableOAuthClient,
         ClientResource<OAuthClient, DoneableOAuthClient>>
     oAuthClients() {
   return delegate.oAuthClients();
 }
 @Override
 public ClientNonNamespaceOperation<
         OAuthAuthorizeToken,
         OAuthAuthorizeTokenList,
         DoneableOAuthAuthorizeToken,
         ClientResource<OAuthAuthorizeToken, DoneableOAuthAuthorizeToken>>
     oAuthAuthorizeTokens() {
   return delegate.oAuthAuthorizeTokens();
 }
 @Override
 public ClientMixedOperation<
         ImageStream,
         ImageStreamList,
         DoneableImageStream,
         ClientResource<ImageStream, DoneableImageStream>>
     imageStreams() {
   return delegate.imageStreams();
 }
 @Override
 public ClientMixedOperation<
         DeploymentConfig,
         DeploymentConfigList,
         DoneableDeploymentConfig,
         ClientResource<DeploymentConfig, DoneableDeploymentConfig>>
     deploymentConfigs() {
   return delegate.deploymentConfigs();
 }
 @Override
 public ClientMixedOperation<
         io.fabric8.kubernetes.api.model.Service,
         ServiceList,
         DoneableService,
         ClientResource<io.fabric8.kubernetes.api.model.Service, DoneableService>>
     services() {
   return delegate.services();
 }
예제 #17
0
  public static void main(String... args) {
    if (args.length < 1) {
      System.out.println("Usage: buildConfigName namespace secret type");
      return;
    }
    String name = args[0];
    String namespace = "default";
    if (args.length > 1) {
      namespace = args[1];
    }

    OpenShiftClient client = new DefaultOpenShiftClient();

    try {
      client
          .buildConfigs()
          .inNamespace(namespace)
          .withName(name)
          .trigger(new WebHookTrigger(true, null));
    } catch (Exception e) {
      System.out.println("FAILED: " + e);
      e.printStackTrace();
    }
  }
 @Override
 public OpenShiftClient inAnyNamespace() {
   return delegate.inAnyNamespace();
 }
 @Override
 public ClientMixedOperation<
         Secret, SecretList, DoneableSecret, ClientResource<Secret, DoneableSecret>>
     secrets() {
   return delegate.secrets();
 }
 @Override
 public Config getConfiguration() {
   return delegate.getConfiguration();
 }
 @Override
 public OpenShiftClient inNamespace(String name) {
   return delegate.inNamespace(name);
 }
 @Override
 public RootPaths rootPaths() {
   return delegate.rootPaths();
 }
 @Override
 public void close() {
   delegate.close();
 }
 @Override
 public String getApiVersion() {
   return delegate.getApiVersion();
 }
 @Override
 public String getNamespace() {
   return delegate.getNamespace();
 }
 @Override
 public URL getMasterUrl() {
   return delegate.getMasterUrl();
 }
 @Override
 public <C> C adapt(Class<C> type) {
   return delegate.adapt(type);
 }
 @Override
 public ClientNonNamespaceOperation<
         Node, NodeList, DoneableNode, ClientResource<Node, DoneableNode>>
     nodes() {
   return delegate.nodes();
 }
 @Override
 public ClientKubernetesListMixedOperation lists() {
   return delegate.lists();
 }
 @Override
 public ClientMixedOperation<Pod, PodList, DoneablePod, ClientPodResource<Pod, DoneablePod>>
     pods() {
   return delegate.pods();
 }