diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-06-30 16:00:09 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2022-06-30 16:02:39 +0200 |
commit | 44a41591b7b800eea6f6c04c0d0f938376e8c49f (patch) | |
tree | aa492f0b78c5fe7e6caa98df32f1befb37da7a67 /hosted-api | |
parent | c30c1ef77a330c8127f407947fb9cbff34404a0a (diff) |
Support retrieval of latest deployed package in client
Diffstat (limited to 'hosted-api')
-rw-r--r-- | hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java | 17 |
1 files changed, 14 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 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<byte[]> 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<byte[]> 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. */ |