Skip to content

Commit

Permalink
add case archive creation function
Browse files Browse the repository at this point in the history
  • Loading branch information
grapigeau committed May 7, 2024
1 parent a72e279 commit a45b9ef
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ private Stream<NabuCaseArchiveValue> caseArchives(String baseUrl)
: Optional.of(ca.getWorkflowRunIdsForVidarrArchival())));
}

private Stream<NabuCaseArchiveValue> caseArchiveCreate(String baseUrl)
throws IOException, InterruptedException {
final HttpRequest request;
final var body = MAPPER.createObjectNode();

// This doesn't use the built-in constant for JSON because that one includes a charset
// and Loki then thinks the request is a protobuf
return request =
HttpRequest.newBuilder(URI.create(c.getUrl()))
.POST(BodyPublishers.ofString(MAPPER.writeValueAsString(body)))
.header("Content-type", "application/json")
.build();
}

@Override
protected Stream<NabuCaseArchiveValue> fetch(Instant lastUpdated) throws Exception {
if (config.isEmpty()) {
Expand Down

0 comments on commit a45b9ef

Please sign in to comment.