Search in sources :

Example 1 with PUT

use of org.kohsuke.stapler.verb.PUT in project blueocean-plugin by jenkinsci.

the class BluePipeline method update.

/**
     * Updates this pipeline using {@link BluePipelineUpdateRequest}
     * @param staplerRequest stapler request
     * @return Updated BluePipeline instance
     * @throws IOException throws IOException in certain cases
     */
@PUT
@WebMethod(name = "")
@TreeResponse
public BluePipeline update(StaplerRequest staplerRequest) throws IOException {
    JSONObject body = JSONObject.fromObject(IOUtils.toString(staplerRequest.getReader()));
    if (body.get("$class") == null) {
        throw new ServiceException.BadRequestExpception("$class is required element");
    }
    BluePipelineUpdateRequest request = staplerRequest.bindJSON(BluePipelineUpdateRequest.class, body);
    return update(request);
}
Also used : JSONObject(net.sf.json.JSONObject) WebMethod(org.kohsuke.stapler.WebMethod) TreeResponse(io.jenkins.blueocean.commons.stapler.TreeResponse) PUT(org.kohsuke.stapler.verb.PUT)

Aggregations

TreeResponse (io.jenkins.blueocean.commons.stapler.TreeResponse)1 JSONObject (net.sf.json.JSONObject)1 WebMethod (org.kohsuke.stapler.WebMethod)1 PUT (org.kohsuke.stapler.verb.PUT)1