Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.BlackDark:rancher-java-sdk:v2.1.0'
}
dependencies {
implementation("com.github.BlackDark:rancher-java-sdk:v2.1.0")
}
<dependency>
<groupId>com.github.BlackDark</groupId>
<artifactId>rancher-java-sdk</artifactId>
<version>v2.1.0</version>
</dependency>
libraryDependencies += "com.github.BlackDark" % "rancher-java-sdk" % "v2.1.0"
:dependencies [[com.github.BlackDark/rancher-java-sdk "v2.1.0"]]
This project is a autogenerated Java Client for Rancher
This project automatically generates the type definitions use 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.
This code is currently untested and is not published to an artifact repository. Use at your own risk.
You can pull this library into your project using JitPack.io
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.Joni-Lover:rancher-java-sdk:SNAPSHOT'
}
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/v2-beta/"), "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.
ServiceService service = rancher.type(io.rancher.service.ServiceService.class);
List<io.rancher.type.Service> services = service.list().execute();
The API definitions in this project are automatically generated from the Rancher API definition. To update the API, perform the following steps:
cd generator
curl -o schemas.json https://raw.githubusercontent.com/rancher/go-rancher/master/generator/schemas.json
make && ./generator