99import org .springframework .web .bind .annotation .*;
1010
1111@ RestController
12- @ RequestMapping ("v1.0 " )
12+ @ RequestMapping ("srv " )
1313public class SrvRestController {
1414
1515 @ Autowired
@@ -26,7 +26,7 @@ public class SrvRestController {
2626 * @param diskQuota Maximum amount of allocated memory on the disk
2727 * @return Json object with data
2828 */
29- @ PostMapping ("/srv/ container/create" )
29+ @ PostMapping ("container/create" )
3030 public @ ResponseBody
3131 ResponseEntity createContainer (@ RequestParam ("dockerimage" ) String dockerImage , @ RequestParam ("exposedports" ) Integer exposedPorts , @ RequestParam ("hostport" ) Integer hostPort , @ RequestParam ("name" ) String name , @ RequestParam ("rammemory" ) Long ramMemory , @ RequestParam ("diskquota" ) Long diskQuota ) {
3232 HttpHeaders headers = new HttpHeaders ();
@@ -47,7 +47,7 @@ ResponseEntity createContainer(@RequestParam("dockerimage") String dockerImage,
4747 * @param containerId Container ID
4848 * @return Json object as response
4949 */
50- @ PostMapping ("/srv/ container/{ID}/restart" )
50+ @ PostMapping ("container/{ID}/restart" )
5151 public @ ResponseBody
5252 ResponseEntity restartContainer (@ PathVariable (value = "ID" ) String containerId ) {
5353 HttpHeaders headers = new HttpHeaders ();
@@ -57,10 +57,12 @@ ResponseEntity restartContainer(@PathVariable(value = "ID") String containerId)
5757 }
5858
5959 /**
60+ * Stop the container with the specified ID
61+ *
6062 * @param containerId Container ID
6163 * @return Json object as response
6264 */
63- @ PostMapping ("/srv/ container/{ID}/stop" )
65+ @ PostMapping ("container/{ID}/stop" )
6466 public @ ResponseBody
6567 ResponseEntity stopContainer (@ PathVariable (value = "ID" ) String containerId ) {
6668 HttpHeaders headers = new HttpHeaders ();
@@ -75,7 +77,7 @@ ResponseEntity stopContainer(@PathVariable(value = "ID") String containerId) {
7577 * @param containerId Container ID
7678 * @return Json object as response
7779 */
78- @ PostMapping ("/srv/ container/{ID}/start" )
80+ @ PostMapping ("container/{ID}/start" )
7981 public @ ResponseBody
8082 ResponseEntity startContainer (@ PathVariable (value = "ID" ) String containerId ) {
8183 HttpHeaders headers = new HttpHeaders ();
@@ -90,7 +92,7 @@ ResponseEntity startContainer(@PathVariable(value = "ID") String containerId) {
9092 * @param containerId Container ID
9193 * @return Json object as response
9294 */
93- @ GetMapping ("/srv/ container/{ID}/logs" )
95+ @ GetMapping ("container/{ID}/logs" )
9496 public @ ResponseBody
9597 ResponseEntity logsContainer (@ PathVariable (value = "ID" ) String containerId ) {
9698 HttpHeaders headers = new HttpHeaders ();
@@ -101,12 +103,26 @@ ResponseEntity logsContainer(@PathVariable(value = "ID") String containerId) {
101103 return new ResponseEntity <>(replaceString , headers , HttpStatus .valueOf (201 ));
102104 }
103105
106+ /**
107+ * The method returns information about the container
108+ * @param containerId Container ID
109+ * @return Json object as response
110+ */
111+ @ GetMapping ("container/{ID}/info" )
112+ public @ ResponseBody
113+ ResponseEntity infoContainer (@ PathVariable (value = "ID" ) String containerId ) {
114+ HttpHeaders headers = new HttpHeaders ();
115+ headers .setContentType (MediaType .APPLICATION_JSON );
116+ String response = srvClient .infoContainer (containerId );
117+ return new ResponseEntity <>(response , headers , HttpStatus .valueOf (200 ));
118+ }
119+
104120 /**
105121 * The method returns information about the docker server
106122 *
107123 * @return Json object as response
108124 */
109- @ GetMapping ("/srv/ info" )
125+ @ GetMapping ("info" )
110126 public @ ResponseBody
111127 ResponseEntity infoDocker () {
112128 HttpHeaders headers = new HttpHeaders ();
@@ -121,7 +137,7 @@ ResponseEntity infoDocker() {
121137 * @param containerId Container ID
122138 * @return Json object as response
123139 */
124- @ DeleteMapping ("/srv/ container/{ID}/delete" )
140+ @ DeleteMapping ("container/{ID}/delete" )
125141 public @ ResponseBody
126142 ResponseEntity deleteContainer (@ PathVariable (value = "ID" ) String containerId ) {
127143 HttpHeaders headers = new HttpHeaders ();
@@ -138,7 +154,7 @@ ResponseEntity deleteContainer(@PathVariable(value = "ID") String containerId) {
138154 * @param arguments Argument to execute
139155 * @return Json object as response
140156 */
141- @ PostMapping ("/srv/ container/{ID}/exec" )
157+ @ PostMapping ("container/{ID}/exec" )
142158 public @ ResponseBody
143159 ResponseEntity execContainer (@ PathVariable (value = "ID" ) String containerId , @ RequestParam ("path" ) String path , @ RequestParam ("argument" ) String arguments ) {
144160 HttpHeaders headers = new HttpHeaders ();
0 commit comments