diff --git a/src/main/java/kr/co/mcmp/ape/cbtumblebug/controller/CbtumblebugController.java b/src/main/java/kr/co/mcmp/ape/cbtumblebug/controller/CbtumblebugController.java index 2159e7e..95b66c2 100644 --- a/src/main/java/kr/co/mcmp/ape/cbtumblebug/controller/CbtumblebugController.java +++ b/src/main/java/kr/co/mcmp/ape/cbtumblebug/controller/CbtumblebugController.java @@ -2,6 +2,7 @@ import java.util.List; +import kr.co.mcmp.response.ResponseWrapper; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -29,38 +30,38 @@ public class CbtumblebugController { @GetMapping("/ns") @Operation(summary = "Retrieve all namespaces", description = "Fetches all registered namespaces.") - public List getAllNamespaces() { - return cbtumblebugService.getAllNamespaces(); + public ResponseWrapper> getAllNamespaces() { + return new ResponseWrapper<>(cbtumblebugService.getAllNamespaces()) ; } @GetMapping("/ns/{nsId}/mci") @Operation(summary = "Retrieve MCIS for a specific namespace", description = "Fetches all MCIS belonging to the specified namespace.") - public List getMicsByNamespace(@Parameter(description = "Namespace ID", required = true) + public ResponseWrapper> getMicsByNamespace(@Parameter(description = "Namespace ID", required = true) @PathVariable String nsId) { - return cbtumblebugService.getMcisByNamespace(nsId); + return new ResponseWrapper<>(cbtumblebugService.getMcisByNamespace(nsId)); } @GetMapping("/ns/{nsId}/mci/{mciId}") @Operation(summary = "Retrieve a specific MCI", description = "Fetches the specified MCI.") - public MciDto getMicByMciId(@PathVariable String nsId, @PathVariable String mciId) { - return cbtumblebugService.getMciByMciId(nsId, mciId); + public ResponseWrapper getMicByMciId(@PathVariable String nsId, @PathVariable String mciId) { + return new ResponseWrapper<>(cbtumblebugService.getMciByMciId(nsId, mciId)); } @GetMapping("/ns/{nsId}/k8scluster") @Operation(summary = "Retrieve k8sclusters for a specific namespace", description = "Fetches all k8sclusters belonging to the specified namespace.") - public List getK8sCluster(@PathVariable String nsId) { - return cbtumblebugService.getAllK8sClusters(nsId); + public ResponseWrapper> getK8sCluster(@PathVariable String nsId) { + return new ResponseWrapper<>(cbtumblebugService.getAllK8sClusters(nsId)); } @GetMapping("/ns/{nsId}/k8scluster/{clusterName}") @Operation(summary = "Retrieve a specific k8scluster", description = "Fetches the specified k8scluster.") - public K8sClusterDto getK8sClusterByName(@PathVariable String nsId, @PathVariable String clusterName) { - return cbtumblebugService.getK8sClusterByName(nsId, clusterName); + public ResponseWrapper getK8sClusterByName(@PathVariable String nsId, @PathVariable String clusterName) { + return new ResponseWrapper<>(cbtumblebugService.getK8sClusterByName(nsId, clusterName)); } @GetMapping("/ns/{nsId}/resources/spec/{specId}") - public Spec getMethodName(@PathVariable String nsId, @PathVariable String specId) { - return cbtumblebugService.getSpecBySpecId(nsId, specId); + public ResponseWrapper getMethodName(@PathVariable String nsId, @PathVariable String specId) { + return new ResponseWrapper<>(cbtumblebugService.getSpecBySpecId(nsId, specId)); } diff --git a/src/main/java/kr/co/mcmp/catalog/CatalogController.java b/src/main/java/kr/co/mcmp/catalog/CatalogController.java index b7b3d2c..65e3dc5 100644 --- a/src/main/java/kr/co/mcmp/catalog/CatalogController.java +++ b/src/main/java/kr/co/mcmp/catalog/CatalogController.java @@ -2,6 +2,7 @@ import java.util.List; +import kr.co.mcmp.response.ResponseWrapper; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; @@ -42,36 +43,36 @@ public class CatalogController { @ApiOperation(value="software catalog list(all)", notes="software catalog 리스트 불러오기") @Operation(summary = "get software catalog list") @GetMapping - public List getCatalogList(@RequestParam(required = false) String title){ + public ResponseWrapper> getCatalogList(@RequestParam(required = false) String title){ if(StringUtils.isEmpty(title)){ - return catalogService.getCatalogList(); + return new ResponseWrapper<>(catalogService.getCatalogList()); }else { - return catalogService.getCatalogListSearch(title); + return new ResponseWrapper<>(catalogService.getCatalogListSearch(title)); } } @Operation(summary = "software catalogd detail(and reference)") @ApiOperation(value="software catalog detail", notes="software catalog 내용 확인(연결된 정보들까지)") @GetMapping("/{catalogIdx}") - public CatalogDTO getCatalog(@PathVariable Integer catalogIdx){ - return catalogService.getCatalog(catalogIdx); + public ResponseWrapper getCatalog(@PathVariable Integer catalogIdx){ + return new ResponseWrapper<>(catalogService.getCatalog(catalogIdx)); } @Operation(summary = "create software catalog", description = "Insert a software catalog with an optional icon file.") @ApiOperation(value="software catalog insert", notes="software catalog 등록") @PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - public CatalogDTO createCatalog( + public ResponseWrapper createCatalog( @RequestPart(value = "catalogDto") CatalogDTO catalogDto, @RequestPart(value ="iconFile", required = false) MultipartFile iconFile) { - return catalogService.createCatalog(catalogDto, iconFile); + return new ResponseWrapper<>(catalogService.createCatalog(catalogDto, iconFile)); } @Operation(summary = "delete software catalog") @ApiOperation(value="software catalog delete", notes="software catalog 삭제") @DeleteMapping("/{catalogIdx}") - public boolean deleteCatalog(@PathVariable Integer catalogIdx){ - return catalogService.deleteCatalog(catalogIdx); + public ResponseWrapper deleteCatalog(@PathVariable Integer catalogIdx){ + return new ResponseWrapper(catalogService.deleteCatalog(catalogIdx)); } // @Operation(summary = "update software catalog") @@ -84,10 +85,10 @@ public boolean deleteCatalog(@PathVariable Integer catalogIdx){ @Operation(summary = "update software catalog") @ApiOperation(value="software catalog update", notes="software catalog 수정") @PutMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - public boolean updateCatalog( + public ResponseWrapper updateCatalog( @RequestPart("catalogDto") CatalogDTO catalogDto, @RequestPart(value = "iconFile", required = false) MultipartFile iconFile) { - return catalogService.updateCatalog(catalogDto, iconFile); + return new ResponseWrapper<>(catalogService.updateCatalog(catalogDto, iconFile)); } diff --git a/src/main/java/kr/co/mcmp/catalog/Ref/CatalogRefController.java b/src/main/java/kr/co/mcmp/catalog/Ref/CatalogRefController.java index 537020c..2810bf8 100644 --- a/src/main/java/kr/co/mcmp/catalog/Ref/CatalogRefController.java +++ b/src/main/java/kr/co/mcmp/catalog/Ref/CatalogRefController.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import kr.co.mcmp.response.ResponseWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -30,14 +31,14 @@ public class CatalogRefController { @Operation(summary = "execute catalog reference workflow") @PostMapping("/workflow") - public String execWorkflow(){ + public ResponseWrapper execWorkflow(){ return null; } @Operation(summary = "delete catalog reference workflow") @DeleteMapping("/{catalogIdx}/{catalogRefIdx}") - public boolean deleteCatalogRefWorkflow(@PathVariable Integer catalogIdx, @PathVariable Integer catalogRefIdx){ - return false; + public ResponseWrapper deleteCatalogRefWorkflow(@PathVariable Integer catalogIdx, @PathVariable Integer catalogRefIdx){ + return new ResponseWrapper<>(false); } @Operation(summary = "get catalog reference") diff --git a/src/main/java/kr/co/mcmp/catalog/application/controller/ApplicationController.java b/src/main/java/kr/co/mcmp/catalog/application/controller/ApplicationController.java index 17d0b73..11e7623 100644 --- a/src/main/java/kr/co/mcmp/catalog/application/controller/ApplicationController.java +++ b/src/main/java/kr/co/mcmp/catalog/application/controller/ApplicationController.java @@ -2,6 +2,7 @@ import java.util.List; +import kr.co.mcmp.response.ResponseWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -53,18 +54,18 @@ public ResponseEntity> getActiveK8sApplications( } @GetMapping("/vm/check/application") - public boolean canInstallApplicationForVM(@RequestParam String namespace, - @RequestParam String mciName, - @RequestParam String vmName, - @RequestParam Integer catalogId) { - return applicationService.canInstallApplicationOnVm(namespace, mciName, vmName, catalogId); + public ResponseWrapper canInstallApplicationForVM(@RequestParam String namespace, + @RequestParam String mciName, + @RequestParam String vmName, + @RequestParam Integer catalogId) { + return new ResponseWrapper<>(applicationService.canInstallApplicationOnVm(namespace, mciName, vmName, catalogId)); } @GetMapping("/k8s/check/application") - public boolean canInstallApplicationForK8s(@RequestParam String namespace, + public ResponseWrapper canInstallApplicationForK8s(@RequestParam String namespace, @RequestParam String clusterName, @RequestParam Integer catalogId) { - return applicationService.canInstallApplicationOnK8s(namespace, clusterName, catalogId); + return new ResponseWrapper<>(applicationService.canInstallApplicationOnK8s(namespace, clusterName, catalogId)); }