Skip to content
 
 

Repository files navigation

PagerDuty Event Client Build Download

This client aims to be compliant with the latest version of the PagerDuty Event API, currently V2.

Hello Event Trigger

var client = PagerDutyEventClient.build()
    .defaultClientName("CLIENT_NAME")
    .defaultRoutingKey("INTEGRATION_KEY")
    .authToken("AUTH_TOKEN")
    .create();

var payload = PagerDutyEventPayload.build()
    .summary("summary")
    .source("source")
    .severity(PagerDutySeverity.critical)
    .timestamp(ZonedDateTime.now(UTC))
    .component("component")
    .group("group")
    .type("class")
    .customDetails("num-metric", 1)
    .customDetails("string-metric", "val")
    .link(PagerDutyLinkRef.build()
      .href("https://github.com/comodal/pagerduty-client")
      .text("Github pagerduty-client")
      .create())
    .image(PagerDutyImageRef.build()
      .src("https://www.pagerduty.com/wp-content/uploads/2016/05/pagerduty-logo-green.png")
      .href("https://www.pagerduty.com/")
      .alt("pagerduty")
      .create())
    .create();

var triggerResponse = client.triggerDefaultRouteEvent(payload).join();
System.out.println(triggerResponse);

var resolveResponse = client.resolveEvent(triggerResponse.getDedupeKey()).join();
System.out.println(resolveResponse);

Library Layout

The core module systems.comodal.pagerduty_event_client has direct dependencies on java.base, java.net.http and a PagerDutyEventAdapterFactory. The module systems.comodal.pagerduty_event_json_iterator_adapter provides this factory and has a dependency on systems.comodal.json_iterator. This separation is intended to make it easy to provide your own json parser if desired.

> ./gradlew pagerduty-event-json-iterator-adapter:dependencies

+--- project :pagerduty-event-client
\--- systems.comodal:json-iterator:+

Example Gradle Configuration

ext {
  pagerDutyClient = "+"
}

dependencies {
  implementation "systems.comodal:pagerduty-event-json-iterator-adapter:$pagerDutyClient"
  implementation "systems.comodal:pagerduty-event-client:$pagerDutyClient"
}

About

PagerDuty Event Client

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages