Skip to content

electric-cloud/Dynatrace-Server-REST-Java-SDK

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynatrace Server SDK Build Status

This library provides an easy to use Java implementation of Dynatrace Server REST API.

Table of Contents

Installation

Manual installation is currently required, maven repository might be available in the future. The wrapper comes with Apache's HttpComponents shaded inside, thus you don't have to worry about library dependencies.

Maven

  • Download the latest artifact from Releases
  • Put the artifact and pom.xml under /repo/com/dynatrace/sdk/server-rest-sdk/0.0.2
  • Add the following code to the <repositories> section:
<repository>
    <id>local-repo</id>
    <releases>
        <enabled>true</enabled>
        <checksumPolicy>ignore</checksumPolicy>
    </releases>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
    <url>file://${project.basedir}/repo</url>
</repository>
  • Add the following code to the <dependencies> section:
<dependency>
    <groupId>com.dynatrace.sdk</groupId>
    <artifactId>server-rest-sdk</artifactId>
    <version>0.0.2</version>
</dependency>

Gradle

  • Download the latest artifact from Releases
  • Put the artifact under /lib
  • Put the following code in your dependencies block:
compile fileTree(dir: 'lib', include: '*.jar')

Services

The SDK is divided into small modules called services. Each service corresponds to the appropriate wiki entry under REST Interfaces section. The SDK currently supports a small part of the available interfaces, therefore Pull Requests are highly appreciated.

Each service takes a DynatraceClient as the only parameter in the constructor.

Dynatrace Client

The DynatraceClient holds the Apache HTTPClient under the hood and therefore it is recommended to pass thesame DynatraceClient to all services to avoid multiple client creation.

Constructing

The DynatraceClient can be constructed using two constructors:

public DynatraceClient(ServerConfiguration configuration) {
//...
}
public DynatraceClient(ServerConfiguration configuration, CloseableHttpClient httpClient) {
//...
}

You most likely want to use the first one.

ServerConfiguration is an interface which has a basic implementation: BasicServerConfiguration

The most basic use-case would be to create a DynatraceClient the following way:

DynatraceClient client = new DynatraceClient(new BasicServerConfiguration("username","password"));

You may want to take a look at BasicServerConfiguration source-code for a list and documentation of other constructors.

Test Automation

Creation

import com.dynatrace.sdk.server.testautomation.TestAutomation;
//...
TestAutomation automation = new TestAutomation(DynatraceClient);

Wiki entries

Sessions

Creation

import com.dynatrace.sdk.server.sessions.Sessions
//...
Sessions sessions = new Sessions(DynatraceClient);

Wiki entries

Agents and Collectors

Creation

import com.dynatrace.sdk.server.agentadncollectors.AgentsAndCollectors
//...
AgentsAndCollectors agentsAndCollectors = new AgentsAndCollectors(DynatraceClient);

Wiki entries

System Profiles

Creation

import com.dynatrace.sdk.server.systemprofiles.SystemProfiles
//...
SystemProfiles systemProfiles = new SystemProfiles(DynatraceClient);

Wiki entries

Server Management

Creation

import com.dynatrace.sdk.server.servermanagement.ServerManagement
//...
ServerManagement serverManagement = new ServerManagement(DynatraceClient);

Wiki entries

Resource Dumps

Creation

import com.dynatrace.sdk.server.resourcedumps.ResourceDumps
//...
ResourceDumps resourceDumps = new ResourceDumps(DynatraceClient);

Wiki entries

Memory Dumps

Creation

import com.dynatrace.sdk.server.memorydumps.MemoryDumps
//...
MemoryDumps resourceDumps = new MemoryDumps(DynatraceClient);

Wiki entries

Building

In order to build the library, one must execute mvn clean install or mvn clean package.

Running tests

The SDK comes with some unit tests, to run them, execute the following command:

mvn clean test

About

Library providing wrappers for working with Server REST API from Java code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%