From b80f611db0e70964edd72947ccf14240b55b397b Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Wed, 20 Mar 2019 08:01:32 +0100 Subject: Add PUT method Change-Id: I1ae710a005f245f0a83af1e0e430b95a93516aa0 Issue-ID: DCAEGEN2-1353 Signed-off-by: Joanna Jeremicz --- .../client/service/http/get/AaiHttpGetClient.java | 8 +--- .../service/http/patch/AaiHttpPatchClient.java | 8 +--- .../client/service/http/put/AaiHttpPutClient.java | 53 ++++++++++++++++++++++ 3 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/put/AaiHttpPutClient.java (limited to 'rest-services/aai-client') diff --git a/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiHttpGetClient.java b/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiHttpGetClient.java index 4ff500a3..dad1c1f1 100644 --- a/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiHttpGetClient.java +++ b/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiHttpGetClient.java @@ -35,8 +35,9 @@ public final class AaiHttpGetClient implements AaiHttpClient { private final AaiClientConfiguration configuration; - public AaiHttpGetClient(AaiClientConfiguration configuration) { + public AaiHttpGetClient(AaiClientConfiguration configuration, CloudHttpClient httpGetClient) { this.configuration = configuration; + this.httpGetClient = httpGetClient; } @Override @@ -44,11 +45,6 @@ public final class AaiHttpGetClient implements AaiHttpClient { return httpGetClient.get(getUri(aaiModel.getCorrelationId()), createRequestDiagnosticContext(), configuration.aaiHeaders(), String.class); } - public AaiHttpGetClient createAaiHttpClient(CloudHttpClient httpGetClient) { - this.httpGetClient = httpGetClient; - return this; - } - private String getUri(String pnfName) { return new URI.URIBuilder() .scheme(configuration.aaiProtocol()) diff --git a/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/patch/AaiHttpPatchClient.java b/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/patch/AaiHttpPatchClient.java index 20592194..18511008 100644 --- a/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/patch/AaiHttpPatchClient.java +++ b/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/patch/AaiHttpPatchClient.java @@ -38,9 +38,10 @@ public final class AaiHttpPatchClient implements AaiHttpClient getAaiResponse(AaiModel aaiModel) { @@ -48,11 +49,6 @@ public final class AaiHttpPatchClient implements AaiHttpClient { + + private CloudHttpClient httpPutClient; + private final AaiClientConfiguration configuration; + private final JsonBodyBuilder jsonBodyBuilder; + private final String uri; + + public AaiHttpPutClient(final AaiClientConfiguration configuration, JsonBodyBuilder jsonBodyBuilder, String uri, CloudHttpClient httpPutClient) { + this.configuration = configuration; + this.jsonBodyBuilder = jsonBodyBuilder; + this.uri = uri; + this.httpPutClient = httpPutClient; + } + + @Override + public Mono getAaiResponse(AaiModel aaiModel) { + return httpPutClient + .put(uri, createRequestDiagnosticContext(), configuration.aaiHeaders(), jsonBodyBuilder, aaiModel); + } +} -- cgit 1.2.3-korg