1 package info.mikethomas.fahservices.service;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import info.mikethomas.jfold.Connection;
26
27 import io.swagger.v3.oas.annotations.Operation;
28 import io.swagger.v3.oas.annotations.Parameter;
29 import io.swagger.v3.oas.annotations.media.Schema;
30 import io.swagger.v3.oas.annotations.responses.ApiResponse;
31 import io.swagger.v3.oas.annotations.tags.Tag;
32
33 import org.springframework.beans.factory.annotation.Autowired;
34 import org.springframework.http.HttpStatus;
35 import org.springframework.http.MediaType;
36 import org.springframework.http.ResponseEntity;
37 import org.springframework.web.bind.annotation.PathVariable;
38 import org.springframework.web.bind.annotation.RequestMapping;
39 import org.springframework.web.bind.annotation.RequestMethod;
40 import org.springframework.web.bind.annotation.ResponseBody;
41 import org.springframework.web.bind.annotation.RestController;
42
43
44
45
46
47
48
49 @RestController("slot-add")
50 @Tag(name = "Slot Add", description = "Add a new slot.")
51 public class SlotAddResource {
52
53 @Autowired
54 private Connection connection;
55
56
57
58
59
60
61
62
63 @Operation(summary = "slot-add {type}", description = "Add a new slot.", responses = {
64 @ApiResponse(responseCode = "200", description = "OK")
65 })
66 @RequestMapping(
67 value = "/slot-add/{type}",
68 method = RequestMethod.POST,
69 produces = {
70 MediaType.APPLICATION_JSON_VALUE,
71 MediaType.APPLICATION_XML_VALUE,
72 MediaType.TEXT_XML_VALUE
73 })
74 @ResponseBody
75 public ResponseEntity<String> getSlotAdd(
76 @Parameter(description = "slot type", required = true, schema =
77 @Schema(allowableValues = { "CPU", "GPU" })
78 )
79 @PathVariable("type") final String type) {
80 connection.slotAdd(type);
81 return new ResponseEntity<>(HttpStatus.OK);
82 }
83 }