From c894c805272b688b3cb2d874959608e66f18dd72 Mon Sep 17 00:00:00 2001 From: Bjørn Christian Seime Date: Fri, 15 Nov 2019 17:50:37 +0100 Subject: Add missing query parameter to correctly list flag data --- .../controller/restapi/systemflags/FlagsClient.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'controller-server') diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/FlagsClient.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/FlagsClient.java index d11e17ce634..045b8809041 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/FlagsClient.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/FlagsClient.java @@ -12,6 +12,7 @@ import com.yahoo.vespa.hosted.controller.api.systemflags.v1.wire.WireErrorRespon import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; +import org.apache.http.NameValuePair; import org.apache.http.client.ResponseHandler; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpDelete; @@ -24,6 +25,7 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import javax.net.ssl.HostnameVerifier; @@ -56,7 +58,7 @@ class FlagsClient { } List listFlagData(FlagsTarget target) throws FlagsException, UncheckedIOException { - HttpGet request = new HttpGet(createUri(target, "/data")); + HttpGet request = new HttpGet(createUri(target, "/data", List.of(new BasicNameValuePair("recursive", "true")))); return executeRequest(request, response -> { verifySuccess(response, target, null); return FlagData.deserializeList(EntityUtils.toByteArray(response.getEntity())); @@ -64,7 +66,7 @@ class FlagsClient { } void putFlagData(FlagsTarget target, FlagData flagData) throws FlagsException, UncheckedIOException { - HttpPut request = new HttpPut(createUri(target, "/data/" + flagData.id().toString())); + HttpPut request = new HttpPut(createUri(target, "/data/" + flagData.id().toString(), List.of())); request.setEntity(jsonContent(flagData.serializeToJson())); executeRequest(request, response -> { verifySuccess(response, target, flagData.id()); @@ -73,7 +75,7 @@ class FlagsClient { } void deleteFlagData(FlagsTarget target, FlagId flagId) throws FlagsException, UncheckedIOException { - HttpDelete request = new HttpDelete(createUri(target, "/data/" + flagId.toString())); + HttpDelete request = new HttpDelete(createUri(target, "/data/" + flagId.toString(), List.of())); executeRequest(request, response -> { verifySuccess(response, target, flagId); return null; @@ -105,9 +107,12 @@ class FlagsClient { } } - private static URI createUri(FlagsTarget target, String subPath) { + private static URI createUri(FlagsTarget target, String subPath, List queryParams) { try { - return new URIBuilder(target.endpoint()).setPath(FLAGS_V1_PATH + subPath).build(); + return new URIBuilder(target.endpoint()) + .setPath(FLAGS_V1_PATH + subPath) + .setParameters(queryParams) + .build(); } catch (URISyntaxException e) { throw new RuntimeException(e); // should never happen } -- cgit v1.2.3