diff options
author | Harald Musum <musum@yahooinc.com> | 2021-09-28 13:28:03 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2021-09-28 13:28:03 +0200 |
commit | 887b94502414f202ffb2d3d7eca4c6ad6a7f4bc0 (patch) | |
tree | 7b3afd057cc8fdaf209590db8f13ece9ee5bfb37 /hosted-api | |
parent | 595189c381cddd4e595b547d854a31daa98fa090 (diff) |
Add dryRun option to Deployment
Diffstat (limited to 'hosted-api')
-rw-r--r-- | hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java | 4 | ||||
-rw-r--r-- | hosted-api/src/main/java/ai/vespa/hosted/api/Deployment.java | 17 |
2 files changed, 15 insertions, 6 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 487c60e0dcb..000b6cd4149 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 @@ -1,4 +1,4 @@ -// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.hosted.api; import com.yahoo.config.provision.ApplicationId; @@ -340,6 +340,8 @@ public abstract class ControllerHttpClient { Slime slime = new Slime(); Cursor rootObject = slime.setObject(); deployment.version().ifPresent(version -> rootObject.setString("vespaVersion", version)); + if (deployment.isDryRun()) + rootObject.setString("dryRun", "true"); return toJson(slime); } diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/Deployment.java b/hosted-api/src/main/java/ai/vespa/hosted/api/Deployment.java index d012d27fbd8..77cc116b413 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/Deployment.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/Deployment.java @@ -1,9 +1,8 @@ -// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.hosted.api; import java.nio.file.Path; import java.util.Optional; -import java.util.OptionalLong; /** * A deployment intended for hosted Vespa, containing an application package and some meta data. @@ -12,23 +11,31 @@ public class Deployment { private final Optional<String> version; private final Path applicationZip; + private final boolean dryRun; - private Deployment(Optional<String> version, Path applicationZip) { + private Deployment(Optional<String> version, Path applicationZip, boolean dryRun) { this.version = version; this.applicationZip = applicationZip; + this.dryRun = dryRun; } /** Returns a deployment which will use the provided application package. */ public static Deployment ofPackage(Path applicationZipFile) { - return new Deployment(Optional.empty(), applicationZipFile); + return new Deployment(Optional.empty(), applicationZipFile, false); } /** Returns a copy of this which will have the specified Vespa version on its nodes. */ public Deployment atVersion(String vespaVersion) { - return new Deployment(Optional.of(vespaVersion), applicationZip); + return new Deployment(Optional.of(vespaVersion), applicationZip, false); + } + + /** Returns a copy of this which will do a dry-run deployment. */ + public Deployment withDryRun() { + return new Deployment(version, applicationZip, true); } public Optional<String> version() { return version; } public Path applicationZip() { return applicationZip; } + public boolean isDryRun() { return dryRun; } } |