Giter VIP home page Giter VIP logo

openshift-restclient-java's Introduction

OpenShift Java REST Client

Travis Maven Central

The project is now in the maintenance mode. Only critical bugs will be fixed, and there won’t be any more feature development. Please consider moving to the OpenShift client library that's developed by the great team at fabric8.

This is the Java REST client for the version 3 architecture of OpenShift based on Kubernetes. The implementation is a work in progress to provide similar functionality and features of the command-line interface and is used by JBoss Tools for OpenShift. For compatibility with OpenShift 2.x see https://github.com/openshift/openshift-java-client/.

For questions or feedback, reach us on IRC on #openshift-client on Freenode or post to our mailing list

Download

You may either build from source using maven (mvn clean package) which, using the master branch, will generate a snapshot build of the latest updates. You may also retrieve final released jars from Maven Central.

Compatibility

Versions of this client known to be compatible with OpenShift

Client Version OpenShift Origin Server
5.4.0-SNAPSHOT v1.3.0
5.0.0-SNAPSHOT latest, v1.3.0-alpha.2
v1.3.0-alpha.3

Usage

Creating a client:

IClient client = new ClientBuilder("https://api.preview.openshift.com")
	.withUserName("openshiftdev")
	.withPassword("wouldntUlik3T0kn0w")
	.build();

This will authorize the client if the cluster is configured for basic authorization. The alternative is to retrieve your OAUTH token and provide it to the client. The token can be set with the builder or later by accessing the authorization context:

client.getAuthorizationContext().setToken("asfdsfd8a70a3qrfafdsadsf786324");

Create a project to associate with your application by submitting a project request:

IResource request = client.getResourceFactory().stub(ResourceKind.PROJECT_REQUEST, "myfirstproject");
IProject project =  (IProject)client.create(request);

Resources can be created by stubbing which will instantiate and instance of the resource but not create it on the server:

IService service = client.getResourceFactory().stub(ResourceKind.SERVICE, "myfirstservice", project.getName());
service.setSelector(labelSelectors);
service = client.create(service);

The client as well as resources supported by OpenShift may have certain capabilities that are instantiated when the resource is initialized. The capabilities are implemented using an adapter pattern and used like the following to create a BuildConfig:

IBuildConfig buildConfig = client.accept(new CapabilityVisitor<IBuildConfigBuilder, IBuildConfig>() {

		@Override
		public IBuildConfig visit(IBuildConfigBuilder builder) {
			return builder
					.named("mybuildconfig")
					.inNamespace(project.getName())
					.fromGitSource()
						.fromGitUrl("https://github.com/openshift/rails-example")
						.usingGitReference("master")
					.end()
					.usingSourceStrategy()
						.fromImageStreamTag("ruby:latest")
						.inNamespace("openshift")
						.withEnvVars(envVars)
					.end()
					.buildOnSourceChange(true)
					.buildOnConfigChange(true)
					.buildOnImageChange(true)
					.toImageStreamTag("mybuildconfig:latest")
				.build();
		}
	}, null);

Various examples of using the capabilities may be found in the integration tests.

Testing

To run the integration tests:

  1. Define a user with cluster admin privilege
  2. Download the oc binary
  3. Run the tests: mvn integration-test -Pintegration-tests -DserverURL=https://localhost:8443 -Ddefault.cluster.admin=foo -Ddefault.cluster.password=bar -Ddefault.openshift.location=/tmp/oc

openshift-restclient-java's People

Contributors

adietish avatar alfonzjanfrithz avatar apupier avatar aslakknutsen avatar bdecoste avatar bdshadow avatar brenton avatar coreydaley avatar danmcp avatar dsimansk avatar fbricon avatar gabemontero avatar grdryn avatar jcantrill avatar jeffmaury avatar jupierce avatar klenkes74 avatar l0rd avatar luksa avatar maxandersen avatar opensas avatar openshift-bot avatar openshift-merge-robot avatar sbouchet avatar scabanovich avatar skavanagh avatar smarterclayton avatar syediqbal avatar szpak avatar xcoulon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openshift-restclient-java's Issues

Container.setCommandArgs adds arguments instead of replacing them

