Add method for fetching runs to controller client
@@ -179,12 +179,6 @@ public abstract class ControllerHttpClient {
GET)));
}
- /** 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 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.
@@ -258,6 +252,10 @@ public abstract class ControllerHttpClient {
return deploymentLog(id, zone, run, -1);
}
+ public Inspector runs(ApplicationId id, String jobName) {
+ return toInspector(send(request(HttpRequest.newBuilder(jobPath(id, jobName)).timeout(Duration.ofSeconds(10)), GET)));
+ }
+
/** Returns an authenticated request from the given input. Override this for, e.g., request signing. */
protected HttpRequest request(HttpRequest.Builder request, Method method, Supplier<InputStream> data) {
return request.method(method.name(), ofInputStream(data)).build();
@@ -314,6 +312,10 @@ public abstract class ControllerHttpClient {
"deploy", jobNameOf(zone));
}
+ private URI jobPath(ApplicationId id, String jobName) {
+ return concatenated(instancePath(id), "job", jobName);
+ }
+
private URI jobPath(ApplicationId id, ZoneId zone) {
return concatenated(instancePath(id), "job", jobNameOf(zone));
}
