summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-08-22 12:59:13 +0200
committerJon Marius Venstad <venstad@gmail.com>2019-08-22 12:59:13 +0200
commit6a056e5fe0e321f4a5c3084f8902bf9dab3c9a2a (patch)
tree957778bad644bea9cce48d75ef66d7354c28ef7d
parent483aeab1a54bde8a24f428b937f700da35564047 (diff)
Add delete mojo
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java6
-rw-r--r--vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeleteMojo.java26
2 files changed, 29 insertions, 3 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 3d85d531f73..bcbcb99587d 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
@@ -104,9 +104,9 @@ public abstract class ControllerHttpClient {
/** Deactivates the deployment of the given application in the given zone. */
public String deactivate(ApplicationId id, ZoneId zone) {
- return asString(send(request(HttpRequest.newBuilder(deploymentPath(id, zone))
- .timeout(Duration.ofSeconds(10)),
- DELETE)));
+ return toMessage(send(request(HttpRequest.newBuilder(deploymentPath(id, zone))
+ .timeout(Duration.ofSeconds(30)),
+ DELETE)));
}
/** Returns the default {@link ZoneId} for the given environment, if any. */
diff --git a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeleteMojo.java b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeleteMojo.java
new file mode 100644
index 00000000000..64395ce9bfe
--- /dev/null
+++ b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/DeleteMojo.java
@@ -0,0 +1,26 @@
+package ai.vespa.hosted.plugin;
+
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+/**
+ * Deploys a Vespa application package to the hosted Vespa API.
+ *
+ * @author jonmv
+ */
+@Mojo(name = "delete")
+public class DeleteMojo extends AbstractVespaMojo {
+
+ @Parameter(property = "environment")
+ private String environment;
+
+ @Parameter(property = "region")
+ private String region;
+
+ @Override
+ protected void doExecute() {
+ getLog().info(controller.deactivate(id, zoneOf(environment, region)));
+ }
+
+}
+