-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
453 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...lient/src/main/java/systems/comodal/pagerduty/event/data/PagerDutyChangeEventPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package systems.comodal.pagerduty.event.data; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
public interface PagerDutyChangeEventPayload { | ||
|
||
static PagerDutyChangeEventPayload.Builder build() { | ||
return new PagerDutyChangeEventPayloadRecord.PagerDutyChangeEventPayloadBuilder(); | ||
} | ||
|
||
static PagerDutyChangeEventPayload.Builder build(final PagerDutyChangeEventPayload prototype) { | ||
return prototype == null ? build() : new PagerDutyChangeEventPayloadRecord.PagerDutyChangeEventPayloadBuilder(prototype); | ||
} | ||
|
||
ZonedDateTime getTimestamp(); | ||
|
||
String getSummary(); | ||
|
||
String getSource(); | ||
|
||
Map<String, Object> getCustomDetails(); | ||
|
||
List<PagerDutyLinkRef> getLinks(); | ||
|
||
default String getLinksJson() { | ||
final var links = getLinks(); | ||
return links.isEmpty() ? "" : links.stream().map(PagerDutyLinkRef::toJson) | ||
.collect(Collectors.joining(",", ",\"links\":[", "]")); | ||
} | ||
|
||
String getPayloadJson(); | ||
|
||
interface Builder extends PagerDutyChangeEventPayload { | ||
|
||
|
||
PagerDutyChangeEventPayload create(); | ||
|
||
Builder summary(final String summary); | ||
|
||
Builder timestamp(final ZonedDateTime timestamp); | ||
|
||
Builder source(final String source); | ||
|
||
Builder customDetails(final String field, final String fieldValue); | ||
|
||
Builder customDetails(final String field, final Boolean fieldValue); | ||
|
||
Builder customDetails(final String field, final Number fieldValue); | ||
|
||
Builder customDetails(final String field, final Object fieldValue); | ||
|
||
Builder link(final PagerDutyLinkRef link); | ||
} | ||
} |
Oops, something went wrong.