aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorLathish <lathishbabu.ganesan@est.tech>2019-03-30 16:41:10 +0000
committerLathish <lathishbabu.ganesan@est.tech>2019-03-30 16:41:10 +0000
commitb098903d536b2e6b6b76a310035f9e0950817f50 (patch)
treec0a4756ce63e2dec881ef9f1953cc4b01546067c /common
parent1f8531ddb54b133ed0b25628d43ec698caa9b087 (diff)
Added ETSI Delete VNF BB
Change-Id: Ie82734f25468b75d9b4ab3096639a9afdf6fe2c1 Issue-ID: SO-1632 Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
Diffstat (limited to 'common')
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java9
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java12
2 files changed, 21 insertions, 0 deletions
diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
index 43b2fb4292..282c87a736 100644
--- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
@@ -68,5 +68,14 @@ public interface HttpRestServiceProvider {
*/
public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz);
+ /**
+ * Execute the HTTP DELETE to the given URI template
+ *
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the {@link ResponseEntity}.
+ */
+ public <T> ResponseEntity<T> deleteHttpRequest(final String url, final Class<T> clazz);
+
}
diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
index 032df84a98..164d48bc5e 100644
--- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
@@ -138,6 +138,18 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
}
}
+ @Override
+ public <T> ResponseEntity<T> deleteHttpRequest(final String url, final Class<T> clazz) {
+ try {
+ final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders());
+ return restTemplate.exchange(url, HttpMethod.DELETE, request, clazz);
+
+ } catch (final RestClientException restClientException) {
+ LOGGER.error("Unable to invoke HTTP DELETE using url: " + url, restClientException);
+ throw new InvalidRestRequestException("Unable to invoke HTTP DELETE using URL: " + url, restClientException);
+ }
+ }
+
private HttpHeaders getHttpHeaders() {
return httpHeadersProvider.getHttpHeaders();
}