1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 Wipro Limited.
6 * ==============================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 *******************************************************************************/
22 package org.onap.slice.analysis.ms.restclients;
24 import java.util.Collections;
26 import org.springframework.core.ParameterizedTypeReference;
27 import org.springframework.http.HttpHeaders;
28 import org.springframework.http.MediaType;
29 import org.springframework.http.ResponseEntity;
30 import org.springframework.stereotype.Component;
33 * This class represents rest client for config db interfaces
36 public class ConfigDbRestClient extends RestClient {
38 public ConfigDbRestClient() {
43 * Send Post Request to Config DB.
46 public <T> ResponseEntity<T> sendPostRequest(String requestUrl, String requestBody,
47 ParameterizedTypeReference<T> responseType) {
48 HttpHeaders headers = new HttpHeaders();
49 headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
50 headers.setContentType(MediaType.APPLICATION_JSON);
51 return super.sendPostRequest(headers, requestUrl, requestBody, responseType);
55 * Send Get Request to Config DB.
58 public <T> ResponseEntity<T> sendGetRequest(String requestUrl, ParameterizedTypeReference<T> responseType) {
59 HttpHeaders headers = new HttpHeaders();
60 headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
61 headers.setContentType(MediaType.APPLICATION_JSON);
62 return super.sendGetRequest(headers, requestUrl, responseType);