summaryrefslogtreecommitdiffstats
path: root/common/src/main
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-04-01 13:24:50 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-01 13:24:50 +0000
commitc9296dc7147f22ed636f928f6c38ad099e3ed398 (patch)
tree6e5c23f721ba5ad9f6704bd830965f1125368419 /common/src/main
parent24117e55159518d2e3599fd7cf6705d476cfda81 (diff)
parentb098903d536b2e6b6b76a310035f9e0950817f50 (diff)
Merge "Added ETSI Delete VNF BB"
Diffstat (limited to 'common/src/main')
-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();
}