Skip to content

gfleury/tsuru-client-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tsuru-client-java

Requirements

Building the API client library requires Maven to be installed.

Installation

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.

Maven users

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>

Gradle users

Add this dependency to your project's build file:

compile "io.tsuru:tsuru-client-java:1.0.0"

Others

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

Getting Started

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();
        }
    }
}

Documentation for API Endpoints

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.

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization. Authentication schemes defined for the API:

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

http://github.com/gfleury

Releases

No releases published

Packages

No packages published

Languages