From ba36424dbd67566d63aaba88a4d8fce0b17d6af3 Mon Sep 17 00:00:00 2001 From: chasegawa Date: Fri, 19 Aug 2022 16:32:05 -0700 Subject: [PATCH] SHIBUI-2270 expanding backend API and services supporting the API Former-commit-id: 5e181da23ad2f721f58cf4c5fd5e2bfefd6050b1 --- .../ui/controller/ShibPropertiesController.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/controller/ShibPropertiesController.java b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/controller/ShibPropertiesController.java index 8b3952954..e81a872b8 100644 --- a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/controller/ShibPropertiesController.java +++ b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/controller/ShibPropertiesController.java @@ -1,14 +1,13 @@ package edu.internet2.tier.shibboleth.admin.ui.controller; -import edu.internet2.tier.shibboleth.admin.ui.domain.CustomEntityAttributeDefinition; import edu.internet2.tier.shibboleth.admin.ui.domain.shib.properties.ShibPropertySet; import edu.internet2.tier.shibboleth.admin.ui.exception.EntityNotFoundException; import edu.internet2.tier.shibboleth.admin.ui.exception.ObjectIdExistsException; import edu.internet2.tier.shibboleth.admin.ui.service.ShibConfigurationService; +import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tags; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.annotation.Secured; @@ -21,9 +20,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.servlet.support.ServletUriComponentsBuilder; - -import java.util.List; @RestController @RequestMapping(value = "/api/shib") @@ -34,6 +30,8 @@ public class ShibPropertiesController { @GetMapping("/properties") @Transactional(readOnly = true) + @Operation(description = "Return all the configuration properties - used to populate the UI with the know configuration properties", + summary = "Return all the configuration properties - used to populate the UI with the know configuration properties", method = "GET") public ResponseEntity getAllConfigurationProperties() { return ResponseEntity.ok(service.getAllConfigurationProperties()); } @@ -43,12 +41,16 @@ public ResponseEntity getAllConfigurationProperties() { */ @GetMapping("/property/set") @Transactional(readOnly = true) + @Operation(description = "Return a list of all the set names and their resourceId", + summary = "Return a list of all the set names and their resourceId", method = "GET") public ResponseEntity getAllPropertySets() { return ResponseEntity.ok(service.getAllPropertySets()); } @GetMapping("/property/set/{resourceId}") @Transactional(readOnly = true) + @Operation(description = "Return the property set with the given resourceId", + summary = "Return the property set with the given resourceId", method = "GET") public ResponseEntity getPropertySet(@PathVariable Integer resourceId) throws EntityNotFoundException { return ResponseEntity.ok(service.getSet(resourceId)); } @@ -64,6 +66,8 @@ public ResponseEntity deletePropertySet(@PathVariable Integer resourceId) thr @PostMapping("/property/set") @Secured("ROLE_ADMIN") @Transactional + @Operation(description = "Create a property set with all new information - must not be an existing set", + summary = "Create a property set with all new information - must not be an existing set", method = "POST") public ResponseEntity createPropertySet(@RequestBody ShibPropertySet newSet) throws ObjectIdExistsException { ShibPropertySet result = service.create(newSet); return ResponseEntity.status(HttpStatus.CREATED).body(result); @@ -72,6 +76,8 @@ public ResponseEntity createPropertySet(@RequestBody ShibPropertySet newSet) @PutMapping("/property/set/{resourceId}") @Secured("ROLE_ADMIN") @Transactional + @Operation(description = "Update a property set with with the matching resourceId - must exist", + summary = "Update an existing property set with the matching resourceId - must exist", method = "PUT") public ResponseEntity updatePropertySet(@RequestBody ShibPropertySet setToUpdate, @PathVariable int resourceId) throws EntityNotFoundException { ShibPropertySet result = service.update(setToUpdate); return ResponseEntity.status(HttpStatus.OK).body(result);