@Test public void test_getFolders() throws Exception { String responseJson = "{ \"keys\": [ \"mysafe01\" ]}"; ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body(responseJson); when(safesService.getFolders("5PDrOhsy4ig8L3EpsJZSLAMg", "users/safe1")).thenReturn(responseEntityExpected); mockMvc.perform(MockMvcRequestBuilders.get("/v2/sdb/folder?path=users/safe1") .header("vault-token", "5PDrOhsy4ig8L3EpsJZSLAMg") .header("Content-Type", "application/json;charset=UTF-8")) .andExpect(status().isOk()) .andExpect(content().string(containsString(responseJson))); }
@ApiOperation(value = "${SafesController.getFolders.value}", notes = "${SafesController.getFolders.notes}") @GetMapping(value="/v2/sdb/folder",produces="application/json") public ResponseEntity<String> getFolders(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path){ return safesService.getFolders(token, path); }
SDBControllerV2 { @ApiOperation(value = "${SafesController.getFolders.value}", notes = "${SafesController.getFolders.notes}") @GetMapping(value="/v2/sdb/folder",produces="application/json") public ResponseEntity<String> getFolders(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path){ return safesService.getFolders(token, path); } }
SDBControllerV2 { @ApiOperation(value = "${SafesController.getFolders.value}", notes = "${SafesController.getFolders.notes}") @GetMapping(value="/v2/sdb/folder",produces="application/json") public ResponseEntity<String> getFolders(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path){ return safesService.getFolders(token, path); }  }
SDBControllerV2 { @ApiOperation(value = "${SafesController.getFolders.value}", notes = "${SafesController.getFolders.notes}") @GetMapping(value="/v2/sdb/folder",produces="application/json") public ResponseEntity<String> getFolders(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path){ return safesService.getFolders(token, path); }  @ApiOperation(value = "${SafesController.getFolders.value}", notes = "${SafesController.getFolders.notes}") @GetMapping(value="/v2/sdb/folder",produces="application/json") ResponseEntity<String> getFolders(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @ApiOperation(value = "${SafesController.getInfo.value}", notes = "${SafesController.getInfo.notes}") @GetMapping(value="/v2/sdb/folder/{path}",produces="application/json") ResponseEntity<String> getInfo(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @PostMapping(value="/v2/sdb/folder",produces="application/json") ResponseEntity<String> createfolder(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @DeleteMapping(value="/v2/sdb/delete",produces="application/json") ResponseEntity<String> deleteFolder(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @ApiOperation(value = "${SafesController.updateSafe.value}", notes = "${SafesController.updateSafe.notes}") @PutMapping(value="/v2/sdb",consumes="application/json",produces="application/json") ResponseEntity<String> updateSafe(@RequestHeader(value="vault-token" ) String token, @RequestBody Safe safe); @ApiOperation(value = "${SafesController.createSafe.value}", notes = "${SafesController.createSafe.notes}") @PostMapping(value="/v2/sdb", consumes="application/json",produces="application/json") ResponseEntity<String> createSafe(@RequestHeader(value="vault-token" ) String token, @RequestBody Safe safe); @ApiOperation(value = "${SafesController.deleteSafe.value}", notes = "${SafesController.deleteSafe.notes}") @DeleteMapping(value="/v2/sdb",produces="application/json") ResponseEntity<String> deleteSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody Safe safe); @ApiOperation(value = "${SafesController.getSafe.value}", notes = "${SafesController.getSafe.notes}") @GetMapping(value="/v2/sdb",produces="application/json") ResponseEntity<String> getSafe(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @ApiOperation(value = "${SafesController.addUserToSafe.value}", notes = "${SafesController.addUserToSafe.notes}") @PostMapping(value="/v2/sdb/user",consumes="application/json",produces="application/json") ResponseEntity<String> addUsertoSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeUser safeUser); @ApiOperation(value = "${SafesController.removeUserFromSafe.value}", notes = "${SafesController.removeUserFromSafe.notes}") @DeleteMapping(value="/v2/sdb/user",consumes="application/json",produces="application/json") ResponseEntity<String> deleteUserFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeUser safeUser); @ApiOperation(value = "${SafesController.addGroupToSafe.value}", notes = "${SafesController.addGroupToSafe.notes}") @PostMapping(value="/v2/sdb/group",consumes="application/json",produces="application/json") ResponseEntity<String> addGrouptoSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeGroup safeGroup); @ApiOperation(value = "${SafesController.deleteGroupFromSafe.value}", notes = "${SafesController.deleteGroupFromSafe.notes}") @DeleteMapping (value="/v2/sdb/group",consumes="application/json",produces="application/json") ResponseEntity<String> deleteGroupFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeGroup safeGroup); @ApiOperation(value = "${SafesController.addAWSRoleToSafe.value}", notes = "${SafesController.addAWSRoleToSafe.notes}") @PostMapping (value="/v2/sdb/role",consumes="application/json",produces="application/json") ResponseEntity<String> addAwsRoleToSafe(@RequestHeader(value="vault-token") String token, @RequestBody AWSRole awsRole); @ApiOperation(value = "${SafesController.deleteAWSRoleFromSafe.value}", notes = "${SafesController.deleteAWSRoleFromSafe.notes}") @DeleteMapping (value="/v2/sdb/role",consumes="application/json",produces="application/json") ResponseEntity<String> deleteAwsRoleFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody AWSRole awsRole); @ApiOperation(value = "${SafesController.deleteAWSPermissionFromSafe.value}", notes = "${SafesController.deleteAWSPermissionFromSafe.notes}") @PutMapping (value="/v2/sdb/role",consumes="application/json",produces="application/json") ResponseEntity<String> detachAwsRoleFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody AWSRole awsRole); @GetMapping(value="/v2/sdb/list",produces="application/json") ResponseEntity<String> getFoldersRecursively(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @PostMapping(value="/v2/sdb/createfolder",produces="application/json") ResponseEntity<String> createNestedfolder(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @PostMapping(value="/v2/sdb/approle",consumes="application/json",produces="application/json") ResponseEntity<String> associateApproletoSDB(@RequestHeader(value="vault-token") String token, @RequestBody SafeAppRoleAccess safeAppRoleAccess); }
SDBControllerV2 { @ApiOperation(value = "${SafesController.getFolders.value}", notes = "${SafesController.getFolders.notes}") @GetMapping(value="/v2/sdb/folder",produces="application/json") public ResponseEntity<String> getFolders(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path){ return safesService.getFolders(token, path); }  @ApiOperation(value = "${SafesController.getFolders.value}", notes = "${SafesController.getFolders.notes}") @GetMapping(value="/v2/sdb/folder",produces="application/json") ResponseEntity<String> getFolders(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @ApiOperation(value = "${SafesController.getInfo.value}", notes = "${SafesController.getInfo.notes}") @GetMapping(value="/v2/sdb/folder/{path}",produces="application/json") ResponseEntity<String> getInfo(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @PostMapping(value="/v2/sdb/folder",produces="application/json") ResponseEntity<String> createfolder(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @DeleteMapping(value="/v2/sdb/delete",produces="application/json") ResponseEntity<String> deleteFolder(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @ApiOperation(value = "${SafesController.updateSafe.value}", notes = "${SafesController.updateSafe.notes}") @PutMapping(value="/v2/sdb",consumes="application/json",produces="application/json") ResponseEntity<String> updateSafe(@RequestHeader(value="vault-token" ) String token, @RequestBody Safe safe); @ApiOperation(value = "${SafesController.createSafe.value}", notes = "${SafesController.createSafe.notes}") @PostMapping(value="/v2/sdb", consumes="application/json",produces="application/json") ResponseEntity<String> createSafe(@RequestHeader(value="vault-token" ) String token, @RequestBody Safe safe); @ApiOperation(value = "${SafesController.deleteSafe.value}", notes = "${SafesController.deleteSafe.notes}") @DeleteMapping(value="/v2/sdb",produces="application/json") ResponseEntity<String> deleteSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody Safe safe); @ApiOperation(value = "${SafesController.getSafe.value}", notes = "${SafesController.getSafe.notes}") @GetMapping(value="/v2/sdb",produces="application/json") ResponseEntity<String> getSafe(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @ApiOperation(value = "${SafesController.addUserToSafe.value}", notes = "${SafesController.addUserToSafe.notes}") @PostMapping(value="/v2/sdb/user",consumes="application/json",produces="application/json") ResponseEntity<String> addUsertoSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeUser safeUser); @ApiOperation(value = "${SafesController.removeUserFromSafe.value}", notes = "${SafesController.removeUserFromSafe.notes}") @DeleteMapping(value="/v2/sdb/user",consumes="application/json",produces="application/json") ResponseEntity<String> deleteUserFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeUser safeUser); @ApiOperation(value = "${SafesController.addGroupToSafe.value}", notes = "${SafesController.addGroupToSafe.notes}") @PostMapping(value="/v2/sdb/group",consumes="application/json",produces="application/json") ResponseEntity<String> addGrouptoSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeGroup safeGroup); @ApiOperation(value = "${SafesController.deleteGroupFromSafe.value}", notes = "${SafesController.deleteGroupFromSafe.notes}") @DeleteMapping (value="/v2/sdb/group",consumes="application/json",produces="application/json") ResponseEntity<String> deleteGroupFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody SafeGroup safeGroup); @ApiOperation(value = "${SafesController.addAWSRoleToSafe.value}", notes = "${SafesController.addAWSRoleToSafe.notes}") @PostMapping (value="/v2/sdb/role",consumes="application/json",produces="application/json") ResponseEntity<String> addAwsRoleToSafe(@RequestHeader(value="vault-token") String token, @RequestBody AWSRole awsRole); @ApiOperation(value = "${SafesController.deleteAWSRoleFromSafe.value}", notes = "${SafesController.deleteAWSRoleFromSafe.notes}") @DeleteMapping (value="/v2/sdb/role",consumes="application/json",produces="application/json") ResponseEntity<String> deleteAwsRoleFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody AWSRole awsRole); @ApiOperation(value = "${SafesController.deleteAWSPermissionFromSafe.value}", notes = "${SafesController.deleteAWSPermissionFromSafe.notes}") @PutMapping (value="/v2/sdb/role",consumes="application/json",produces="application/json") ResponseEntity<String> detachAwsRoleFromSafe(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody AWSRole awsRole); @GetMapping(value="/v2/sdb/list",produces="application/json") ResponseEntity<String> getFoldersRecursively(@RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @PostMapping(value="/v2/sdb/createfolder",produces="application/json") ResponseEntity<String> createNestedfolder(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestParam("path") String path); @PostMapping(value="/v2/sdb/approle",consumes="application/json",produces="application/json") ResponseEntity<String> associateApproletoSDB(@RequestHeader(value="vault-token") String token, @RequestBody SafeAppRoleAccess safeAppRoleAccess);  }