Building the API client library requires Maven to be installed.
To install the API client library to your local Maven repository, simply execute:
mvn install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deploy
Refer to the official documentation for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>io.tsuru</groupId>
<artifactId>tsuru-client-java</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
Add this dependency to your project's build file:
compile "io.tsuru:tsuru-client-java:1.0.0"
At first generate the JAR by executing:
mvn package
Then manually install the following JARs:
- target/tsuru-client-java-1.0.0.jar
- target/lib/*.jar
Please follow the installation instruction and execute the following Java code:
import io.tsuru.client.*;
import io.tsuru.client.auth.*;
import io.tsuru.client.model.*;
import io.tsuru.client.api.TsuruApi;
import java.io.File;
import java.util.*;
public class TsuruApiExample {
public static void main(String [] args) throws ApiException {
System.out.println("Testing Tsuru Java Client");
TsuruApi apiInstance = new TsuruApi();
apiInstance.getApiClient().setBasePath("http://tsuru.paas.example.com");
LoginToken token = apiInstance.login("[email protected]", "password");
try {
List<Application> result = apiInstance.appList();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling appList");
e.printStackTrace();
}
}
}
All URIs are relative to https://localhost
Class | Method | HTTP request | Description |
---|---|---|---|
TsuruApi | appBuild | POST /1.5/apps/{name}/build | Build application |
TsuruApi | appCreate | POST /1.0/apps | Create application |
TsuruApi | appDeploy | POST /1.0/apps/{name}/deploy | Deploy application |
TsuruApi | appDeployRebuild | POST /1.3/apps/{name}/deploy/rebuild | Rebuild deploy application deployment |
TsuruApi | appDeployRollback | POST /1.0/apps/{name}/deploy/rollback | Rollback application deployment |
TsuruApi | appDeployRollbackUpdate | PUT /1.0/apps/{name}/deploy/rollback/update | Rollback application deployment |
TsuruApi | appGrant | PUT /1.0/apps/{name}/teams/{team} | Grant isPublic application |
TsuruApi | appInfo | GET /1.0/apps/{name} | Application information |
TsuruApi | appList | GET /1.0/apps | Get Applications |
TsuruApi | appLog | GET /1.0/apps/{name}/log | Get application logs. |
TsuruApi | appRemove | DELETE /1.0/apps/{name} | Delete application |
TsuruApi | appRestart | POST /1.0/apps/{name}/restart | Restart application |
TsuruApi | appRevoke | DELETE /1.0/apps/{name}/teams/{team} | Revoke isPublic on application |
TsuruApi | appRun | POST /1.0/apps/{name}/run | Run command inside app container |
TsuruApi | appStart | POST /1.0/apps/{name}/start | Start application |
TsuruApi | appStop | POST /1.0/apps/{name}/stop | Stop application |
TsuruApi | appSwap | POST /1.0/swap | Swap applications |
TsuruApi | appUpdate | PUT /1.0/apps/{name} | Update application |
TsuruApi | envSet | POST /apps/{name}/env | Set env on application |
TsuruApi | envUnset | DELETE /apps/{name}/env | Set env on application |
TsuruApi | getApiKey | GET /1.0/users/api-key | Get ApiKey for user. |
TsuruApi | regenerateApiKey | POST /1.0/users/api-key | Regenerate ApiKey for user. |
TsuruApi | userList | GET /1.0/users | Get Users. |
All endpoints do not require authorization. Authentication schemes defined for the API:
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.