X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=inline;f=sdnc-a1-controller%2Foam%2Fconfigbackuprestore%2Fvnfconfigbackupservice%2Fsrc%2Fmain%2Fjava%2Fcom%2Fonap%2Fsdnc%2Fvnfbackupservice%2Fscheduler%2FVnfRestClient.java;fp=sdnc-a1-controller%2Foam%2Fconfigbackuprestore%2Fvnfconfigbackupservice%2Fsrc%2Fmain%2Fjava%2Fcom%2Fonap%2Fsdnc%2Fvnfbackupservice%2Fscheduler%2FVnfRestClient.java;h=0000000000000000000000000000000000000000;hb=6a24cde9bbcc101fca02204ca6f1c69ada049790;hp=2af4e0842401433908c04c719ec006754a31d126;hpb=22ca33237c833c90e3626bf1132e72282e207ea5;p=nonrtric.git diff --git a/sdnc-a1-controller/oam/configbackuprestore/vnfconfigbackupservice/src/main/java/com/onap/sdnc/vnfbackupservice/scheduler/VnfRestClient.java b/sdnc-a1-controller/oam/configbackuprestore/vnfconfigbackupservice/src/main/java/com/onap/sdnc/vnfbackupservice/scheduler/VnfRestClient.java deleted file mode 100644 index 2af4e084..00000000 --- a/sdnc-a1-controller/oam/configbackuprestore/vnfconfigbackupservice/src/main/java/com/onap/sdnc/vnfbackupservice/scheduler/VnfRestClient.java +++ /dev/null @@ -1,58 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SDNC-FEATURES -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* 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 com.onap.sdnc.vnfbackupservice.scheduler; - - -import java.util.Arrays; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - - -@Service -public class VnfRestClient { - - @Autowired - private RestTemplate restTemplate; - - public String vnfRestClient(String url, String userName, String password) { - restTemplate = new RestTemplate(); - HttpHeaders headers = new HttpHeaders(); - HttpEntity entity = new HttpEntity(generateHeaders(headers, userName, password)); - ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); - String result = response.getBody(); - return result; - } - - public HttpHeaders generateHeaders(HttpHeaders headers, String userName, String password) { - headers.setAccept(Arrays.asList(new MediaType[] { MediaType.APPLICATION_JSON })); - headers.setContentType(MediaType.APPLICATION_JSON); - String base64Username = userName + ":" + password; - byte[] message = base64Username.getBytes(); - headers.set("Authorization", "Basic " + java.util.Base64.getEncoder().encodeToString(message)); - return headers; - } -}