Hetzner Cloud API for Java

Test Action Status Build Action Status

Simple Java client for the Hetzner Cloud API.

Important message about this project here

Compile

This project uses Maven as build automation.

Just run mvn clean install to install it in the local Maven repository cache.

How to use

Maven

Dependency:

<dependencies>
    <dependency>
        <groupId>io.github.sinuscosinustan</groupId>
        <artifactId>hetznercloud-api</artifactId>
        <version>5.0.0</version>
    </dependency>
</dependencies>
Gradle

Put this in the build.gradle file of the project:

repositories {
    mavenCentral()
}

dependencies {
    implementation "io.github.sinuscosinustan:hetznercloud-api:5.0.0"
}
kotlin-dsl
dependencies {
    implementation("io.github.sinuscosinustan:hetznercloud-api:5.0.0")
}

Requirements

  • Java 17 or higher
  • Maven 3.6.0 or higher

How to run tests

This project has unit tests, as well as integration tests.

Unit Tests (Default)

mvn test

Integration Tests

Integration tests require an API Token for the Hetzner Cloud. Set the API token as an environment variable called HCLOUD_TOKEN.

To obtain an API key, please see the official API documentation.

HCLOUD_TOKEN="${api_key}" mvn test -Pintegration-tests

Code Quality

Checkstyle

Checkstyle runs automatically during compilation:

mvn compile

Code Coverage (JaCoCo)

Generate code coverage reports:

mvn test

View the HTML report at target/site/jacoco/index.html

JavaDocs

The JavaDocs are available here

Dependencies

The following dependencies were used in this project: