From 44a41591b7b800eea6f6c04c0d0f938376e8c49f Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Thu, 30 Jun 2022 16:00:09 +0200 Subject: Support retrieval of latest deployed package in client --- .../java/ai/vespa/hosted/api/ControllerHttpClient.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'hosted-api/src/main') 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 67cd7e1477e..3fdcf0e18d8 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 @@ -179,10 +179,21 @@ public abstract class ControllerHttpClient { } /** Returns the application package of the given id. */ + // TODO(mpolden): Remove after all callers have switched to the method below public HttpResponse applicationPackage(ApplicationId id) { - return send(request(HttpRequest.newBuilder(applicationPackagePath(id)) - .timeout(Duration.ofMinutes(2)), - GET)); + return applicationPackage(id, false); + } + + /** + * Returns the latest submitted application package of the given id. If latestDeployed is true, return the latest + * package that has been deployed to a production zone. + */ + public HttpResponse applicationPackage(ApplicationId id, boolean latestDeployed) { + URI url = applicationPackagePath(id); + if (latestDeployed) { + url = withQuery(url, "build", "latestDeployed"); + } + return send(request(HttpRequest.newBuilder(url).timeout(Duration.ofMinutes(2)), GET)); } /** Returns the tenants in this system. */ -- cgit v1.2.3