1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.bremersee.dccon.api;
18
19 import io.swagger.v3.oas.annotations.Operation;
20 import io.swagger.v3.oas.annotations.Parameter;
21 import io.swagger.v3.oas.annotations.media.ArraySchema;
22 import io.swagger.v3.oas.annotations.media.Content;
23 import io.swagger.v3.oas.annotations.media.Schema;
24 import io.swagger.v3.oas.annotations.responses.ApiResponse;
25 import io.swagger.v3.oas.annotations.responses.ApiResponses;
26 import io.swagger.v3.oas.annotations.tags.Tag;
27 import javax.validation.Valid;
28 import org.bremersee.dccon.model.DomainGroup;
29 import org.bremersee.exception.model.RestApiException;
30 import org.springframework.validation.annotation.Validated;
31 import org.springframework.web.bind.annotation.PathVariable;
32 import org.springframework.web.bind.annotation.RequestBody;
33 import org.springframework.web.bind.annotation.RequestMapping;
34 import org.springframework.web.bind.annotation.RequestMethod;
35 import org.springframework.web.bind.annotation.RequestParam;
36 import reactor.core.publisher.Flux;
37 import reactor.core.publisher.Mono;
38
39
40
41
42
43
44 @Tag(name = "domain-group-management-controller", description = "The domain group API.")
45 @Validated
46 public interface DomainGroupWebfluxManagementApi {
47
48
49
50
51
52
53
54
55 @Operation(
56 summary = "Get all domain groups.",
57 operationId = "getGroups",
58 tags = {"domain-group-management-controller"})
59 @ApiResponses(value = {
60 @ApiResponse(
61 responseCode = "200",
62 description = "A list of domain groups.",
63 content = @Content(
64 array = @ArraySchema(
65 schema = @Schema(implementation = DomainGroup.class)))),
66 @ApiResponse(
67 responseCode = "500",
68 description = "Fatal server error.",
69 content = @Content(
70 schema = @Schema(
71 implementation = RestApiException.class)))
72 })
73 @RequestMapping(
74 value = "/api/groups",
75 produces = {"application/json"},
76 method = RequestMethod.GET)
77 Flux<DomainGroup> getGroups(
78 @Parameter(description = "The sort order.")
79 @RequestParam(value = "sort",
80 defaultValue = DomainGroup.DEFAULT_SORT_ORDER) String sort,
81
82 @Parameter(description = "A query.")
83 @RequestParam(name = "q", required = false) String query);
84
85
86
87
88
89
90
91 @Operation(
92 summary = "Add domain group.",
93 operationId = "addGroup",
94 tags = {"domain-group-management-controller"})
95 @ApiResponses(value = {
96 @ApiResponse(
97 responseCode = "200",
98 description = "The added domain group.",
99 content = @Content(
100 schema = @Schema(
101 implementation = DomainGroup.class))),
102 @ApiResponse(
103 responseCode = "400",
104 description = "Bad request.",
105 content = @Content(
106 schema = @Schema(
107 implementation = RestApiException.class))),
108 @ApiResponse(
109 responseCode = "406",
110 description = "Already exists.",
111 content = @Content(
112 schema = @Schema(
113 implementation = RestApiException.class))),
114 @ApiResponse(
115 responseCode = "500",
116 description = "Fatal server error.",
117 content = @Content(
118 schema = @Schema(
119 implementation = RestApiException.class)))
120 })
121 @RequestMapping(
122 value = "/api/groups",
123 produces = {"application/json"},
124 consumes = {"application/json"},
125 method = RequestMethod.POST)
126 Mono<DomainGroup> addGroup(
127 @Parameter(description = "The domain group to add.", required = true)
128 @Valid @RequestBody DomainGroup group);
129
130
131
132
133
134
135
136 @Operation(
137 summary = "Get a domain group by name.",
138 operationId = "getGroupByName",
139 tags = {"domain-group-management-controller"})
140 @ApiResponses(value = {
141 @ApiResponse(
142 responseCode = "200",
143 description = "The domain group with the specified name.",
144 content = @Content(
145 schema = @Schema(
146 implementation = DomainGroup.class))),
147 @ApiResponse(
148 responseCode = "400",
149 description = "Bad request.",
150 content = @Content(
151 schema = @Schema(
152 implementation = RestApiException.class))),
153 @ApiResponse(
154 responseCode = "404",
155 description = "Not found.",
156 content = @Content(
157 schema = @Schema(
158 implementation = RestApiException.class))),
159 @ApiResponse(
160 responseCode = "500",
161 description = "Fatal server error.",
162 content = @Content(
163 schema = @Schema(
164 implementation = RestApiException.class)))
165 })
166 @RequestMapping(
167 value = "/api/groups/{groupName}",
168 produces = {"application/json"},
169 method = RequestMethod.GET)
170 Mono<DomainGroup> getGroup(
171 @Parameter(description = "The domain group name.", required = true)
172 @PathVariable("groupName") String groupName);
173
174
175
176
177
178
179
180
181 @Operation(
182 summary = "Updates a domain group.",
183 operationId = "updateGroup",
184 tags = {"domain-group-management-controller"})
185 @ApiResponses(value = {
186 @ApiResponse(
187 responseCode = "200",
188 description = "The updated domain group.",
189 content = @Content(
190 schema = @Schema(
191 implementation = DomainGroup.class))),
192 @ApiResponse(
193 responseCode = "400",
194 description = "Bad request.",
195 content = @Content(
196 schema = @Schema(
197 implementation = RestApiException.class))),
198 @ApiResponse(
199 responseCode = "404",
200 description = "Not found.",
201 content = @Content(
202 schema = @Schema(
203 implementation = RestApiException.class))),
204 @ApiResponse(
205 responseCode = "500",
206 description = "Fatal server error.",
207 content = @Content(
208 schema = @Schema(
209 implementation = RestApiException.class)))
210 })
211 @RequestMapping(
212 value = "/api/groups/{groupName}",
213 produces = {"application/json"},
214 consumes = {"application/json"},
215 method = RequestMethod.PUT)
216 Mono<DomainGroup> updateGroup(
217 @Parameter(description = "The name of the domain group.", required = true)
218 @PathVariable("groupName") String groupName,
219
220 @Parameter(description = "The domain group.", required = true)
221 @Valid @RequestBody DomainGroup domainGroup);
222
223
224
225
226
227
228
229 @Operation(
230 summary = "Checks whether a domain group exists.",
231 operationId = "groupExists",
232 tags = {"domain-group-management-controller"})
233 @ApiResponses(value = {
234 @ApiResponse(
235 responseCode = "200",
236 description = "True if the group exists otherwise false.",
237 content = @Content(
238 schema = @Schema(
239 implementation = Boolean.class))),
240 @ApiResponse(
241 responseCode = "500",
242 description = "Fatal server error.",
243 content = @Content(
244 schema = @Schema(
245 implementation = RestApiException.class)))
246 })
247 @RequestMapping(value = "/api/groups/{groupName}/exists",
248 produces = {"application/json"},
249 method = RequestMethod.GET)
250 Mono<Boolean> groupExists(
251 @Parameter(description = "The name of the domain group.", required = true)
252 @PathVariable("groupName") String groupName);
253
254
255
256
257
258
259
260 @Operation(
261 summary = "Checks whether a group is in use or not.",
262 operationId = "isGroupNameInUse",
263 tags = {"domain-group-management-controller"})
264 @ApiResponses(value = {
265 @ApiResponse(
266 responseCode = "200",
267 description = "True if the group name is in use otherwise false.",
268 content = @Content(
269 schema = @Schema(
270 implementation = Boolean.class))),
271 @ApiResponse(
272 responseCode = "500",
273 description = "Fatal server error.",
274 content = @Content(
275 schema = @Schema(
276 implementation = RestApiException.class)))
277 })
278 @RequestMapping(value = "/api/groups/{groupName}/in-use",
279 produces = {"application/json"},
280 method = RequestMethod.GET)
281 Mono<Boolean> isGroupNameInUse(
282 @Parameter(description = "The name of the domain group.", required = true)
283 @PathVariable("groupName") String groupName);
284
285
286
287
288
289
290
291 @Operation(
292 summary = "Delete domain group.",
293 operationId = "deleteGroup",
294 tags = {"domain-group-management-controller"})
295 @ApiResponses(value = {
296 @ApiResponse(
297 responseCode = "200",
298 description = "True if the domain group was successfully deleted, otherwise false.",
299 content = @Content(
300 schema = @Schema(
301 implementation = Boolean.class))),
302 @ApiResponse(
303 responseCode = "400",
304 description = "Bad request.",
305 content = @Content(
306 schema = @Schema(
307 implementation = RestApiException.class))),
308 @ApiResponse(
309 responseCode = "500",
310 description = "Fatal server error.",
311 content = @Content(
312 schema = @Schema(
313 implementation = RestApiException.class)))
314 })
315 @RequestMapping(
316 value = "/api/groups/{groupName}",
317 produces = {"application/json"},
318 method = RequestMethod.DELETE)
319 Mono<Boolean> deleteGroup(
320 @Parameter(description = "The domain group name.", required = true)
321 @PathVariable("groupName") String groupName);
322
323 }