aboutsummaryrefslogtreecommitdiffstats
path: root/rest-services/aai-client/src/main/java
diff options
context:
space:
mode:
authorJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-03-20 08:01:32 +0100
committerJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-03-22 10:15:15 +0100
commitb80f611db0e70964edd72947ccf14240b55b397b (patch)
treee1cff36d6fee71f96b454401f52097f5c2cd5327 /rest-services/aai-client/src/main/java
parent5d90e4cc1354199d4a816e14f5fc431e7ff3ad65 (diff)
Add PUT method
Change-Id: I1ae710a005f245f0a83af1e0e430b95a93516aa0 Issue-ID: DCAEGEN2-1353 Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Diffstat (limited to 'rest-services/aai-client/src/main/java')
-rw-r--r--rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiHttpGetClient.java8
-rw-r--r--rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/patch/AaiHttpPatchClient.java8
-rw-r--r--rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/put/AaiHttpPutClient.java53
3 files changed, 57 insertions, 12 deletions
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<String> {
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<String> {
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<HttpClientRespons
private final JsonBodyBuilder jsonBodyBuilder;
- public AaiHttpPatchClient(final AaiClientConfiguration configuration, JsonBodyBuilder jsonBodyBuilder) {
+ public AaiHttpPatchClient(final AaiClientConfiguration configuration, JsonBodyBuilder jsonBodyBuilder, CloudHttpClient httpPatchClient) {
this.configuration = configuration;
this.jsonBodyBuilder = jsonBodyBuilder;
+ this.httpPatchClient = httpPatchClient;
}
public Mono<HttpClientResponse> getAaiResponse(AaiModel aaiModel) {
@@ -48,11 +49,6 @@ public final class AaiHttpPatchClient implements AaiHttpClient<HttpClientRespons
.patch(getUri(aaiModel.getCorrelationId()), createRequestDiagnosticContext(), configuration.aaiHeaders(), jsonBodyBuilder, aaiModel);
}
- public AaiHttpPatchClient createAaiHttpClient(CloudHttpClient httpPatchClient) {
- this.httpPatchClient = httpPatchClient;
- 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/put/AaiHttpPutClient.java b/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/put/AaiHttpPutClient.java
new file mode 100644
index 00000000..33fcfcce
--- /dev/null
+++ b/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/put/AaiHttpPutClient.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * DCAEGEN2-SERVICES-SDK
+ * ================================================================================
+ * Copyright (C) 2019 NOKIA Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.put;
+
+import static org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.AaiHttpClientFactory.createRequestDiagnosticContext;
+
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.AaiHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.CloudHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.model.AaiModel;
+import org.onap.dcaegen2.services.sdk.rest.services.model.JsonBodyBuilder;
+import reactor.core.publisher.Mono;
+import reactor.netty.http.client.HttpClientResponse;
+
+public class AaiHttpPutClient implements AaiHttpClient<HttpClientResponse> {
+
+ 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<HttpClientResponse> getAaiResponse(AaiModel aaiModel) {
+ return httpPutClient
+ .put(uri, createRequestDiagnosticContext(), configuration.aaiHeaders(), jsonBodyBuilder, aaiModel);
+ }
+}