示例#1
0
 @ApiOperation(
     value = StackOpDescription.POST_PUBLIC,
     produces = ContentType.JSON,
     notes = Notes.STACK_NOTES)
 @RequestMapping(value = "account/stacks", method = RequestMethod.POST)
 @ResponseBody
 public ResponseEntity<IdJson> createAccountStack(
     @ModelAttribute("user") CbUser user, @RequestBody @Valid StackRequest stackRequest) {
   MDCBuilder.buildUserMdcContext(user);
   return createStack(user, stackRequest, true);
 }
示例#2
0
 @ApiOperation(
     value = StackOpDescription.GET_PRIVATE,
     produces = ContentType.JSON,
     notes = Notes.STACK_NOTES)
 @RequestMapping(value = "user/stacks", method = RequestMethod.GET)
 @ResponseBody
 public ResponseEntity<Set<StackResponse>> getPrivateStacks(@ModelAttribute("user") CbUser user) {
   MDCBuilder.buildUserMdcContext(user);
   Set<Stack> stacks = stackService.retrievePrivateStacks(user);
   return new ResponseEntity<>(convertStacks(stacks), HttpStatus.OK);
 }
示例#3
0
 @ApiOperation(
     value = StackOpDescription.GET_STATUS_BY_ID,
     produces = ContentType.JSON,
     notes = Notes.STACK_NOTES)
 @RequestMapping(value = "stacks/{id}/status", method = RequestMethod.GET)
 @ResponseBody
 public ResponseEntity<Map<String, Object>> getStackStatus(
     @ModelAttribute("user") CbUser user, @PathVariable Long id) {
   MDCBuilder.buildUserMdcContext(user);
   Map<String, Object> statusMap = conversionService.convert(stackService.get(id), Map.class);
   return new ResponseEntity<>(statusMap, HttpStatus.OK);
 }
示例#4
0
 @ApiOperation(
     value = StackOpDescription.GET_PUBLIC_BY_NAME,
     produces = ContentType.JSON,
     notes = Notes.STACK_NOTES)
 @RequestMapping(value = "account/stacks/{name}", method = RequestMethod.GET)
 @ResponseBody
 public ResponseEntity<StackResponse> getStackInPublic(
     @ModelAttribute("user") CbUser user, @PathVariable String name) {
   MDCBuilder.buildUserMdcContext(user);
   Stack stack = stackService.getPublicStack(name, user);
   StackResponse stackJson = conversionService.convert(stack, StackResponse.class);
   return new ResponseEntity<>(stackJson, HttpStatus.OK);
 }
 @ApiOperation(
     value = EventOpDescription.GET_BY_TIMESTAMP,
     produces = ContentType.JSON,
     notes = Notes.EVENT_NOTES)
 @RequestMapping(method = RequestMethod.GET, value = "/events")
 @ResponseBody
 public ResponseEntity<List<CloudbreakEventsJson>> events(
     @ModelAttribute("user") CbUser user,
     @RequestParam(value = "since", required = false) Long since) {
   MDCBuilder.buildUserMdcContext(user);
   List<CloudbreakEventsJson> cloudbreakEvents =
       cloudbreakEventsFacade.retrieveEvents(user.getUserId(), since);
   return new ResponseEntity<>(cloudbreakEvents, HttpStatus.OK);
 }
示例#6
0
 @ApiOperation(
     value = StackOpDescription.VALIDATE,
     produces = ContentType.JSON,
     notes = Notes.STACK_NOTES)
 @RequestMapping(value = "stacks/validate", method = RequestMethod.POST)
 @ResponseBody
 public ResponseEntity<IdJson> validateStack(
     @ModelAttribute("user") CbUser user,
     @RequestBody @Valid StackValidationRequest stackValidationRequest) {
   MDCBuilder.buildUserMdcContext(user);
   StackValidation stackValidation =
       conversionService.convert(stackValidationRequest, StackValidation.class);
   stackService.validateStack(stackValidation);
   return new ResponseEntity<>(HttpStatus.OK);
 }
示例#7
0
 @ApiOperation(
     value = StackOpDescription.DELETE_PUBLIC_BY_NAME,
     produces = ContentType.JSON,
     notes = Notes.STACK_NOTES)
 @RequestMapping(value = "account/stacks/{name}", method = RequestMethod.DELETE)
 @ResponseBody
 public ResponseEntity<TemplateResponse> deletePublicStack(
     @ModelAttribute("user") CbUser user,
     @PathVariable String name,
     @RequestParam(value = "forced", required = false, defaultValue = "false") Boolean forced) {
   MDCBuilder.buildUserMdcContext(user);
   if (forced) {
     stackService.forceDelete(name, user);
   } else {
     stackService.delete(name, user);
   }
   return new ResponseEntity<>(HttpStatus.NO_CONTENT);
 }
示例#8
0
 @ApiOperation(
     value = StackOpDescription.PUT_BY_ID,
     produces = ContentType.JSON,
     notes = Notes.STACK_NOTES)
 @RequestMapping(value = "stacks/{id}", method = RequestMethod.PUT)
 @ResponseBody
 public ResponseEntity<String> updateStack(
     @ModelAttribute("user") CbUser user,
     @PathVariable Long id,
     @Valid @RequestBody UpdateStackJson updateRequest) {
   MDCBuilder.buildUserMdcContext(user);
   if (updateRequest.getStatus() != null) {
     stackService.updateStatus(id, updateRequest.getStatus());
     return new ResponseEntity<>(HttpStatus.NO_CONTENT);
   } else {
     Integer scalingAdjustment = updateRequest.getInstanceGroupAdjustment().getScalingAdjustment();
     validateAccountPreferences(id, scalingAdjustment);
     stackService.updateNodeCount(id, updateRequest.getInstanceGroupAdjustment());
     return new ResponseEntity<>(HttpStatus.NO_CONTENT);
   }
 }