|
|
|
|
@ -27,7 +27,9 @@ public class EdgeSWUploadService {
|
|
|
|
|
private final S3Client s3Client;
|
|
|
|
|
private final RestTemplate restTemplate;
|
|
|
|
|
private final String s3Bucket = "etri-advehicle-s3-bucket"; // S3 버킷 이름
|
|
|
|
|
private final String externalApiUrl = "https://a659120d3e2ff43ff94087b29396fd96-1057696791.ap-northeast-2.elb.amazonaws.com/api/datamanager/edge-sw/add-db";
|
|
|
|
|
private final String externalApiUrl_edge = "https://a659120d3e2ff43ff94087b29396fd96-1057696791.ap-northeast-2.elb.amazonaws.com/api/datamanager/edge-sw/add-db";
|
|
|
|
|
private final String externalApiUrl_sw = "https://a659120d3e2ff43ff94087b29396fd96-1057696791.ap-northeast-2.elb.amazonaws.com/api/datamanager/advehicle-sw/add-db";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public EdgeSWUploadService(S3Client s3Client, RestTemplate restTemplate) {
|
|
|
|
|
this.s3Client = s3Client;
|
|
|
|
|
@ -64,10 +66,14 @@ public class EdgeSWUploadService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String registerMetadata(EdgeSWVO edgeSWVO) {
|
|
|
|
|
//sw_type 0 = sw
|
|
|
|
|
// sw_type 1 = edge
|
|
|
|
|
public String registerMetadata(EdgeSWVO edgeSWVO, int sw_type) {
|
|
|
|
|
|
|
|
|
|
log.info("registerMetadata : " + edgeSWVO.toString());
|
|
|
|
|
|
|
|
|
|
String result_url = "";
|
|
|
|
|
|
|
|
|
|
// JSON Body 구성
|
|
|
|
|
Map<String, Object> jsonBody = new HashMap<>();
|
|
|
|
|
jsonBody.put("creation_datetime", edgeSWVO.getCreation_datetime());
|
|
|
|
|
@ -99,7 +105,13 @@ public class EdgeSWUploadService {
|
|
|
|
|
|
|
|
|
|
HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(jsonBody, headers);
|
|
|
|
|
|
|
|
|
|
ResponseEntity<String> response = restTemplate.postForEntity(externalApiUrl, requestEntity, String.class);
|
|
|
|
|
if(sw_type ==0) {
|
|
|
|
|
result_url = externalApiUrl_sw;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
result_url = externalApiUrl_edge;
|
|
|
|
|
}
|
|
|
|
|
ResponseEntity<String> response = restTemplate.postForEntity(result_url, requestEntity, String.class);
|
|
|
|
|
return response.getBody();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|