diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-01-11 09:13:54 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-01-11 09:13:54 +0100 |
commit | 65d8b3d6e2a3a95a495e9b3096660e15581d1bed (patch) | |
tree | 7723978d8ec06f6f8237e0da901f88bb289b5487 /hosted-api | |
parent | 00d005ea8544ee5677c2f18d5358cf65afebbf32 (diff) |
Add suspension mojo
Diffstat (limited to 'hosted-api')
-rw-r--r-- | hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java index 3a848b33c76..f17816f224d 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java @@ -121,6 +121,13 @@ public abstract class ControllerHttpClient { DELETE))); } + /** Sets suspension status of the given application in the given zone. */ + public String suspend(ApplicationId id, ZoneId zone, boolean suspend) { + return toMessage(send(request(HttpRequest.newBuilder(suspendPath(id, zone)) + .timeout(Duration.ofSeconds(10)), + suspend ? POST : DELETE))); + } + /** Returns the default {@link ZoneId} for the given environment, if any. */ public ZoneId defaultZone(Environment environment) { Inspector rootObject = toInspector(send(request(HttpRequest.newBuilder(defaultRegionPath(environment)) @@ -225,6 +232,10 @@ public abstract class ControllerHttpClient { "region", zone.region().value()); } + private URI suspendPath(ApplicationId id, ZoneId zone) { + return concatenated(deploymentPath(id, zone), "suspend"); + } + private URI deploymentJobPath(ApplicationId id, ZoneId zone) { return concatenated(instancePath(id), "deploy", jobNameOf(zone)); |