private void stopPost(boolean crumbFlag) throws HttpResponseException, IOException { client.post(url + "stop", crumbFlag); }
private void stopPost() throws HttpResponseException, IOException { client.post(url + "stop"); }
/** * Cancels the Quiet Down (Prepare for shutdown) message * * @throws IOException in case of an error. */ public void cancelQuietDown() throws IOException { try { client.post("/cancelQuietDown/"); } catch (org.apache.http.client.ClientProtocolException e) { LOGGER.error("cancelQuietDown()", e); } }
/** * Restart Jenkins without waiting for any existing build to complete * * @param crumbFlag * <code>true</code> to add <b>crumbIssuer</b> <code>false</code> * otherwise. * @throws IOException * in case of an error. */ public void restart(Boolean crumbFlag) throws IOException { try { client.post("/restart", crumbFlag); } catch (org.apache.http.client.ClientProtocolException e) { LOGGER.error("restart()", e); } }
/** * safeExit: Puts Jenkins into the quiet mode, wait for existing builds to * be completed, and then shut down Jenkins * * @param crumbFlag * <code>true</code> to add <b>crumbIssuer</b> <code>false</code> * otherwise. * @throws IOException * in case of an error. */ public void safeExit(Boolean crumbFlag) throws IOException { try { client.post("/safeExit", crumbFlag); } catch (org.apache.http.client.ClientProtocolException e) { LOGGER.error("safeExit()", e); } } }
/** * safeRestart: Puts Jenkins into the quiet mode, wait for existing builds * to be completed, and then restart Jenkins * * @param crumbFlag * <code>true</code> to add <b>crumbIssuer</b> <code>false</code> * otherwise. * @throws IOException * in case of an error. */ public void safeRestart(Boolean crumbFlag) throws IOException { try { client.post("/safeRestart", crumbFlag); } catch (org.apache.http.client.ClientProtocolException e) { LOGGER.error("safeRestart()", e); } }
/** * Shutdown Jenkins without waiting for any existing build to complete * * @param crumbFlag * <code>true</code> to add <b>crumbIssuer</b> <code>false</code> * otherwise. * @throws IOException * in case of an error. */ // public void exit(Boolean crumbFlag) throws IOException { try { client.post("/exit", crumbFlag); } catch (org.apache.http.client.ClientProtocolException e) { LOGGER.error("exit()", e); } }
/** * Disable a job from Jenkins. * * @param jobName The name of the job to be deleted. * @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> * <code>false</code> otherwise. * @throws IOException In case of an failure. */ public void disableJob(String jobName, boolean crumbFlag) throws IOException { client.post("/job/" + EncodingUtils.encode(jobName) + "/disable", crumbFlag); }
/** * Delete a job from Jenkins. * * @param jobName The name of the job to be deleted. * @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> * <code>false</code> otherwise. * @throws IOException In case of an failure. */ public void deleteJob(String jobName, boolean crumbFlag) throws IOException { client.post("/job/" + EncodingUtils.encode(jobName) + "/doDelete", crumbFlag); }
public void toggleOffline(boolean crumbFlag) throws IOException { // curl --data "json=init" -X POST "http://192.168.99.100:8080/computer/(master)/toggleOffline" String name; if ("master".equals(displayName)) { name = "(master)"; } else { name = UrlEscapers.urlPathSegmentEscaper().escape(displayName); } Map<String, String> data = new HashMap<String, String>(); data.put( "json", "init" ); client.post( "/computer/" + name + "/toggleOffline", crumbFlag); }
/** * Delete a job from Jenkins within a folder. * * @param folder The folder where the given job is located. * @param jobName The job which should be deleted. * @param crumbFlag The crumbFlag * @throws IOException in case of problems. */ public void deleteJob(FolderJob folder, String jobName, boolean crumbFlag) throws IOException { client.post(UrlUtils.toJobBaseUrl(folder, jobName) + "/doDelete", crumbFlag); }
/** * Enable a job from Jenkins. * * @param jobName The name of the job to be deleted. * @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> * <code>false</code> otherwise. * @throws IOException In case of an failure. */ public void enableJob(String jobName, boolean crumbFlag) throws IOException { client.post("/job/" + EncodingUtils.encode(jobName) + "/enable", crumbFlag); }
/** * Trigger a build without parameters * * @return {@link QueueReference} for further analysis of the queued build. * @throws IOException in case of an error. */ public QueueReference build() throws IOException { ExtractHeader location = client.post(url + "build", null, ExtractHeader.class, false); return new QueueReference(location.getLocation()); }
/** * Trigger a build with crumbFlag. * * @param crumbFlag true or false. * @return {@link QueueReference} for further analysis of the queued build. * @throws IOException in case of an error. */ public QueueReference build(boolean crumbFlag) throws IOException { ExtractHeader location = client.post(url + "build", null, ExtractHeader.class, crumbFlag); return new QueueReference(location.getLocation()); }
/** * Trigger a parameterized build with file parameters and crumbFlag * * @param params the job parameters * @param fileParams the job file parameters * @param crumbFlag determines whether crumb flag is used * @return {@link QueueReference} for further analysis of the queued build. * @throws IOException in case of an error. */ public QueueReference build(Map<String, String> params, Map<String, File> fileParams, boolean crumbFlag) throws IOException { String qs = join(Collections2.transform(params.entrySet(), new MapEntryToQueryStringPair()), "&"); ExtractHeader location = client.post(url + "buildWithParameters?" + qs,null, ExtractHeader.class, fileParams, crumbFlag); return new QueueReference(location.getLocation()); }
/** * Rename a job * * @param folder {@link FolderJob} * @param oldJobName existing job name. * @param newJobName The new job name. * @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> * <code>false</code> otherwise. * @throws IOException In case of a failure. */ public void renameJob(FolderJob folder, String oldJobName, String newJobName, Boolean crumbFlag) throws IOException { client.post(UrlUtils.toJobBaseUrl(folder, oldJobName) + "/doRename?newName=" + EncodingUtils.encodeParam(newJobName), crumbFlag); }