@RequestMapping(value="/cm/simple/cis/states", method = RequestMethod.PUT) @ResponseBody public String updateCiStateBulk( @RequestParam(value="ids", required = true) String ids, @RequestParam(value="newState", required = true) String newState, @RequestParam(value="relationName", required = false) String relName, @RequestParam(value="direction", required = false) String direction, @RequestParam(value="recursive", required = false) Boolean recursive, @RequestHeader(value="X-Cms-Scope", required = false) String scope, @RequestHeader(value="X-Cms-User", required = false) String userId) { String[] idsStr = ids.split(","); Long[] ciIds = new Long[idsStr.length]; for (int i=0; i<idsStr.length; i++) { ciIds[i] = Long.valueOf(idsStr[i]); } cmManager.updateCiStateBulk(ciIds, newState, relName, direction, recursive != null, userId); return "{\"updated\"}"; }
@RequestMapping(method=RequestMethod.PUT, value="/dj/simple/deployments/{dpmtId}") @ResponseBody public CmsDeployment updateDeployment( @RequestBody CmsDeployment dpmt, @PathVariable long dpmtId, @RequestHeader(value="X-Cms-Scope", required = false) String scope, @RequestHeader(value="X-Cms-User", required = false) String userId) { try { scopeVerifier.verifyScope(scope, dpmt); dpmt.setDeploymentId(dpmtId); dpmt.setUpdatedBy(userId); return djManager.updateDeployment(dpmt); } catch (CmsBaseException e) { logger.error("CmsBaseException in updateDeployment", e); e.printStackTrace(); throw e; } }
@RequestMapping(value="/dj/simple/cis/{ciId}", method = RequestMethod.GET) @ResponseBody @ReadOnlyDataAccess public CmsRfcCISimple getRfcById(@PathVariable long ciId, @RequestParam(value="releaseId", required = false) Long releaseId, @RequestParam(value="attrProps", required = false) String attrProps, @RequestHeader(value="X-Cms-Scope", required = false) String scope){ CmsRfcCI rfc = cmdjManager.getCiById(ciId, "df"); if (rfc == null) throw new DJException(CmsError.DJ_NO_CI_WITH_GIVEN_ID_ERROR, "There is no rfc or ci with this id: " + ciId); scopeVerifier.verifyScope(scope, rfc); return cmsUtil.custRfcCI2RfcCISimple(rfc, attrProps); }
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json;charset=utf-8") public ResponseEntity<?> post(@RequestHeader(value="Authorization") String authorization, @RequestBody Envelope envelope) throws OrgNotFoundException { Org org = orgService.findByApiKey(authorization); if (envelope != null) { List<Event> events = envelope.getData(); List<String> ids = null; if (events != null && !events.isEmpty()) { ids = new ArrayList<>(); for (Event event : events) { try { String savedId = this.eventService.save(org.getMetadata().get(Vocabulary.TENANT), org.getSourcedId(), event); ids.add(savedId); } catch (Exception e) { logger.error("Unable to save event {}",event); continue; } } } return new ResponseEntity<>(ids, null, HttpStatus.OK); } return new ResponseEntity<>(HttpStatus.BAD_REQUEST); }
@RequestMapping(value = "/customcommand", method = RequestMethod.POST) public ResponseEntity<CustomResponse> executeCustomCommand(@RequestParam("command") String command, @RequestHeader(value = "JHeapSessionId") String JHeapSessionId) { if (command == null || command.isEmpty()) { return new ResponseEntity<CustomResponse>(HttpStatus.BAD_REQUEST); } CustomResponse analysis = analysisService.executeCustomCommand(command); return new ResponseEntity<CustomResponse>(analysis, HttpStatus.OK); }
@RequestMapping(method = RequestMethod.PUT, value = "/cm/simple/ci/{ciId}/altNs") @ResponseBody public void tagRfc(@PathVariable long ciId, @RequestParam(value = "tag", required = false) String tag, @RequestParam(value = "altNsPath", required = false) String altNsPath, @RequestParam(value = "altNsId", required = false) Long altNsId, @RequestHeader(value = "X-Cms-User", required = false) String userId, @RequestHeader(value = "X-Cms-Scope", required = false) String scope) throws DJException { CmsCI ci = cmManager.getCiById(ciId); scopeVerifier.verifyScope(scope, ci); CmsAltNs cmsAltNs = new CmsAltNs(); cmsAltNs.setNsPath(altNsPath); if (altNsId != null) { cmsAltNs.setNsId(altNsId); } cmsAltNs.setTag(tag); cmManager.createAltNs(cmsAltNs, ci); }
@RequestMapping(value = "/login" , method=RequestMethod.GET) @Menu(type = "apps" , subtype = "user" , access = true) public ModelAndView login(HttpServletRequest request, HttpServletResponse response , @RequestHeader(value = "referer", required = false) String referer , @Valid String msg) { ModelAndView view = request(super.createRequestPageTempletResponse("redirect:/")); if(request.getSession(true).getAttribute(UKDataContext.USER_SESSION_NAME) ==null){ view = request(super.createRequestPageTempletResponse("/login")); if(!StringUtils.isBlank(request.getParameter("referer"))){ referer = request.getParameter("referer") ; } if(!StringUtils.isBlank(referer)){ view.addObject("referer", referer) ; } } if(!StringUtils.isBlank(msg)){ view.addObject("msg", msg) ; } return view; }
@RequestMapping(method=RequestMethod.POST, value="/cm/simple/relations") @ResponseBody public CmsCIRelationSimple createCIRelation( @RequestParam(value="value", required = false) String valueType, @RequestBody CmsCIRelationSimple relSimple, @RequestHeader(value="X-Cms-Scope", required = false) String scope, @RequestHeader(value="X-Cms-User", required = false) String userId) throws CIValidationException { scopeVerifier.verifyScope(scope, relSimple); CmsCIRelation rel = cmsUtil.custCIRelationSimple2CIRelation(relSimple, valueType); rel.setCreatedBy(userId); try { CmsCIRelation newRel = cmManager.createRelation(rel); return cmsUtil.custCIRelation2CIRelationSimple(newRel, valueType,false); } catch (DataIntegrityViolationException dive) { if (dive instanceof DuplicateKeyException) { throw new CIValidationException(CmsError.CMS_DUPCI_NAME_ERROR, dive.getMessage()); } else { throw new CmsException(CmsError.CMS_EXCEPTION, dive.getMessage()); } } }
public ResponseEntity<List<OverviewNote>> apiV1NotesGet( @ApiParam(value = "Unique Identifier of the User requesting his notes.", required = true) @RequestHeader(value = "userId", required = true) Long userId, @ApiParam(value = "Page of notes that's beeing returned.", defaultValue = "0") @RequestParam(value = "page", required = false, defaultValue = "0") Integer page, @ApiParam(value = "Amount of notes per page.", defaultValue = "10") @RequestParam(value = "items", required = false, defaultValue = "5") Integer items, @ApiParam(value = "If true, only archived notes are returned.", defaultValue = "false") @RequestParam(value = "showArchived", required = false, defaultValue = "false") Boolean showArchived) throws DtoValidationFailedException { assertPagination(page, items); List<OverviewNote> notes = new ArrayList<>(); if (showArchived) { notes = service.findArchivedNotesByUserIdPaginated(userId, new PageRequest(page, items)); } else { notes = service.findNotesByUserIdPaginated(userId, new PageRequest(page, items)); } return new ResponseEntity<List<OverviewNote>>(notes,HttpStatus.OK); }
@RequestMapping(value="/cm/cis", method = RequestMethod.GET) @ResponseBody @ReadOnlyDataAccess public List<CmsCI> getCIBy3( @RequestParam("ns") String nsPath, @RequestParam("clazz") String clazzName, @RequestParam("ciname") String ciName, @RequestHeader(value="X-Cms-Scope", required = false) String scope){ List<CmsCI> ciList = cmManager.getCiBy3(nsPath,clazzName, ciName); if (scope != null) { for (CmsCI ci : ciList) { scopeVerifier.verifyScope(scope, ci); } } return ciList; }
@RequestMapping(value="/cm/simple/cis/{ciId}", method = RequestMethod.GET) @ResponseBody @ReadOnlyDataAccess public CmsCISimple getCISimpleById(@PathVariable long ciId, @RequestParam(value="value", required = false) String valueType, @RequestParam(value="getEncrypted", required = false) String getEncrypted, @RequestParam(value="attrProps", required = false) String attrProps, @RequestParam(value="includeAltNs", required = false) String includeAltNs, @RequestHeader(value="X-Cms-Scope", required = false) String scope) { CmsCI ci = cmManager.getCiById(ciId); if (ci == null) throw new CmsException(CmsError.CMS_NO_CI_WITH_GIVEN_ID_ERROR, "There is no ci with this id"); scopeVerifier.verifyScope(scope, ci); return cmsUtil.custCI2CISimple(ci, valueType, attrProps, getEncrypted != null, includeAltNs); }
@RequestMapping(path = "/eapi/sendgrid/v3/mail/send") public ResponseEntity mailSend( @RequestBody MailSendForm form, @RequestHeader(required = false) String authorization ) { if (!checkAuthentication(authorization)) { return new ResponseEntity<>("", HttpStatus.UNAUTHORIZED); } String inbox = sendGridTokenVerifier.extractInbox(authorization.substring(7)); sendGridEmailFactory.getEmailsFromRequest(form, inbox) .forEach((unsaved) -> { EmailRecord saved = emailRepository.save(unsaved); try { emailWebSocketHandler.broadcastNewEmailMessage(saved); } catch (IOException e) { e.printStackTrace(); } }); return new ResponseEntity<>("", HttpStatus.ACCEPTED); }
@ApiOperation(value = "", notes = "Retrieve pipeline details for an organization", response = Pipeline.class, authorizations = { @Authorization(value = "jenkins_auth") }, tags={ "blueOcean", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully retrieved pipeline details", response = Pipeline.class), @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class), @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class), @ApiResponse(code = 404, message = "Pipeline cannot be found on Jenkins instance", response = Void.class) }) @RequestMapping(value = "/blue/rest/organizations/{organization}/pipelines/{pipeline}", produces = { "application/json" }, method = RequestMethod.GET) ResponseEntity<Pipeline> getPipeline(@ApiParam(value = "Name of the organization",required=true ) @PathVariable("organization") String organization,@ApiParam(value = "Name of the pipeline",required=true ) @PathVariable("pipeline") String pipeline, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@RequestMapping(method=RequestMethod.PUT, value="/dj/simple/rfc/relations/{rfcId}") @ResponseBody public CmsRfcRelationSimple updateRfcRelation( @PathVariable long rfcId, @RequestBody CmsRfcRelationSimple relSimple, @RequestHeader(value="X-Cms-Scope", required = false) String scope, @RequestHeader(value="X-Cms-User", required = false) String userId) throws DJException { scopeVerifier.verifyScope(scope, relSimple); relSimple.setRfcId(rfcId); CmsRfcRelation rel = cmsUtil.custRfcRelSimple2RfcRel(relSimple); rel.setUpdatedBy(userId); return cmsUtil.custRfcRel2RfcRelSimple(djManager.updateRfcRelation(rel)); }
public ResponseEntity<FreeStyleBuild> getJobLastBuild(@ApiParam(value = "Name of the job",required=true ) @PathVariable("name") String name, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! if (accept != null && accept.contains("application/json")) { return new ResponseEntity<FreeStyleBuild>(objectMapper.readValue("{ \"queueId\" : 5, \"displayName\" : \"displayName\", \"keepLog\" : true, \"description\" : \"description\", \"fullDisplayName\" : \"fullDisplayName\", \"estimatedDuration\" : 5, \"url\" : \"url\", \"building\" : true, \"changeSet\" : { \"kind\" : \"kind\", \"_class\" : \"_class\" }, \"duration\" : 1, \"result\" : \"result\", \"number\" : 6, \"executor\" : \"executor\", \"builtOn\" : \"builtOn\", \"_class\" : \"_class\", \"id\" : \"id\", \"actions\" : [ { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" }, { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" } ], \"timestamp\" : 2}", FreeStyleBuild.class), HttpStatus.OK); } return new ResponseEntity<FreeStyleBuild>(HttpStatus.OK); }
@RequestMapping(method = RequestMethod.GET, value = "/dj/simple/rfc/{rfcId}/altNs") @ResponseBody public List<CmsAltNs> getCiTags(@PathVariable long rfcId, @RequestHeader(value = "X-Cms-Scope", required = false) String scope) throws DJException { CmsRfcCI baseCi = djManager.getRfcCIById(rfcId); scopeVerifier.verifyScope(scope, baseCi); return djManager.getAltNsBy(rfcId); }
@RequestMapping(value="/dj/simple/approvals", method = RequestMethod.PUT) @ResponseBody public List<CmsDpmtApproval> dpmtApprove( @RequestBody CmsDpmtApproval[] approvals, @RequestHeader(value="X-Cms-Scope", required = false) String scope, @RequestHeader(value="X-Cms-User", required = true) String userId){ List<CmsDpmtApproval> toApprove = new ArrayList<>(); for (CmsDpmtApproval approval : approvals) { approval.setUpdatedBy(userId); toApprove.add(approval); } return djManager.updateApprovalList(toApprove); }
@RequestMapping(method=RequestMethod.POST, value="/cm/simple/cis") @ResponseBody public CmsCISimple createCISimple( @RequestParam(value="value", required = false) String valueType, @RequestBody CmsCISimple ciSimple, @RequestHeader(value="X-Cms-Scope", required = false) String scope, @RequestHeader(value="X-Cms-User", required = false) String userId) throws CIValidationException { scopeVerifier.verifyScope(scope, ciSimple); CmsCI newCi = cmsUtil.custCISimple2CI(ciSimple, valueType); newCi.setCiId(0); newCi.setCiGoid(null); newCi.setCreatedBy(userId); try { CmsCI ci = cmManager.createCI(newCi); updateAltNs(ci.getCiId(), ciSimple); logger.debug(ci.getCiId()); CmsCISimple cmsCISimple = cmsUtil.custCI2CISimple(ci, valueType); cmsCISimple.setAltNs(ciSimple.getAltNs()); return cmsCISimple; } catch (DataIntegrityViolationException dive) { if (dive instanceof DuplicateKeyException) { throw new CIValidationException(CmsError.CMS_DUPCI_NAME_ERROR, dive.getMessage()); } else { throw new CmsException(CmsError.CMS_EXCEPTION, dive.getMessage()); } } }
public ResponseEntity<Void> deletePipelineQueueItem(@ApiParam(value = "Name of the organization",required=true ) @PathVariable("organization") String organization, @ApiParam(value = "Name of the pipeline",required=true ) @PathVariable("pipeline") String pipeline, @ApiParam(value = "Name of the queue item",required=true ) @PathVariable("queue") String queue, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity<Void>(HttpStatus.OK); }
@ApiOperation(value = "", notes = "Retrieve Jenkins details", response = Hudson.class, authorizations = { @Authorization(value = "jenkins_auth") }, tags={ "remoteAccess", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully retrieved Jenkins details", response = Hudson.class), @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class), @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) }) @RequestMapping(value = "/api/json", produces = { "application/json" }, method = RequestMethod.GET) ResponseEntity<Hudson> getJenkins( @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "", notes = "Retrieve pipeline details for an organization folder", response = PipelineImpl.class, authorizations = { @Authorization(value = "jenkins_auth") }, tags={ "blueOcean", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully retrieved pipeline details", response = PipelineImpl.class), @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class), @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) }) @RequestMapping(value = "/blue/rest/organizations/{organization}/pipelines/{folder}/pipelines/{pipeline}", produces = { "application/json" }, method = RequestMethod.GET) ResponseEntity<PipelineImpl> getPipelineFolderPipeline(@ApiParam(value = "Name of the organization",required=true ) @PathVariable("organization") String organization,@ApiParam(value = "Name of the pipeline",required=true ) @PathVariable("pipeline") String pipeline,@ApiParam(value = "Name of the folder",required=true ) @PathVariable("folder") String folder, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "", notes = "Delete a job", response = Void.class, authorizations = { @Authorization(value = "jenkins_auth") }, tags={ "remoteAccess", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully deleted the job", response = Void.class), @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class), @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class), @ApiResponse(code = 404, message = "Job cannot be found on Jenkins instance", response = Void.class) }) @RequestMapping(value = "/job/{name}/doDelete", method = RequestMethod.POST) ResponseEntity<Void> postJobDelete(@ApiParam(value = "Name of the job",required=true ) @PathVariable("name") String name,@ApiParam(value = "CSRF protection token" ) @RequestHeader(value="Jenkins-Crumb", required=false) String jenkinsCrumb, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
public ResponseEntity<Void> postJobConfig(@ApiParam(value = "Name of the job",required=true ) @PathVariable("name") String name, @ApiParam(value = "Job configuration in config.xml format" ,required=true ) @Valid @RequestBody String body, @ApiParam(value = "CSRF protection token" ) @RequestHeader(value="Jenkins-Crumb", required=false) String jenkinsCrumb, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity<Void>(HttpStatus.OK); }
@ApiOperation(value = "", notes = "Delete queue item from an organization pipeline queue", response = Void.class, authorizations = { @Authorization(value = "jenkins_auth") }, tags={ "blueOcean", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully deleted queue item", response = Void.class), @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class), @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) }) @RequestMapping(value = "/blue/rest/organizations/{organization}/pipelines/{pipeline}/queue/{queue}", produces = { "application/json" }, method = RequestMethod.DELETE) ResponseEntity<Void> deletePipelineQueueItem(@ApiParam(value = "Name of the organization",required=true ) @PathVariable("organization") String organization,@ApiParam(value = "Name of the pipeline",required=true ) @PathVariable("pipeline") String pipeline,@ApiParam(value = "Name of the queue item",required=true ) @PathVariable("queue") String queue, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
public ResponseEntity<PipelineStepImpl> getPipelineRunNodeStep(@ApiParam(value = "Name of the organization",required=true ) @PathVariable("organization") String organization, @ApiParam(value = "Name of the pipeline",required=true ) @PathVariable("pipeline") String pipeline, @ApiParam(value = "Name of the run",required=true ) @PathVariable("run") String run, @ApiParam(value = "Name of the node",required=true ) @PathVariable("node") String node, @ApiParam(value = "Name of the step",required=true ) @PathVariable("step") String step, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! if (accept != null && accept.contains("application/json")) { return new ResponseEntity<PipelineStepImpl>(objectMapper.readValue("{ \"result\" : \"result\", \"input\" : { \"submitter\" : \"submitter\", \"_links\" : { \"self\" : { \"_class\" : \"_class\", \"href\" : \"href\" }, \"_class\" : \"_class\" }, \"_class\" : \"_class\", \"id\" : \"id\", \"message\" : \"message\", \"ok\" : \"ok\", \"parameters\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"_class\" : \"_class\", \"type\" : \"type\", \"defaultParameterValue\" : { \"name\" : \"name\", \"_class\" : \"_class\", \"value\" : \"value\" } }, { \"name\" : \"name\", \"description\" : \"description\", \"_class\" : \"_class\", \"type\" : \"type\", \"defaultParameterValue\" : { \"name\" : \"name\", \"_class\" : \"_class\", \"value\" : \"value\" } } ] }, \"_links\" : { \"self\" : { \"_class\" : \"_class\", \"href\" : \"href\" }, \"_class\" : \"_class\", \"actions\" : { \"_class\" : \"_class\", \"href\" : \"href\" } }, \"durationInMillis\" : 0, \"displayName\" : \"displayName\", \"startTime\" : \"startTime\", \"_class\" : \"_class\", \"id\" : \"id\", \"state\" : \"state\"}", PipelineStepImpl.class), HttpStatus.OK); } return new ResponseEntity<PipelineStepImpl>(HttpStatus.OK); }
public ResponseEntity<FreeStyleProject> getJob(@ApiParam(value = "Name of the job",required=true ) @PathVariable("name") String name, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! if (accept != null && accept.contains("application/json")) { return new ResponseEntity<FreeStyleProject>(objectMapper.readValue("{ \"color\" : \"color\", \"displayName\" : \"displayName\", \"lastSuccessfulBuild\" : { \"queueId\" : 5, \"displayName\" : \"displayName\", \"keepLog\" : true, \"description\" : \"description\", \"fullDisplayName\" : \"fullDisplayName\", \"estimatedDuration\" : 5, \"url\" : \"url\", \"building\" : true, \"changeSet\" : { \"kind\" : \"kind\", \"_class\" : \"_class\" }, \"duration\" : 1, \"result\" : \"result\", \"number\" : 6, \"executor\" : \"executor\", \"builtOn\" : \"builtOn\", \"_class\" : \"_class\", \"id\" : \"id\", \"actions\" : [ { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" }, { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" } ], \"timestamp\" : 2 }, \"description\" : \"description\", \"fullDisplayName\" : \"fullDisplayName\", \"lastUnstableBuild\" : \"lastUnstableBuild\", \"queueItem\" : \"queueItem\", \"buildable\" : true, \"firstBuild\" : { \"queueId\" : 5, \"displayName\" : \"displayName\", \"keepLog\" : true, \"description\" : \"description\", \"fullDisplayName\" : \"fullDisplayName\", \"estimatedDuration\" : 5, \"url\" : \"url\", \"building\" : true, \"changeSet\" : { \"kind\" : \"kind\", \"_class\" : \"_class\" }, \"duration\" : 1, \"result\" : \"result\", \"number\" : 6, \"executor\" : \"executor\", \"builtOn\" : \"builtOn\", \"_class\" : \"_class\", \"id\" : \"id\", \"actions\" : [ { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" }, { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" } ], \"timestamp\" : 2 }, \"lastFailedBuild\" : \"lastFailedBuild\", \"lastBuild\" : { \"queueId\" : 5, \"displayName\" : \"displayName\", \"keepLog\" : true, \"description\" : \"description\", \"fullDisplayName\" : \"fullDisplayName\", \"estimatedDuration\" : 5, \"url\" : \"url\", \"building\" : true, \"changeSet\" : { \"kind\" : \"kind\", \"_class\" : \"_class\" }, \"duration\" : 1, \"result\" : \"result\", \"number\" : 6, \"executor\" : \"executor\", \"builtOn\" : \"builtOn\", \"_class\" : \"_class\", \"id\" : \"id\", \"actions\" : [ { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" }, { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" } ], \"timestamp\" : 2 }, \"nextBuildNumber\" : 9, \"builds\" : [ { \"queueId\" : 5, \"displayName\" : \"displayName\", \"keepLog\" : true, \"description\" : \"description\", \"fullDisplayName\" : \"fullDisplayName\", \"estimatedDuration\" : 5, \"url\" : \"url\", \"building\" : true, \"changeSet\" : { \"kind\" : \"kind\", \"_class\" : \"_class\" }, \"duration\" : 1, \"result\" : \"result\", \"number\" : 6, \"executor\" : \"executor\", \"builtOn\" : \"builtOn\", \"_class\" : \"_class\", \"id\" : \"id\", \"actions\" : [ { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" }, { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" } ], \"timestamp\" : 2 }, { \"queueId\" : 5, \"displayName\" : \"displayName\", \"keepLog\" : true, \"description\" : \"description\", \"fullDisplayName\" : \"fullDisplayName\", \"estimatedDuration\" : 5, \"url\" : \"url\", \"building\" : true, \"changeSet\" : { \"kind\" : \"kind\", \"_class\" : \"_class\" }, \"duration\" : 1, \"result\" : \"result\", \"number\" : 6, \"executor\" : \"executor\", \"builtOn\" : \"builtOn\", \"_class\" : \"_class\", \"id\" : \"id\", \"actions\" : [ { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" }, { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" } ], \"timestamp\" : 2 } ], \"scm\" : { \"_class\" : \"_class\" }, \"keepDependencies\" : true, \"displayNameOrNull\" : \"displayNameOrNull\", \"inQueue\" : true, \"lastCompletedBuild\" : { \"queueId\" : 5, \"displayName\" : \"displayName\", \"keepLog\" : true, \"description\" : \"description\", \"fullDisplayName\" : \"fullDisplayName\", \"estimatedDuration\" : 5, \"url\" : \"url\", \"building\" : true, \"changeSet\" : { \"kind\" : \"kind\", \"_class\" : \"_class\" }, \"duration\" : 1, \"result\" : \"result\", \"number\" : 6, \"executor\" : \"executor\", \"builtOn\" : \"builtOn\", \"_class\" : \"_class\", \"id\" : \"id\", \"actions\" : [ { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" }, { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" } ], \"timestamp\" : 2 }, \"fullName\" : \"fullName\", \"healthReport\" : [ { \"score\" : 7, \"description\" : \"description\", \"iconClassName\" : \"iconClassName\", \"iconUrl\" : \"iconUrl\", \"_class\" : \"_class\" }, { \"score\" : 7, \"description\" : \"description\", \"iconClassName\" : \"iconClassName\", \"iconUrl\" : \"iconUrl\", \"_class\" : \"_class\" } ], \"lastStableBuild\" : { \"queueId\" : 5, \"displayName\" : \"displayName\", \"keepLog\" : true, \"description\" : \"description\", \"fullDisplayName\" : \"fullDisplayName\", \"estimatedDuration\" : 5, \"url\" : \"url\", \"building\" : true, \"changeSet\" : { \"kind\" : \"kind\", \"_class\" : \"_class\" }, \"duration\" : 1, \"result\" : \"result\", \"number\" : 6, \"executor\" : \"executor\", \"builtOn\" : \"builtOn\", \"_class\" : \"_class\", \"id\" : \"id\", \"actions\" : [ { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" }, { \"causes\" : [ { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" }, { \"_class\" : \"_class\", \"shortDescription\" : \"shortDescription\", \"userName\" : \"userName\", \"userId\" : \"userId\" } ], \"_class\" : \"_class\" } ], \"timestamp\" : 2 }, \"lastUnsuccessfulBuild\" : \"lastUnsuccessfulBuild\", \"url\" : \"url\", \"concurrentBuild\" : true, \"name\" : \"name\", \"_class\" : \"_class\", \"actions\" : [ { \"_class\" : \"_class\" }, { \"_class\" : \"_class\" } ]}", FreeStyleProject.class), HttpStatus.OK); } return new ResponseEntity<FreeStyleProject>(HttpStatus.OK); }
public ResponseEntity<Void> postViewConfig(@ApiParam(value = "Name of the view",required=true ) @PathVariable("name") String name, @ApiParam(value = "View configuration in config.xml format" ,required=true ) @Valid @RequestBody String body, @ApiParam(value = "CSRF protection token" ) @RequestHeader(value="Jenkins-Crumb", required=false) String jenkinsCrumb, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity<Void>(HttpStatus.OK); }
/** * Copies an object encrypted to another bucket * * http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html * * @param destinationBucket name of the destination bucket * @param objectRef path to source object * @param encryption The Encryption Type * @param kmsKeyId The KMS encryption key id * @param response response object * @return {@link CopyObjectResult} * @throws IOException If an input or output exception occurs */ @RequestMapping( value = "/{destinationBucket:.+}/**", method = RequestMethod.PUT, headers = { COPY_SOURCE, SERVER_SIDE_ENCRYPTION }, produces = "application/x-www-form-urlencoded; charset=utf-8") @ResponseBody public CopyObjectResult copyObject(@PathVariable final String destinationBucket, @RequestHeader(value = COPY_SOURCE) final ObjectRef objectRef, @RequestHeader(value = SERVER_SIDE_ENCRYPTION) final String encryption, @RequestHeader( value = SERVER_SIDE_ENCRYPTION_AWS_KMS_KEYID, required = false) final String kmsKeyId, final HttpServletRequest request, final HttpServletResponse response) throws IOException { final String destinationFile = filenameFrom(destinationBucket, request); final CopyObjectResult copyObjectResult = fileStore.copyS3ObjectEncrypted(objectRef.getBucket(), objectRef.getKey(), destinationBucket, destinationFile, encryption, kmsKeyId); response.addHeader(SERVER_SIDE_ENCRYPTION_AWS_KMS_KEYID, kmsKeyId); if (copyObjectResult == null) { response.sendError(404, String.format("Could not find source File %s in Bucket %s!", objectRef.getBucket(), objectRef.getKey())); } return copyObjectResult; }
@RequestMapping(value="/cm/complex/vars", method = RequestMethod.PUT) @ResponseBody public String updateCmComplexVar(@RequestHeader(value="X-Cms-User", required = false) String user, @RequestBody CmsVar cmsVar){ cmManager.updateCmSimpleVar(cmsVar.getName(), cmsVar.getValue(),cmsVar.getCriteria(), user!=null?user:"oneops-system"); return "cms var '"+ cmsVar.getName() + "' updated"; }
@PutMapping("/claim/{referenceNumber}/event/{event}/resend-staff-notifications") @ApiOperation("Resend staff notifications associated with provided event") public void resendStaffNotifications( @PathVariable("referenceNumber") String referenceNumber, @PathVariable("event") String event, @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorisation ) throws ServletRequestBindingException { Claim claim = claimService.getClaimByReference(referenceNumber) .orElseThrow(() -> new NotFoundException(CLAIM + referenceNumber + " does not exist")); switch (event) { case "claim-issued": resendStaffNotificationsOnClaimIssued(claim, authorisation); break; case "more-time-requested": resendStaffNotificationOnMoreTimeRequested(claim); break; case "response-submitted": resendStaffNotificationOnDefendantResponseSubmitted(claim); break; case "ccj-request-submitted": resendStaffNotificationCCJRequestSubmitted(claim); break; case "offer-accepted": resendStaffNotificationOnOfferAccepted(claim); break; default: throw new NotFoundException("Event " + event + " is not supported"); } }
@ApiOperation(value = "", notes = "Retrieve job configuration", response = String.class, authorizations = { @Authorization(value = "jenkins_auth") }, tags={ "remoteAccess", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully retrieved job configuration in config.xml format", response = String.class), @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class), @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class), @ApiResponse(code = 404, message = "Job cannot be found on Jenkins instance", response = Void.class) }) @RequestMapping(value = "/job/{name}/config.xml", produces = { "text/xml" }, method = RequestMethod.GET) ResponseEntity<String> getJobConfig(@ApiParam(value = "Name of the job",required=true ) @PathVariable("name") String name, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
public ResponseEntity<ScmOrganisations> getSCMOrganisations(@ApiParam(value = "Name of the organization",required=true ) @PathVariable("organization") String organization, @ApiParam(value = "Name of SCM",required=true ) @PathVariable("scm") String scm, @ApiParam(value = "Credential ID") @RequestParam(value = "credentialId", required = false) String credentialId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! if (accept != null && accept.contains("application/json")) { return new ResponseEntity<ScmOrganisations>(objectMapper.readValue("\"\"", ScmOrganisations.class), HttpStatus.OK); } return new ResponseEntity<ScmOrganisations>(HttpStatus.OK); }
@RequestMapping(value="/dj/simple/approvals", method = RequestMethod.GET) @ResponseBody public List<CmsDpmtApproval> getDeploymentApprovals( @RequestParam(value="deploymentId", required = true) long dpmtId, @RequestHeader(value="X-Cms-Scope", required = false) String scope, @RequestHeader(value="X-Cms-User", required = false) String userId){ CmsDeployment dpmt = djManager.getDeployment(dpmtId); if (dpmt == null) throw new DJException(CmsError.DJ_NO_DEPLOYMENT_WITH_GIVEN_ID_ERROR, "There is no deployment with this id"); scopeVerifier.verifyScope(scope, dpmt); return djManager.getDeploymentApprovals(dpmtId); }
@ApiOperation(value = "", notes = "Retrieve run node details for an organization pipeline", response = PipelineStepImpl.class, authorizations = { @Authorization(value = "jenkins_auth") }, tags={ "blueOcean", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully retrieved run node step details", response = PipelineStepImpl.class), @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class), @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) }) @RequestMapping(value = "/blue/rest/organizations/{organization}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps/{step}", produces = { "application/json" }, method = RequestMethod.GET) ResponseEntity<PipelineStepImpl> getPipelineRunNodeStep(@ApiParam(value = "Name of the organization",required=true ) @PathVariable("organization") String organization,@ApiParam(value = "Name of the pipeline",required=true ) @PathVariable("pipeline") String pipeline,@ApiParam(value = "Name of the run",required=true ) @PathVariable("run") String run,@ApiParam(value = "Name of the node",required=true ) @PathVariable("node") String node,@ApiParam(value = "Name of the step",required=true ) @PathVariable("step") String step, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
public ResponseEntity<PipelineRunNodes> getPipelineRunNodes(@ApiParam(value = "Name of the organization",required=true ) @PathVariable("organization") String organization, @ApiParam(value = "Name of the pipeline",required=true ) @PathVariable("pipeline") String pipeline, @ApiParam(value = "Name of the run",required=true ) @PathVariable("run") String run, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! if (accept != null && accept.contains("application/json")) { return new ResponseEntity<PipelineRunNodes>(objectMapper.readValue("\"\"", PipelineRunNodes.class), HttpStatus.OK); } return new ResponseEntity<PipelineRunNodes>(HttpStatus.OK); }
@PostMapping(value = "/{claimId:\\d+}/offers/{party}/reject", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseStatus(HttpStatus.CREATED) @ApiOperation("Rejects an offer as a party") public Claim reject( @PathVariable("claimId") Long claimId, @PathVariable("party") MadeBy party, @RequestHeader(HttpHeaders.AUTHORIZATION) String authorisation ) { Claim claim = claimService.getClaimById(claimId); assertActionIsPermittedFor(claim, party, authorisation); offersService.reject(claim, party); return claimService.getClaimById(claimId); }
public ResponseEntity<UserFavorites> getUserFavorites(@ApiParam(value = "Name of the user",required=true ) @PathVariable("user") String user, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! if (accept != null && accept.contains("application/json")) { return new ResponseEntity<UserFavorites>(objectMapper.readValue("\"\"", UserFavorites.class), HttpStatus.OK); } return new ResponseEntity<UserFavorites>(HttpStatus.OK); }
@PostMapping("/{claimId:\\d+}/county-court-judgment") @ApiOperation("Save County Court Judgment") public Claim save( @PathVariable("claimId") Long claimId, @NotNull @RequestBody @Valid CountyCourtJudgment countyCourtJudgment, @RequestHeader(HttpHeaders.AUTHORIZATION) String authorisation ) { String submitterId = userService.getUserDetails(authorisation).getId(); return countyCourtJudgmentService.save(submitterId, countyCourtJudgment, claimId); }
public Endpoint(String relativeUrl, Method m, Object controller) { this.baseUrl = fillBaseUrl(controller); this.setRelativeUrl(relativeUrl); this.setPathVariable(new PathVariable(m, this.getRelativeUrl())); this.methods = new RequestHttpMethod(m); this.queryString = new QueryString(m); this.setBodyRequest(new BodyRequest(m, controller.getClass())); this.setBodyResponse(new BodyResponse(m, controller.getClass())); headers = new ArrayList<>(); ReflectionUtils.getHeaders(m).forEach(h -> { LOGGER.debug("obteniendo el header: {}", h); RequestHeader rh = h.getDeclaredAnnotationsByType(RequestHeader.class)[0]; headers.add(new Header(rh.value(), h.getType().getSimpleName())); }); }
@RequestMapping(value="/dj/simple/deployments/{dpmtId}", method = RequestMethod.GET) @ResponseBody public CmsDeployment getDeploymentById( @PathVariable long dpmtId, @RequestHeader(value="X-Cms-Scope", required = false) String scope){ CmsDeployment dpmt = djManager.getDeployment(dpmtId); if (dpmt == null) throw new DJException(CmsError.DJ_NO_DEPLOYMENT_WITH_GIVEN_ID_ERROR, "There is no deployment with this id"); scopeVerifier.verifyScope(scope, dpmt); return dpmt; }