Skip to content

BasisTI/rancher-java-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDK for interacting with Rancher Server using Java

This project is a autogenerated Java Client for Rancher

This project automatically generates the type definitions using a Go template generator and the Rancher provided API schema. It was originally derived from the Go-Rancher library.

There services definitions are built using Square's Retrofit2 library.

Rancher API version: v2-beta

Please see: https://github.com/objectpartners/rancher-java-sdk

Maven Dependency

<dependency>
  <groupId>br.com.basis</groupId>
  <artifactId>rancher-java-sdk</artifactId>
  <version>VERSION</version>
</dependency>

Example

That entry point for this library is the io.rancher.Rancher class. You must first create an API key in your Rancher installation for this library to use.

First, initialize your Rancher client:

Rancher.Config config = new Rancher.Config(new URL("https://rancher.mydomain.com"), "MyAPIAccessKey", "MyAPISecretKey");
Rancher rancher = new Rancher(config);

Once the client is created, you can interact with Rancher by having the client generate a proxy for one of the service interfaces for you.

StackService stackService = rancher.type(StackService.class);
Response<io.rancher.base.TypeCollection<Stack>> execute = stackService.list().execute();
List<Stack> stacks = execute.body().getData();

Releasing rancher-java-sdk to Maven Central

In order to release rancher-java-sdk to Maven Central, sources and javadoc jars should be generated, and all jars have to be signed with PGP. If you don't have a PGP key, you can install GPG and generate a new key, see: http://central.sonatype.org/pages/working-with-pgp-signatures.html for instance.

Before releasing the git repository should be tagged and the tag should be signed using the same PGP key that will be used during the relase. For instance you can use:

git tag -a -m 'Publishing version 1.0.0-RC3' -s 1.0.0-RC3

And if you have more than one PGP key:

git tag -a -m 'Publishing version 1.0.0-RC3' -s -u F680B22C  1.0.0-RC3

In order to help with the release process a release profile has been added to the project pom.xml automating the generation and signing of all jars. To deploy just run:

mvn clean deploy -P release

Note that if you have more than one key you can use the gpg.keyname option:

mvn clean deploy -Dgpg.keyname=F680B22C -P release