@Test public void test_fetchIAMRole() throws Exception { String responseMessage = "{\"bound_ami_id\": [\"ami-fce3c696\"],\"role_tag\": \"\",\"policies\": " + "[\"\\\"[prod\", \"dev\\\"]\" ],\"bound_iam_principal_arn\": [],\"bound_iam_role_arn\":" + "[ \"arn:aws:iam::8987887:role/test-role\"],\"max_ttl\": 0,\"disallow_reauthentication\": " + "false,\"allow_instance_migration\": false}"; ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body(responseMessage); when(awsiamAuthService.fetchIAMRole(eq("5PDrOhsy4ig8L3EpsJZSLAMg"), Mockito.any())).thenReturn(responseEntityExpected); mockMvc.perform(MockMvcRequestBuilders.get("/v2/auth/aws/iam/role/role1") .header("vault-token", "5PDrOhsy4ig8L3EpsJZSLAMg") .header("Content-Type", "application/json;charset=UTF-8")) .andExpect(status().isOk()) .andExpect(content().string(containsString(responseMessage))); }
@ApiOperation(value = "${AWSIAMAuthControllerV2.fetchRole.value}", notes = "${AWSIAMAuthControllerV2.fetchRole.notes}") @GetMapping(value="/v2/auth/aws/iam/role/{role}",produces="application/json") public ResponseEntity<String> fetchIAMRole(@RequestHeader(value="vault-token") String token, @PathVariable("role") String role){ return awsIamAuthService.fetchIAMRole(token, role); }
AWSIAMAuthControllerV2 { @ApiOperation(value = "${AWSIAMAuthControllerV2.fetchRole.value}", notes = "${AWSIAMAuthControllerV2.fetchRole.notes}") @GetMapping(value="/v2/auth/aws/iam/role/{role}",produces="application/json") public ResponseEntity<String> fetchIAMRole(@RequestHeader(value="vault-token") String token, @PathVariable("role") String role){ return awsIamAuthService.fetchIAMRole(token, role); } }
AWSIAMAuthControllerV2 { @ApiOperation(value = "${AWSIAMAuthControllerV2.fetchRole.value}", notes = "${AWSIAMAuthControllerV2.fetchRole.notes}") @GetMapping(value="/v2/auth/aws/iam/role/{role}",produces="application/json") public ResponseEntity<String> fetchIAMRole(@RequestHeader(value="vault-token") String token, @PathVariable("role") String role){ return awsIamAuthService.fetchIAMRole(token, role); }  }
AWSIAMAuthControllerV2 { @ApiOperation(value = "${AWSIAMAuthControllerV2.fetchRole.value}", notes = "${AWSIAMAuthControllerV2.fetchRole.notes}") @GetMapping(value="/v2/auth/aws/iam/role/{role}",produces="application/json") public ResponseEntity<String> fetchIAMRole(@RequestHeader(value="vault-token") String token, @PathVariable("role") String role){ return awsIamAuthService.fetchIAMRole(token, role); }  @ApiOperation(value = "${AWSIAMAuthControllerV2.createIamRole.value}", notes = "${AWSIAMAuthControllerV2.createIamRole.notes}") @PostMapping(value="/v2/auth/aws/iam/role",produces="application/json") ResponseEntity<String> createIAMRole(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody AWSIAMRole awsiamRole); @ApiOperation(value = "${AWSIAMAuthControllerV2.updateRole.value}", notes = "${AWSIAMAuthControllerV2.updateRole.notes}") @PutMapping(value="/v2/auth/aws/iam/role",consumes="application/json",produces="application/json") ResponseEntity<String> updateRole(@RequestHeader(value="vault-token") String token, @RequestBody AWSIAMRole awsiamRole); @ApiOperation(value = "${AWSIAMAuthControllerV2.fetchRole.value}", notes = "${AWSIAMAuthControllerV2.fetchRole.notes}") @GetMapping(value="/v2/auth/aws/iam/role/{role}",produces="application/json") ResponseEntity<String> fetchIAMRole(@RequestHeader(value="vault-token") String token, @PathVariable("role") String role); @ApiOperation(value = "${AWSIAMAuthControllerV2.listRoles.value}", notes = "${AWSIAMAuthControllerV2.listRoles.notes}") @GetMapping(value="/v2/auth/aws/iam/roles",produces="application/json") ResponseEntity<String> listIAMRoles(@RequestHeader(value="vault-token") String token); @ApiOperation(value = "${AWSIAMAuthControllerV2.deleteRole.value}", notes = "${AWSIAMAuthControllerV2.deleteRole.notes}") @DeleteMapping(value="/v2/auth/aws/iam/roles/{role}",produces="application/json") ResponseEntity<String> deleteIAMRole(@RequestHeader(value="vault-token") String token, @PathVariable("role" ) String role); }
AWSIAMAuthControllerV2 { @ApiOperation(value = "${AWSIAMAuthControllerV2.fetchRole.value}", notes = "${AWSIAMAuthControllerV2.fetchRole.notes}") @GetMapping(value="/v2/auth/aws/iam/role/{role}",produces="application/json") public ResponseEntity<String> fetchIAMRole(@RequestHeader(value="vault-token") String token, @PathVariable("role") String role){ return awsIamAuthService.fetchIAMRole(token, role); }  @ApiOperation(value = "${AWSIAMAuthControllerV2.createIamRole.value}", notes = "${AWSIAMAuthControllerV2.createIamRole.notes}") @PostMapping(value="/v2/auth/aws/iam/role",produces="application/json") ResponseEntity<String> createIAMRole(HttpServletRequest request, @RequestHeader(value="vault-token") String token, @RequestBody AWSIAMRole awsiamRole); @ApiOperation(value = "${AWSIAMAuthControllerV2.updateRole.value}", notes = "${AWSIAMAuthControllerV2.updateRole.notes}") @PutMapping(value="/v2/auth/aws/iam/role",consumes="application/json",produces="application/json") ResponseEntity<String> updateRole(@RequestHeader(value="vault-token") String token, @RequestBody AWSIAMRole awsiamRole); @ApiOperation(value = "${AWSIAMAuthControllerV2.fetchRole.value}", notes = "${AWSIAMAuthControllerV2.fetchRole.notes}") @GetMapping(value="/v2/auth/aws/iam/role/{role}",produces="application/json") ResponseEntity<String> fetchIAMRole(@RequestHeader(value="vault-token") String token, @PathVariable("role") String role); @ApiOperation(value = "${AWSIAMAuthControllerV2.listRoles.value}", notes = "${AWSIAMAuthControllerV2.listRoles.notes}") @GetMapping(value="/v2/auth/aws/iam/roles",produces="application/json") ResponseEntity<String> listIAMRoles(@RequestHeader(value="vault-token") String token); @ApiOperation(value = "${AWSIAMAuthControllerV2.deleteRole.value}", notes = "${AWSIAMAuthControllerV2.deleteRole.notes}") @DeleteMapping(value="/v2/auth/aws/iam/roles/{role}",produces="application/json") ResponseEntity<String> deleteIAMRole(@RequestHeader(value="vault-token") String token, @PathVariable("role" ) String role);  }