In Java "set" verb often refer to "set and replace previous". See List.set for example or getters/setters pattern. Currently container.setCommandArgs will append arguments to the existing list, rather than replacing original list.

Expect:

  • replace previously defined OR
  • rename method to "addCommandArgs" and add new method "putCommandArgs". As changing command line args is a very useful feature.

Unused jsch dependency

Can't find any jsch usages. Besides restclient should not depend on ssh library.

Please remove this dependency

Trying to fetch all deploymentConfigs in all namespaces

I get an error "The api endpoint for kind 'DeploymentConfig' requires a namespace" when i try to fetch deploymentConfigs with the code

return client.list(ResourceKind.DEPLOYMENT_CONFIG, "", "affiliation=demo");

Namespace is left empty since i want deployment configs in all namespaces that match the given filter query. Ideally the method signature should not have the empty namespace at all here.

What i want to get here is the following URL

https:/localhost:8443/oapi/v1/deploymentconfigs?labelSelector=affiliation%3Ddemo

You can get the same if you do

oc get dc --all-namespaces -l "affiliation=demo" --loglevel=9

I have looked in the source and it looks like the URLBuilder does not support building an url for a namespaced resource without a namespace.

I can fix this if we agree on an approach.

How to set env variable in buildConfig

Hi!

Sorry, this is really a usage question, if wanted I can also repost it to stackoverflow.

I need to update an env entry in an existing buildConfiguration. In Pseudocode I would need something like:

Patch buildconfig "myexistingbuildconfig":
set "spec" > "strategy" > "sourceStrategy" > "env" > "name": "ARTEFACT_URL"
to "value": "https://www.artefactserver.com/example/1"

I looked into the tests but I couldn't find the information on how to go about creating the patch for the build config as described above and then submitting it.

I started naively with:
val resource: IResource = client.getResourceFactory.stub(ResourceKind.BUILD_CONFIG, "mybuildConfig")
client.update(resource)

How should I proceed?

Jolokia response, error with 5.5.0.FINAL

With 5.5.0.FINAL calls against jolokia api are not working anymore, because they don't have a "kind" / "version" in response.

Error is occuring in ResourceFactory (227) --> getResourceClass (IVersionedApiResource endpoint = mapper.getEndpointFor(version, kind);)

With 5.3.0.FINAL it was running properly.

[feature request] support liveness probe(s)

It turns out that for https://issues.jboss.org/browse/JBIDE-24868 we'd need to access/alter liveness probe properties.
If you have a liveness probe defined (like many templates these days: nodejs, eap, etc.) your pod gets killed and restarted by the rc if the pod wont succeed with the liveness probe.
In https://issues.jboss.org/browse/JBIDE-24868 we face the situation where you'd break your code at a breakpoint. If you keep it halted for more than the lifeness probed defined timeout, your pod gets killed & your debug session in Eclipse gets terminated.
To avoid that we need to alter/disable an existing liveness probe when debugging.
@jcantrill Agree? Thoughts?

Support for async execution

Have you considered supporting an async execution model for the main operations?

OkHttp supports it really well and looking at the source it should not be that hard to just create another Listener kinda like the WatchListener and expose some new methods that require that listener.

Then it would be possible to create a separate lib with RxJava that just wraps that listener. Or spring Reactor, or Akka or anything Reactive.

I can give a stab at implementing this in a PR if you are interested in it at all.

Reason:
At work we use this client pretty heavily. We have this chain of calls that would benefit from beeing executed in an async fashion.

For each "application" we typically fetch DC, ImageStream, Pods, Latest RC.

Question about Token

Hi,
I'm trying to use this REST client for OpenShift 3.X, but I have a question about how to get the Token, for instance if I use TokenAuthorizationStrategy, I have to get the token before, could you please tell me what java class and method I should use to get that Token.

