Skip to content

1and1/checkmk-java-client

Repository files navigation

CheckMK Java Client

OpenAPI code generation Maven Central javadoc License: GPL v2

A Java REST API library that connects to a CheckMK monitoring system server.

What's inside

This repository contains just scripts to build the client. It does not contain the source code that is being generated. Source code, library jar and Javadoc is on Maven Central.

The REST client is generated using the OpenAPI generator with the target language being Java, the HTTP client being okhttp and bean validation turned on.

Documentation

The Java API documentation can be browsed on Javadoc.io.

The REST API documentation can be browsed in your local Checkmk installation.

Using the client in your code

Maven artifact

The client is provided as a Maven artifact. By adding this dependency to your POM, you'll be able to use the client:

  <groupId>com.oneandone</groupId>
  <artifactId>checkmk-java-client</artifactId>
  <version>$THE_VERSION_TO_USE</version>

For the appropriate version, please see the "Version numbers" section below and see Maven Central versions.

Demo code

A simple API client showing the Checkmk version information is in the demo project. It uses a custom ApiClient to overcome a problem in sending the Accept header.

Generating the client code

The client code can be generated with

~ ./generate.sh

Version numbers

Version numbers are composed of two parts:

  1. First two segments: The generator script version.
  2. Last segments: The Checkmk API version specification.

Example: Version 1.0.2.1.0.17 is composed of the parts

  • 1.0 being the generator script version, and
  • 2.1.0.17 referencing to the Checkmk API 2.1.0p17.

Changes compared to the generated client

There are multiple changes compared to the pure generated client. The generated client would not build because of certain shortcomings of OpenAPI generator.

  • Replacement of AnyOf-based OpenAPI types with Java Map types. OpenAPI generator 5.4 does not natively support AnyOf-types.
  • Fixing of syntactic errors, i.e. combination of @NotNull-annotation with type names (i.e. @NotNullString instead of @NotNull String).
  • Update of several depencency versions, i.e. okhttp and gson.
  • Inclusion of the SonaType OSS artifact repository into the POM.

License

This repository is licensed under the GPL 2.0 license.