[SECARSP-111] +Auth API [SECARSP-115 +Get Devices]
[platform/core/security/suspicious-activity-monitor.git] / server / src / main / java / com / samsung / samserver / web / rest / controller / IRestDevice.java
1 /*
2  * In Samsung Ukraine R&D Center (SRK under a contract between)
3  * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
4  * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
5  */
6 package com.samsung.samserver.web.rest.controller;
7
8 import com.samsung.samserver.web.rest.service.*;
9 import org.springframework.http.*;
10 import org.springframework.web.bind.annotation.*;
11 import io.swagger.annotations.*;
12
13 import javax.validation.Valid;
14 import java.util.List;
15
16 /**
17  * Rest Interface for device service.
18  *
19  * @author <A HREF="mailto:m.dalakov@samsung.com">Mykhailo Dalakov</A>
20  * @version 1.0
21  */
22 @RequestMapping("/api/device-service")
23 public interface IRestDevice {
24
25     /**
26      * POST  /device-service : Register a new device.
27      *
28      * @param DInfo the device view model
29      * @return the ResponseEntity with status 200 or with status 400 (Bad Request)
30      */
31     @ApiOperation(value = "registerDevice", notes = "The “Register device” operation is used for device registration. "
32     )
33     @ApiResponses(value = {
34         @ApiResponse(code = 200, message = "OK. Device is successfully registered"),
35         @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
36         @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
37     })
38     @RequestMapping(value ="/register-device", method = RequestMethod.POST)
39     public ResponseEntity<String> registerDevice(
40         @ApiParam(value = "Device info", required = true) @Valid @RequestBody RegisterDeviceRestService.DInfo DInfo);
41
42
43     /*
44      * GET getUpdates
45      */
46     @ApiOperation(value = "getUpdates", notes =
47         "The “Get updates” operation is used to obtain information about changes " +
48             "which should be applied on device. For example: policies, whitelist, blacklist, state, etc. "
49     )
50     @ApiResponses(value = {
51         @ApiResponse(code = 200, message = "OK. The updates are found and should apply by device."),
52         @ApiResponse(code = 304, message = "Not Modified. The updates aren’t required"),
53         @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
54         @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
55     })
56     @RequestMapping(value ="/get-updates", method = RequestMethod.GET, produces = {
57         MediaType.APPLICATION_JSON_VALUE })
58     public ResponseEntity<List<GetUpdatesRestService.UInfo>> getUpdates(
59         @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid);
60
61
62     /**
63      * POST sendData
64      */
65     @ApiOperation(value = "sendData", notes =
66         "The “Send data” operation is used to send data (like as reports, notifications, policies, states, etc)" +
67             " to server. \n"
68     )
69     @ApiResponses(value = {
70         @ApiResponse(code = 200, message = "OK. Send data was successful."),
71         @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
72         @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
73     })
74     @RequestMapping(value ="/send-data", method = RequestMethod.POST)
75     public ResponseEntity<Void> sendData(
76         @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid,
77         @Valid @ApiParam(value = "Device Data", required = true) @RequestBody SendDataRestService.Data data);
78
79
80     /*
81      * GET updates data
82      */
83     @ApiOperation(value = "getUData", notes =
84             "The “Get updates data” operation is used to obtain data " +
85                     "which should be applied on device. For example: policies, whitelist, blacklist, state, etc. "
86     )
87     @ApiResponses(value = {
88             @ApiResponse(code = 200, message = "OK. The data are found and should apply by device."),
89             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
90             @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
91     })
92     @RequestMapping(value ="/get-udata", method = RequestMethod.GET)
93     public ResponseEntity<String> getUData(
94             @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid,
95             @ApiParam(value = "Update identity", required = true) @RequestParam(value = "uuid") String uuid);
96
97
98     /**
99      * POST send data confirm
100      */
101     @ApiOperation(value = "sendDataConfirm", notes =
102             "The “Send data confirm” operation is used to confirm that device applied updates."
103     )
104     @ApiResponses(value = {
105             @ApiResponse(code = 200, message = "OK. Confirmation is successfully."),
106             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
107             @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
108     })
109     @RequestMapping(value ="/send-data/confirm", method = RequestMethod.POST)
110     public ResponseEntity<Void> sendDataConfirm(
111             @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid,
112             @ApiParam(value = "Update identity", required = true) @RequestParam(value = "uuid") String uuid);
113
114 }