From a45b9efa8d029828c09a736971aab05fb3c6db69 Mon Sep 17 00:00:00 2001 From: grapigeau Date: Tue, 7 May 2024 10:09:14 -0400 Subject: [PATCH] add case archive creation function --- .../ca/on/oicr/gsi/shesmu/nabu/NabuPlugin.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugin-nabu/src/main/java/ca/on/oicr/gsi/shesmu/nabu/NabuPlugin.java b/plugin-nabu/src/main/java/ca/on/oicr/gsi/shesmu/nabu/NabuPlugin.java index 41df43a57..98038caed 100644 --- a/plugin-nabu/src/main/java/ca/on/oicr/gsi/shesmu/nabu/NabuPlugin.java +++ b/plugin-nabu/src/main/java/ca/on/oicr/gsi/shesmu/nabu/NabuPlugin.java @@ -60,6 +60,20 @@ private Stream caseArchives(String baseUrl) : Optional.of(ca.getWorkflowRunIdsForVidarrArchival()))); } + private Stream 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 fetch(Instant lastUpdated) throws Exception { if (config.isEmpty()) {