24fc686420d28e868fbc109faecc67c4eed86208
[platform/core/security/suspicious-activity-monitor.git] / server / samserver / src / main / java / com / samsung / samserver / web / rest / controller / IRestDashboard.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 com.samsung.samserver.web.rest.errors.UserServiceError;
10 import com.samsung.samserver.web.rest.service.vm.*;
11 import org.springframework.data.domain.Pageable;
12 import org.springframework.http.*;
13 import org.springframework.web.bind.annotation.*;
14 import io.swagger.annotations.*;
15 import javax.validation.Valid;
16 import java.util.List;
17
18 /**
19  * Rest Interface for dashboard.
20  *
21  * @author <A HREF="mailto:m.dalakov@samsung.com">Mykhailo Dalakov</A>
22  * @version 1.0
23  */
24 @RequestMapping("/dashboard")
25 public interface IRestDashboard {
26
27     /**
28      * GET  /devices : get all the devices.
29      *
30      * @return the ResponseEntity with status 200 (OK) and the list of devices in body
31      */
32     @ApiOperation(value = "get all devices", notes = "The “get all devices” operation is used to obtain all registered devices.")
33     @ApiResponses(value = {
34             @ApiResponse(code = 200, message = "OK. Request executed successfully."),
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 user has to repeat action.")
37     })
38     @RequestMapping(value ="/devices", method = RequestMethod.GET)
39     @ResponseStatus(HttpStatus.OK)
40     public ResponseEntity<List<UIDevice>> getAllDevices(Pageable pageable);
41
42
43     /**
44      * POST request login
45      *
46      * @return the ResponseEntity with status 200 (OK) and JWT
47      */
48     @ApiOperation(value = "login", notes = "The “login” operation is used to authenticate user and receive JWT token.")
49     @ApiResponses(value = {
50             @ApiResponse(code = 200, message = "OK. Login was successful."),
51             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
52             @ApiResponse(code = 500, message = "Internal server error. The user has to repeat action.")
53     })
54     @RequestMapping(value ="/auth/login", method = RequestMethod.POST)
55     @ResponseStatus(HttpStatus.OK)
56     public ResponseEntity<UserJWTService.JWTToken> login(
57             @Valid @ApiParam(value = "Login Data", required = true) @RequestBody UILogin uiLogin);
58
59
60     /**
61      * POST request register the user.
62      *
63      * @param uiRegistration the managed user View Model
64      * @throws UserServiceError.InvalidPasswordException 400 (Bad Request) if the password is incorrect
65      * @throws UserServiceError.EmailAlreadyUsedException 400 (Bad Request) if the email is already used
66      * @throws UserServiceError.LoginAlreadyUsedException 400 (Bad Request) if the login is already used
67      */
68     @ApiOperation(value = "register", notes = "The “register” operation is used to register new user.")
69     @ApiResponses(value = {
70             @ApiResponse(code = 201, message = "Register was successful. New User was created."),
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 user has to repeat action.")
73     })
74     @RequestMapping(value ="/auth/register", method = RequestMethod.POST)
75     @ResponseStatus(HttpStatus.CREATED)
76     public void registerAccount(
77             @Valid @ApiParam(value = "Managed User", required = true) @RequestBody UIRegistration uiRegistration);
78
79
80     /**
81      * DELETE request logout
82      *
83      * @return the ResponseEntity with status 200 (OK)
84      */
85     @ApiOperation(value = "logout", notes = "The “logout” operation is used to logout user.")
86     @ApiResponses(value = {
87             @ApiResponse(code = 200, message = "OK. Logout was successful."),
88             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
89             @ApiResponse(code = 500, message = "Internal server error. The user has to repeat action.")
90     })
91     @RequestMapping(value ="/auth/logout", method = RequestMethod.DELETE)
92     @ResponseStatus(HttpStatus.OK)
93     public ResponseEntity<Void> logout();
94
95
96     /**
97      * PUT  /devices/update : Updates an existing devices.
98      *
99      * @param uiDeviceUpdate list the device info to update
100      * @return the ResponseEntity with status 200 (OK)
101      * or with status 400 (Bad Request) if the uiDeviceUpdate is not valid
102      */
103     @ApiOperation(value = "devices update", notes = "The “devices update” operation is used to update devices.")
104     @ApiResponses(value = {
105             @ApiResponse(code = 200, message = "OK. All updates was successfully."),
106             @ApiResponse(code = 204, message = "No Content. All updates was unsuccessfully."),
107             @ApiResponse(code = 206, message = "Partial Content. Part updates was successfully."),
108             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
109             @ApiResponse(code = 500, message = "Internal server error. The user has to repeat action.")
110     })
111     @RequestMapping(value ="/devices/update", method = RequestMethod.PUT)
112     public ResponseEntity<List<UIDevice>> updateDevice(@Valid @RequestBody UIDeviceUpdate uiDeviceUpdate);
113
114
115     /**
116      * POST Dashboard log.
117      *
118      * @param uiDashboardLog the ui dashboard log
119      * @return the ResponseEntity with status 200 (OK)
120      */
121     @RequestMapping(value ="/logs", method = RequestMethod.POST)
122     public ResponseEntity<Void> sendDashboardLogs(@Valid @RequestBody UIDashboardLog uiDashboardLog);
123
124
125     /**
126      * PUT  /policies/device : Update an device policies.
127      *
128      * @param uiPolicesUpdate list the ui policies to update device policies
129      * @return the ResponseEntity with status 200 (OK)
130      * or with status 400 (Bad Request) if the uiPolicesUpdate is not valid
131      */
132     @ApiOperation(value = "device policy update", notes = "The “device policy update” operation is used to update device policy.")
133     @ApiResponses(value = {
134             @ApiResponse(code = 200, message = "OK. All updates was successfully."),
135             @ApiResponse(code = 204, message = "No Content. All updates was unsuccessfully."),
136             @ApiResponse(code = 206, message = "Partial Content. Part updates was successfully."),
137             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
138             @ApiResponse(code = 500, message = "Internal server error. The user has to repeat action.")
139     })
140     @RequestMapping(value ="/policies/device", method = RequestMethod.PUT)
141     public ResponseEntity<List<UIPolicies.UIPolicy>> updateDevicePolicies(
142             @ApiParam(value = "device id", required = true) @RequestParam(value = "id") Long id, @Valid @RequestBody UIPoliciesUpdate uiPolicesUpdate);
143
144
145     /**
146      * GET  /policies : get all the polices.
147      *
148      * @return the ResponseEntity with status 200 (OK) and the list of polices
149      */
150     @ApiOperation(value = "get all polices", notes = "The “get all polices” operation is used to obtain all polices.")
151     @ApiResponses(value = {
152             @ApiResponse(code = 200, message = "OK. Request executed successfully."),
153             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
154             @ApiResponse(code = 500, message = "Internal server error. The user has to repeat action.")
155     })
156     @RequestMapping(value ="/policies", method = RequestMethod.GET)
157     @ResponseStatus(HttpStatus.OK)
158     public ResponseEntity<List<UIPolicies>> getAllPolices();
159
160
161     /**
162      * GET  /policies/device?id : get the device polices.
163      *
164      * @param id the id of the device
165      * @return the ResponseEntity with status 200 (OK) and the list of polices
166      */
167     @ApiOperation(value = "get device polices", notes = "The “get device polices” operation is used to obtain device polices.")
168     @ApiResponses(value = {
169             @ApiResponse(code = 200, message = "OK. Request executed successfully."),
170             @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
171             @ApiResponse(code = 500, message = "Internal server error. The user has to repeat action.")
172     })
173     @RequestMapping(value ="/policies/device", method = RequestMethod.GET)
174     @ResponseStatus(HttpStatus.OK)
175     public ResponseEntity<List<UIPolicies>> getDevicePolices(
176             @ApiParam(value = "device id", required = true) @RequestParam(value = "id") Long id);
177
178 }