client.setAuthorizationStrategy(new TokenAuthorizationStrategy("ADSASEAWRA-AFAEWAAA");

Many thanks.

Custom labels not set for pods

When deploying new app with custom labels all labels are created in services, pods, etc as expected.
oc new-app --template=hawkular-full -l mylabel=foo

In my case the label 'ircbot' is correctly created in Deployment Config, Services and Routes but missing in the Pod yaml.

List<IResource> status = targetProject.accept(
 new CapabilityVisitor<IProjectTemplateProcessing, List<IResource>>() {
   @Override
   public List<IResource> visit(IProjectTemplateProcessing capability) {
    ITemplate original = getUniqueGlobalTemplate(templateName);
    original.addObjectLabel("ircbot", templateName);
    ITemplate processed = capability.process(original);
    Collection<IResource> resources = capability.apply(processed);
    return handleResponse(resources);
   }
...

How to add-role-to-user ?

I miss the function to add a role to a serviceaccount.
Something like this:

oc policy add-role-to-user edit system:serviceaccount:projectname:serviceaccount -n ..

Is this a featurerequest or is it already implemented ?

Exec fails

Following code is expected to log "Test" on the console, instead an error is logged to console.

client = new ClientBuilder(ocLocation)
	    .withUserName(ocUsername)
	    .withPassword(ocPassword)
	    .build();
IPod pod = client.get(ResourceKind.POD, "pod", "project");
PodExec podExec = new PodExec(pod, client);
IStoppable stoppable = podExec.start(new IPodExec.IPodExecOutputListener() {
	
	@Override
	public void onStdOut(String message) {
		LOGGER.info(message);
	}
	
	@Override
	public void onStdErr(String message) {
		LOGGER.info(message);				
	}
	
	@Override
	public void onOpen() {
		LOGGER.info("on open");
	}
	
	@Override
	public void onFailure(IOException e) {
		LOGGER.info(e.getMessage());
	}
	
	@Override
	public void onExecErr(String message) {
		LOGGER.info(message);
	}
	
	@Override
	public void onClose(int code, String reason) {
		LOGGER.info("resaon code: " + code + ", reason: " +  reason);
	}
}, new Options(), "echo Test");
try {
	Thread.sleep(3000);
} catch (InterruptedException e1) {
	// TODO Auto-generated catch block
	e1.printStackTrace();
}
stoppable.stop();

Error is: rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"echo Hello\": executable file not found in $PATH"\n"

ResourceFactory unable to create ConfigMap instances

I'm having an issue in my client using a watcher to watch config maps after upgrading to 5.1.0.Final. My watcher listener code looks like the following:

    public void connected(List<IResource> resources) {
        for (IResource resource : resources) {

            IConfigMap configMap = (IConfigMap) resource;
        }
    }

The cast worked earlier, but failed on 5.1.0.Final. After 4.0.5, the ConfigMap kind was explicitly removed from ResourceFactory (557d5ee), and I suppose it was to be created using this new typeMapper. However, after reading the code of the WatcherClient and ResourceFactory, I can't really see that the typemapper is used when receiving the response. The ResourceFactory seems to still use the IMPL_MAP mapping where the configmap kind does not exist.

User Token not available when we call oclient.getAuthorizationContext().getToken());

When we are connected/authenticated to openshift

 // Let's authenticate the client
        IClient oclient = new ClientBuilder(cmdArgs.url)
                .withUserName(cmdArgs.user)
                .withPassword(cmdArgs.password)
                .build();

        System.out.println("Cluster status : " + oclient.getServerReadyStatus());
        System.out.println("Username : " + oclient.getAuthorizationContext().getUserName());
        System.out.println("Token : " + oclient.getAuthorizationContext().getToken());
        System.out.println("Authorized : " + oclient.getAuthorizationContext().isAuthorized());
        System.out.println("Pod : " + oclient.list("Pod"));

Cluster status : ok
Username : admin
Token : null
Authorized : true
Pod : [{"metadata" : {"name" : "docker-registry-1-1sqio", "generateName" : ....

is it possible to get the OAuth token as we can do with the command oc whaoami -t ? If yes, how ?

can't get UID from IUser

Using this short code I can get all the users on my minishift instance:

final List resource = client.list("users");
for (IResource r : resource) {
IUser user = (IUser) r;
log.info(user.--------);
}

There is however no method "getUid" in IUser, using which I could get the user UID.
The oc get user command out for ilustration:
NAME UID FULL NAME IDENTITIES
aaa 0b234ab8-8ca9-11e7-b4a3-1246c04ae70e anypassword:aaa
aaaa d9c2fd7b-8bcb-11e7-b4a3-1246c04ae70e anypassword:aaaa

IUpdatable capability does not post anything

Code from
https://github.com/openshift/openshift-restclient-java/blob/master/src/test/java/com/openshift/internal/restclient/capability/resources/UpdateableCapabilityTest.java

` service.accept(new CapabilityVisitor<IUpdatable, IService>() {

		@Override
		public IService visit(IUpdatable capability) {
			capability.updateFrom(target);
			return null;
		};
	}, null);`

looks like it would really update service in openshift, but in
https://github.com/openshift/openshift-restclient-java/blob/master/src/main/java/com/openshift/internal/restclient/capability/resources/UpdateableCapability.java
it looks like it just update json and it's all. You have to manually call client to update after this.
For example ProjectTemplateProcessing capability would really call client.
https://github.com/openshift/openshift-restclient-java/blob/master/src/main/java/com/openshift/internal/restclient/capability/resources/ProjectTemplateProcessing.java

This behavior is strange and uncommon.

can't get types scoped by an apiGroupName

$ oc --loglevel=10 get TemplateInstance
...
GET https://192.168.42.1:8443/apis/template.openshift.io/v1/namespaces/myproject/templateinstances
...

client.get("TemplateInstance", "myproject");
com.openshift.restclient.UnsupportedEndpointException: Unable to determine the api endpoint for kind 'TemplateInstance'

The URLBuilder constructs a VersionedApiResource with apiGroupName=null, so it doesn't match the one in ApiTypeMapper.resourceEndpoints, since equals is sensitive to the group name.

Create a project using templates.

Hi, I am very interesting in use this SDK to create, update, delete projects (using templates). I can see that there isn´t documentation about this.
Could you help me in this question?

Thank you so much for your help.

Regards

Connection TLS/SSL error - not sending HOST in header?

Hello,

I am getting a TLS/SSL certificate error when attempting to log in to OpenShift. Basically what is happening is when I hit the openshift url (aaa.myinstance.com:8443) the code ends up with a cert error that requires "openshift-signer@1488501423" instead of being what is expected (the one used by aaa.myinstance.com:8443). That is an internal certificate that I am told is used by a cluster controller. According to an environment engineer this is likely caused by the code not sending the http HOST header. The situation can be replicated below:

Wrong:
$ openssl s_client -connect aaa.myinstance.com:8443 | grep issuer
depth=1 CN = openshift-signer@1488501423
verify error:num=19:self signed certificate in certificate chain
issuer=/CN=openshift-signer@1488501423

Right:
$ openssl s_client -connect aaa.myinstance.com:8443 -servername aaa.myinstance.com | grep issuer
depth=1 DC = com, DC = <...>, CN = <...>
verify return:1
depth=0 C = US, ST = <...>, L = <...>, O = "<...>", OU = <...>, CN = *.myinstance.com
verify return:1
issuer=/DC=com/DC=<...>/CN=<...>

Here is what I am doing in code:

        IClient client = new ClientFactory().create(oAuthURL.toString(), new DefaultSSLCertificateCallback());

        client.setAuthorizationStrategy(new BasicAuthorizationStrategy(username, password, null));
        IAuthorizationContext ctx = client.getContext(oAuthURL.toString());
        String token = ctx.getToken();
public class DefaultSSLCertificateCallback implements ISSLCertificateCallback {

    private static final HostnameVerifier hostnameVerifier = new DefaultHostnameVerifier(PublicSuffixMatcherLoader.getDefault());

    @Override
    public boolean allowCertificate(X509Certificate[] chain) {
        // From what I found in the source code the default trust manager is hit first to see if the chain is trusted
        // before this is called. If it's not trusted then we shouldn't trust it. If it is we are not called.
        return false;
    }

    //https://hc.apache.org/httpcomponents-client-ga/httpclient/xref/org/apache/http/conn/ssl/SSLConnectionSocketFactory.html
    @Override
    public boolean allowHostname(String hostname, SSLSession session) {
        try {
            if (!hostnameVerifier.verify(hostname, session)) {
                final Certificate[] certs = session.getPeerCertificates();
                final X509Certificate x509 = (X509Certificate) certs[0];
                final X500Principal x500Principal = x509.getSubjectX500Principal();
                throw new SSLPeerUnverifiedException("Host name '" + hostname + "' does not match " +
                        "the certificate subject provided by the peer (" + x500Principal.toString() + ")");
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        return true;
    }

}

IClient doesn't seem to be threadsafe

IClient (as created by ClientBuilder) doesn't seem to be threadsafe:

scala> val client = new ClientBuilder("...").usingToken("...").build()
client: com.openshift.restclient.IClient = com.openshift.internal.restclient.DefaultClient@83f7f27a

scala> val (f1, f2) = (Future { client.get[IProject](ResourceKind.PROJECT, "nokia", "nokia") }, Future { client.get[IProject](ResourceKind.PROJECT, "nokia", "nokia") })
f1: scala.concurrent.Future[com.openshift.restclient.model.IProject] = List()
f2: scala.concurrent.Future[com.openshift.restclient.model.IProject] = List()

scala> f1
res11: scala.concurrent.Future[com.openshift.restclient.model.IProject] = Success({"kind" : "Project", "apiVersion" : "v1", ..., "status" : {"phase" : "Active"}})

scala> f2
res12: scala.concurrent.Future[com.openshift.restclient.model.IProject] = Failure(java.lang.NullPointerException)

scala> scala.concurrent.Await.result(f2, 1.seconds)
java.lang.NullPointerException
  at com.openshift.internal.restclient.ApiTypeMapper.lambda$endpointFor$1(ApiTypeMapper.java:95)
  at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
  at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
  at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
  at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
  at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
  at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
  at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
  at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
  at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
  at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
  at com.openshift.internal.restclient.ApiTypeMapper.endpointFor(ApiTypeMapper.java:96)
  at com.openshift.internal.restclient.ApiTypeMapper.isSupported(ApiTypeMapper.java:117)
  at com.openshift.internal.restclient.URLBuilder.buildWithNamespaceInPath(URLBuilder.java:145)
  at com.openshift.internal.restclient.URLBuilder.build(URLBuilder.java:132)
  at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:210)
  at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:194)
  at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:183)
  at com.openshift.internal.restclient.DefaultClient.get(DefaultClient.java:291)
  at $anonfun$2.apply(<console>:25)
  at $anonfun$2.apply(<console>:25)
  at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
  at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
  at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
  at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
  at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
  at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
  at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

At first glance, the problematic code seems to be in com.openshift.internal.restclient.ApiTypeMapper#init():

if(initialized.compareAndSet(false, true)) {
	try {
		List<VersionedApiResource> resourceEndpoints = new ArrayList<>();
                // ...
		this.resourceEndpoints = resourceEndpoints;
	}catch(Exception e) {
		initialized.set(false);
		throw e;
	}
}

This doesn't seem to be threadsafe, thus another thread can see initialized as true, and resourceEndpoints still as null. Would we lose anything if init would be simply synchronized? The client is currently blocking anyway... (but see #256). (The alternative is of course to fix the lazy initialization with the CAS, but that's obviously harder to get right.)

Ignoring SSL issues

Is there an example that shows how to ignore SSL issues, mainly to do with self-signed certificates. I couldn't find a way to provide a custom X509TrustManager using the ClientBuilder.

Deploy tagged imagestream

Hi,

i like to deploy a tagged imagestream into a different project.

Commandline is working fine: oc new-app development/testtag

With the restclient api i try to make this:

    ImageStreamImportCapability cap = new ImageStreamImportCapability(project, getiClient());
    DockerImageURI image = new DockerImageURI("testtag");
    IImageStreamImport imported = cap.importImageMetadata(image);

But for this rest call:
https://..../oapi/v1/namespaces/../projectname/imagestreamimports
I get a 403 expection, despite I use the same user as commandline.

I also wondering about the request:

https://...../oapi/v1/namespaces/projectname/
imagestreamimports/..

commandline request is like this:

https://...../oapi/v1/namespaces/projectname/
imagestreamimages/..

Problems with java client making calls to Origin API

We, at Codenvy, have build a plugin for OpenShift that works ok against Enterprise 3.1 version.

However, having grabbed the latest Origin version, we have faced a problem. Any calls rest client makes to Origin API get 409 and '{"message":"the body of the request was in an unknown format - accepted media types include: application/json, application/yaml"}' as a response.

After some experiments, it turned out that when a project is created using a web console, content type in the header is set as:

Content-Type:application/json;charset=UTF-8

However, when a request is made in Eclipse Che, Content-Type is just application/json. In our code, we can add chaset but it's rest client that makes the final call to Origin API.

I have seen similar problems, for instance http://stackoverflow.com/questions/36009766/openshift-origin-application-with-jboss-developer-studio

Serverside filtering of GET requests

When doing a GET request with labels the filtering is now done clientside. There is a todo in the code to figure out how to do this serverside.

All GET queries to the oapi endpoints support a labelQuery queryparameter. So in my eyes a solution could be to convert labels to csv string and add them as a query paramter to the URL builder.

I have done an attempt in my fork on how to do this. I have not managed to get the tests to run quite yet so there might be some small bugs.

It should be noted that labelQuery supports features that cannot be directly mapped to a map of key=value. I.E this is a valid labelQuery "label2,!label3". This basically says fetch resources that have label2 set but not label3. So it would perhaps be wise to add a method to get kinds with a predefined labelQuery as a string.

How to change login timeout?

Using the AuthorizationClient with BasicAuthorizationStrategy and socket TIMEOUT is hardcoded to 10000(10 secs.). How can I overwrite this value?

Support Jolokia request

To Support Jolokia-Request like this:

https://baseurl/api/v1/namespaces/projectname/pods/https:podname-7-fl9hk:8778/proxy/jolokia/exec/java.util.logging:type=Logging/getLoggerLevel/org

execute Methode just need an additional parameter to put e.g. "/jolokia/exec/java.util.logging:type=Logging/getLoggerLevel/org" add the end of the request.

execute(String httpMethod, String kind, String namespace, String name, String subresource, String subcontext, IResource payload);

Should I make a PR or is this a function you don't want to support ?

Reading current user role

Hallo,

I'm looking for a way to read the user's role.
With the same user, I can read my role from CLI:
oc describe policyBindings : default
Now I'm trying to use the restclient, if I call this method:
client.list(ResourceKind.POLICY_BINDING);
I'm gettting the following exception:
An exception occurred: com.openshift.restclient.authorization.ResourceForbiddenException
I need to find out the current user's role, is it the right way or could anyone give me some clues?

The user doesn't have cluster admin/reader roles and I'm using OSE 3.3

thank you in advance,
Tommy

New app from template

Hi, I didn't find how to call new-app (or Add to Project in web UI) command via REST API.
Is this feature implemented?

There is no possibility to update application from template

In openshift CLI there is possibility to apply changes in template.
case is:
use template to create application
change template
process and apply updated template
after this three steps openshift CLI would create missing resources and update existing, but in java client IProjectTemplateProcessing#apply only leads to creation of resources (no update for existing).
In case if resource already exists - creation for it would fail and we would have false positive apply - like it have been done successfully, but in reality "update" for existing resources would just be ignored.

URLBuilder warning should be case insensative

URL is lowerase so the fact that it doesnt exactly match whats in ResourceKind should not care either.

Nov 11, 2016 2:42:08 PM com.openshift.internal.restclient.URLBuilder kind
WARNING: There kind 'imagestreams' is not recognized by this client; this operation may fail.

Creation ConfigMap

Hello

How can I create ConfigMap with data field?
IConfigMap does not allow set it value.
configMap.getData().put(key, value); - does not worked

And how add this ConfigMap to DeploymentConfig?
I did't find the right way.

Help me, please.

Documentation?

Does any documentation exist for this client? It's pretty useless without any documentation showing how to actually use it. The snippet on the README.md has a syntax error and uses a deprecated method.

IClient client = new ClientFactory().create(url, sslCertCallback); // ClientFactory is deprecated.
client.setAuthorizationStrategy(new TokenAuthorizationStrategy("ADSASEAWRA-AFAEWAAA"); // Missing closing parenthese.
List<IProject> projects = client.list(ResourceKind.PROJECTS, "test-project");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.