Epic-231 cbr reports
[sdnc/oam.git] / configbackuprestore / vnfconfigreportsservice / src / main / java / com / onap / sdnc / vnfreportsservice / controller / VnfReportsServiceController.java
1 package com.onap.sdnc.vnfreportsservice.controller;
2
3 import java.util.Date;
4 import java.util.List;
5
6 import org.apache.logging.log4j.LogManager;
7 import org.apache.logging.log4j.Logger;
8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.format.annotation.DateTimeFormat;
10 import org.springframework.web.bind.annotation.PathVariable;
11 import org.springframework.web.bind.annotation.RequestMapping;
12 import org.springframework.web.bind.annotation.RequestMethod;
13 import org.springframework.web.bind.annotation.RestController;
14
15 import com.onap.sdnc.vnfreportsservice.model.VnfConfigDetailsDB;
16 import com.onap.sdnc.vnfreportsservice.service.VnfReportsServiceImpl;
17
18 @RestController
19 public class VnfReportsServiceController {
20
21         private static final Logger logger = LogManager.getLogger(VnfReportsServiceController.class);
22
23         @Autowired
24         VnfReportsServiceImpl Vnfreportsservice;
25
26         @RequestMapping(value = "/getVnfDetBetDates/{startDate}/{endDate}", method = RequestMethod.GET, produces = "application/json")
27
28         public List<VnfConfigDetailsDB> getVnfConfigDetailsBetweenDates(
29                         @PathVariable("startDate") @DateTimeFormat(pattern = "dd-MM-yyyy") Date startDate,
30                         @PathVariable("endDate") @DateTimeFormat(pattern = "dd-MM-yyyy") Date endDate) {
31                         logger.info("Get VNF Configuration Details Inbetween 2 Dates ");
32                 return Vnfreportsservice.getVnfConfigDetailsBetweenDates(startDate, endDate);
33         }
34
35         @RequestMapping(value = "/getVnfDetByVnfidBetDates/{vnfid}/{startDate}/{endDate}", method = RequestMethod.GET, produces = "application/json")
36
37         public List<VnfConfigDetailsDB> getVnfConfigDetailsByVnfIdBetweenDates(@PathVariable("vnfid") String vnfId,
38                         @PathVariable("startDate") @DateTimeFormat(pattern = "dd-MM-yyyy") Date startDate,
39                         @PathVariable("endDate") @DateTimeFormat(pattern = "dd-MM-yyyy") Date endDate) {
40                 logger.info("Get VNF Configuration Details Of a VnfID Inbetween 2 Dates ");
41                 return Vnfreportsservice.getVnfIdDetailsBetweenDates(vnfId, startDate, endDate);
42         }
43
44 }