b23cae16216da27407fd589746c99045c2f27294
[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 = 404, message = "Device not found. The device should be registered"),
55         @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
56     })
57     @RequestMapping(value ="/get-updates", method = RequestMethod.GET, produces = {
58         MediaType.APPLICATION_JSON_VALUE })
59     public ResponseEntity<List<GetUpdatesRestService.UInfo>> getUpdates(
60         @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid);
61
62
63     /**
64      * POST sendData
65      */
66     @ApiOperation(value = "sendData", notes =
67         "The “Send data” operation is used to send data (like as reports, notifications, policies, states, etc)" +
68             " to server. \n"
69     )
70     @ApiResponses(value = {
71         @ApiResponse(code = 200, message = "OK. Send data was successful."),
72         @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
73         @ApiResponse(code = 404, message = "Device not found. The device should be registered"),
74         @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
75     })
76     @RequestMapping(value ="/send-data", method = RequestMethod.POST)
77     public ResponseEntity<Void> sendData(
78         @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid,
79         @Valid @ApiParam(value = "Device Data", required = true) @RequestBody SendDataRestService.Data data);
80
81
82     /*
83      * GET updates data
84      */
85     @ApiOperation(value = "getUData", notes =
86             "The “Get updates data” operation is used to obtain data " +
87                     "which should be applied on device. For example: policies, whitelist, blacklist, state, etc. "
88     )
89     @ApiResponses(value = {
90             @ApiResponse(code = 200, message = "OK. The data are found and should apply by device."),
91             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
92             @ApiResponse(code = 404, message = "Device not found. The device should be registered"),
93             @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
94     })
95     @RequestMapping(value ="/get-udata", method = RequestMethod.GET)
96     public ResponseEntity<String> getUData(
97             @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid,
98             @ApiParam(value = "Update identity", required = true) @RequestParam(value = "uuid") String uuid);
99
100
101     /**
102      * POST send data confirm
103      */
104     @ApiOperation(value = "sendDataConfirm", notes =
105             "The “Send data confirm” operation is used to confirm that device applied updates."
106     )
107     @ApiResponses(value = {
108             @ApiResponse(code = 200, message = "OK. Confirmation is successfully."),
109             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
110             @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
111     })
112     @RequestMapping(value ="/send-data/confirm", method = RequestMethod.POST)
113     public ResponseEntity<Void> sendDataConfirm(
114             @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid,
115             @ApiParam(value = "Update identity", required = true) @RequestParam(value = "uuid") String uuid);
116
117 }