BOSH Java Client

A Java client for the BOSH Director API.

License

License

Categories

Categories

Java Languages CLI User Interface
GroupId

GroupId

io.bosh.client
ArtifactId

ArtifactId

bosh-java-client
Last Version

Last Version

0.9.0
Release Date

Release Date

Type

Type

jar
Description

Description

BOSH Java Client
A Java client for the BOSH Director API.
Project URL

Project URL

https://github.com/davidehringer/bosh-java-client
Project Organization

Project Organization

Cloud Foundry Community
Source Code Management

Source Code Management

https://github.com/davidehringer/bosh-java-client.git

Download bosh-java-client

How to add to project

<!-- https://jarcasting.com/artifacts/io.bosh.client/bosh-java-client/ -->
<dependency>
    <groupId>io.bosh.client</groupId>
    <artifactId>bosh-java-client</artifactId>
    <version>0.9.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.bosh.client/bosh-java-client/
implementation 'io.bosh.client:bosh-java-client:0.9.0'
// https://jarcasting.com/artifacts/io.bosh.client/bosh-java-client/
implementation ("io.bosh.client:bosh-java-client:0.9.0")
'io.bosh.client:bosh-java-client:jar:0.9.0'
<dependency org="io.bosh.client" name="bosh-java-client" rev="0.9.0">
  <artifact name="bosh-java-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.bosh.client', module='bosh-java-client', version='0.9.0')
)
libraryDependencies += "io.bosh.client" % "bosh-java-client" % "0.9.0"
[io.bosh.client/bosh-java-client "0.9.0"]

Dependencies

compile (6)

Group / Artifact Type Version
io.reactivex : rxjava jar 1.0.14
org.springframework : spring-web jar
com.fasterxml.jackson.core : jackson-databind jar
com.fasterxml.jackson.dataformat : jackson-dataformat-yaml jar
org.apache.httpcomponents : httpclient jar
org.slf4j : slf4j-api jar

test (6)

Group / Artifact Type Version
junit : junit jar
org.hamcrest : hamcrest-all jar 1.3
com.jayway.jsonpath : json-path jar
org.springframework : spring-test jar
commons-io : commons-io jar 2.4
ch.qos.logback : logback-classic jar

Project Modules

There are no modules declared in this project.

Java Client for BOSH

A Java client for the bosh.io Director API.

While the client implements a large portion of the BOSH API, it doesn't yet have full coverage.

Maven Dependency

The library is available in Maven Central.

<dependency>
    <groupId>io.bosh.client</groupId>
    <artifactId>bosh-java-client</artifactId>
    <version>${bosh-java-client.version}</version>
</dependency>

See Maven Search for released versions.

Usage

The BOSH Director API is primarily an asynchronous, task-based API and many operations can be long running. The bosh-java-client uses RxJava Observables as the return type for all API calls to allow the client applications to choose how they wish to deal with the asynchronous nature of the BOSH API.

The DirectorClient is the entry point into the API. Each domin area has its own interface that you can access through the DirectorClient. To create instances of the DirectorClient, use the SpringDirectorClientBuilder

DirectorClient client = new SpringDirectorClientBuilder()
                .withHost("192.168.50.4")
                .withCredentials("admin", "admin")
                .build();

You can consume the Observables in a variety of ways such as examples below. Unless otherwise noted in the API, the Observables returned will only emit a single item.

FetchLogsRequest request = new FetchLogsRequest()
        .withDeploymentName("my-deployment")
        .withJobName("my-job")
        .withJobIndex(2)
        .withLogType(LogType.JOB);
InputStream logs = client.jobs().fetchLogs(request).toBlocking().single();
// do something with the logs
Deployments deployments = client.deployments();
deployments.list().subscribe(deploymentList -> {
            
			// ...
        });         

// or
Deployments deployments = client.deployments();
deployments.list().subscribe(deploymentList -> {
    // ...
    }, error -> {
        // handle error
    });

Compatibility

The BOSH team does not currently consider the Director API to be public and it may be subject to breaking changes between releases. Please test against the specific version of BOSH that you are running.

Logging

The project uses commons-logging. To enable logging of all the calls (the URL being called, not the payload) to the BOSH Director, set the logging level of the BOSH_DIRECTOR_API to INFO.

Continuous Integration

The CI server for the project is hosted at https://gaptap.atlassian.net/builds/browse/BJC-BOS.

Versions

Version
0.9.0
0.1.5