From b098903d536b2e6b6b76a310035f9e0950817f50 Mon Sep 17 00:00:00 2001 From: Lathish Date: Sat, 30 Mar 2019 16:41:10 +0000 Subject: Added ETSI Delete VNF BB Change-Id: Ie82734f25468b75d9b4ab3096639a9afdf6fe2c1 Issue-ID: SO-1632 Signed-off-by: Lathish --- .../org/onap/so/rest/service/HttpRestServiceProvider.java | 9 +++++++++ .../onap/so/rest/service/HttpRestServiceProviderImpl.java | 12 ++++++++++++ 2 files changed, 21 insertions(+) (limited to 'common/src/main/java/org') 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 ResponseEntity postHttpRequest(final Object object, final String url, final Class 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 ResponseEntity deleteHttpRequest(final String url, final Class 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 ResponseEntity deleteHttpRequest(final String url, final Class 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(); } -- cgit 1.2.3-korg