Skip to content

IBM/schematics-java-sdk

Repository files navigation

Build Status semantic-release

IBM Cloud Schematics Java SDK Version 1.3.1

Java client library to interact with various IBM Cloud Schematics.

Disclaimer: this SDK is being released initially as a pre-release version. Changes might occur which impact applications that use this SDK.

Table of Contents

Overview

The IBM Cloud Schematics Java SDK allows developers to programmatically interact with the following IBM Cloud services:

Service Name Artifact Coordinates
Schematics com.ibm.cloud:schematics:1.3.1 -->

Prerequisites

  • An IBM Cloud account.
  • An IAM API key to allow the SDK to access your account. Create one here.
  • Java 8 or above.

Installation

The current version of this SDK is: 1.3.1

Each service's artifact coordinates are listed in the table above.

The project artifacts are published on the public Maven Central artifact repository. This is the default public repository used by maven when searching for dependencies. To use this repository within a gradle build, please see this link.

To use a particular service, define a dependency that contains the artifact coordinates (group id, artifact id and version) for the service, like this:

Maven
<dependency>
    <groupId>com.ibm.cloud</groupId>
    <artifactId>schematics-service</artifactId>
    <version>1.3.1</version>
</dependency>
Gradle
'com.ibm.cloud:schematics-service:1.3.1'

Authentication

The library requires Identity and Access Management (IAM) to authenticate requests. There are several ways to set the properties for authentication

  1. As environment variables
  2. The programmatic approach
  3. With an external credentials file

Authenticate with environment variables

For Schematics IAM authentication set the following environmental variables by replacing with your proper service credentials.

SCHEMATICS_URL = https://schematics.cloud.ibm.com
SCHEMATICS_APIKEY = <apikey>

Authenticate with external configuration

To use an external configuration file, see the related documentation in the Java SDK Core document about authentication.

Authenticate programmatically

To learn more about how to use programmatic authentication, see the related documentation in the Java SDK Core document about authentication.

Getting Started

A quick example to get you up and running with Schematics Java SDK service


import com.ibm.cloud.schematics.v1.Schematics;
import com.ibm.cloud.schematics.v1.model.GetSchematicsVersionOptions;
import com.ibm.cloud.schematics.v1.model.VersionResponse;
import com.ibm.cloud.sdk.core.http.Response;
import com.ibm.cloud.sdk.core.security.IamAuthenticator;

Schematics service = null;
IamAuthenticator authenticator = new IamAuthenticator("<apiKey>");


service = new Schematics(Schematics.DEFAULT_SERVICE_NAME, authenticator);
service.setServiceUrl("https://schematics.cloud.ibm.com");

GetSchematicsVersionOptions getSchematicsVersionOptions = new GetSchematicsVersionOptions();

// Invoke operation
Response<VersionResponse> response = service.getSchematicsVersion(getSchematicsVersionOptions).execute();

VersionResponse versionResponseResult = response.getResult();

System.out.println(versionResponseResult);


Error handling

For sample code on handling errors, please see Schematics API docs.

Using the SDK

For general SDK usage information, please see this link

Questions

If you are having difficulties using this SDK or have a question about the IBM Cloud services, please ask a question at Stack Overflow.

Issues

If you encounter an issue with the project, you are welcome to submit a bug report. Before that, please search for similar issues. It's possible that someone has already reported the problem.

Open source @ IBM

Find more open source projects on the IBM Github Page

Contributing

See CONTRIBUTING.

License

The IBM Cloud Schematics Java SDK is released under the Apache 2.0 license. The license's full text can be found in LICENSE.