atlassian-status-page-java-api

Java wrapper for Atlassian Statuspage REST API

License

License

Categories

Categories

Java Languages
GroupId

GroupId

ws.slink
ArtifactId

ArtifactId

atlassian-status-page-java-api
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

atlassian-status-page-java-api
Java wrapper for Atlassian Statuspage REST API
Project URL

Project URL

http://github.com/mvkvl/atlassian-status-page-java-api
Project Organization

Project Organization

slink.ws
Source Code Management

Source Code Management

http://github.com/mvkvl/atlassian-status-page-java-api/tree/master

Download atlassian-status-page-java-api

How to add to project

<!-- https://jarcasting.com/artifacts/ws.slink/atlassian-status-page-java-api/ -->
<dependency>
    <groupId>ws.slink</groupId>
    <artifactId>atlassian-status-page-java-api</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/ws.slink/atlassian-status-page-java-api/
implementation 'ws.slink:atlassian-status-page-java-api:0.0.1'
// https://jarcasting.com/artifacts/ws.slink/atlassian-status-page-java-api/
implementation ("ws.slink:atlassian-status-page-java-api:0.0.1")
'ws.slink:atlassian-status-page-java-api:jar:0.0.1'
<dependency org="ws.slink" name="atlassian-status-page-java-api" rev="0.0.1">
  <artifact name="atlassian-status-page-java-api" type="jar" />
</dependency>
@Grapes(
@Grab(group='ws.slink', module='atlassian-status-page-java-api', version='0.0.1')
)
libraryDependencies += "ws.slink" % "atlassian-status-page-java-api" % "0.0.1"
[ws.slink/atlassian-status-page-java-api "0.0.1"]

Dependencies

compile (4)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-databind jar
com.fasterxml.jackson.core : jackson-annotations jar
com.fasterxml.jackson.datatype : jackson-datatype-jsr310 jar
com.konghq : unirest-java jar 3.11.05

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.18.16

test (3)

Group / Artifact Type Version
junit : junit jar 4.13
org.slf4j : slf4j-simple jar 1.7.28
org.apache.commons : commons-lang3 jar 3.11

Project Modules

There are no modules declared in this project.

Atlassian Statuspage Java API

Maven Central

General description

This library implements a subset of Atlassian Statuspage REST API to simplify its usage from Java applications.

The simplest way to use this library is to include it as a dependency into your project like this:

<dependency>
    <groupId>ws.slink</groupId>
    <artifactId>atlassian-status-page-java-api</artifactId>
    <version>0.0.1</version>
</dependency>

Supported API methods

This library supports following funcitonality:

  • List Objects
    • Pages
    • Groups
    • Components
    • Group Components
    • Incidents
  • Get Object
    • Page
    • Group
    • Component
    • Incident
  • Create Object
    • Component
    • Group
    • Incident
  • Update Object
    • Component
    • Group
    • Incident
  • Delete Object
    • Component
    • Group
    • Incident

The library can simply be extended to add support for additional Statuspage REST API methods.

Usage

Full usage examples you can find in test directory of this project.

1. Create StatusAPI object

At first you need to create StatusPage object:

    StatusPage statusPage = new StatusPage.Builder()
        .apiKey(System.getenv("STATUSPAGE_API_KEY"))
        .bridgeErrors(true)
        .rateLimit(true)
        .rateLimitDelay(1000)
        .build()
    ;

rateLimit and rateLimitDelay here are needed to slow down API calls to conform to StatusPage REST API rules. If you're not going to perform too many calls to API, you can omit setting this variables (by default rateLimit is disabled).

bridgeErrors here is needed to throw API call exceptions out of library to client code, so that client could handle all the errors by itself. Otherwise all exceptions are handled in the library and empty objects are returned as a result.

2. Use StatusPage API

Next you can use created object in straightforward manner:

  • get all the pages:

    List<Page> page = statusPage.pages();
  • get page components:

    List<Component> components = statusPage.components(page);
  • get one component:

    Optional<Component> component = resource.statusPage().getComponent(page.id(), componentId, true);

    Final boolean flag in this (and similar) call(s) is used to ask the library to perform additional API calls to synchronize full information about the object requested. Without this flag set to true only partial information can be requested and populated into domain model object.

  • get groups of components registered for the page:

    List<Group> groups = statusPage.groups(page);
  • create incident:

        statusPage.createIncident(
            page.id(),
            "<INCIDENT TITLE>",
            "<INCIDENT DESRIPTION>",
            IncidentSeverity.MAJOR
        ).ifPresentOrElse(System.out::println, () -> System.out.println("could not create incident"));
  • update incident:

        Optional<Incident> incident = statusPage.getIncident(pageId, incidentId);
        incident.get().impact(IncidentSeverity.MINOR);
        incident.get().status(IncidentStatus.RESOLVED);
        incident.get().components().stream().forEach(c -> c.status(ComponentStatus.OPERATIONAL));
        Optional<Incident> updated = statusPage.updateIncident(incident.get());

Versions

Version
0.0.1