public void changeOfflineCause(String cause, boolean crumbFlag) throws IOException { String name; if ("master".equals(displayName)) { name = "(master)"; } else { name = UrlEscapers.urlPathSegmentEscaper().escape(displayName); } Map<String, String> data = new HashMap<String, String>(); data.put( "offlineMessage", cause ); client.post_form("/computer/" + name + "/changeOfflineCause?", data, crumbFlag); }
/** * Update the <code>description</code> of a Job. * * @param description The description which should be set. If you like to * set an empty description you should use * {@link #EMPTY_DESCRIPTION}. * @param crumbFlag <code>true</code> or <code>false</code>. * @throws IOException in case of errors. */ public void updateDescription(String description, boolean crumbFlag) throws IOException { Objects.requireNonNull(description, "description is not allowed to be null."); ImmutableMap<String, String> params = ImmutableMap.of("description", description); client.post_form(this.getUrl() + "/submitDescription?", params, crumbFlag); }
/** * Update <code>displayName</code> and the <code>description</code> of a * build. * * @param displayName The new displayName which should be set. * @param description The description which should be set. * @param crumbFlag <code>true</code> or <code>false</code>. * @throws IOException in case of errors. */ public void updateDisplayNameAndDescription(String displayName, String description, boolean crumbFlag) throws IOException { Objects.requireNonNull(displayName, "displayName is not allowed to be null."); Objects.requireNonNull(description, "description is not allowed to be null."); // TODO: Check what the "core:apply" means? ImmutableMap<String, String> params = ImmutableMap.of("displayName", displayName, "description", description, "core:apply", "", "Submit", "Save"); client.post_form(this.getUrl() + "/configSubmit?", params, crumbFlag); }
/** * Create a folder on the server (as a subfolder of this folder) * * @param folderName name of the folder to be created. * @param crumbFlag true/false. * @throws IOException in case of an error. */ public void createFolder(String folderName, Boolean crumbFlag) throws IOException { // https://gist.github.com/stuart-warren/7786892 was slightly helpful // here ImmutableMap<String, String> params = ImmutableMap.of("mode", "com.cloudbees.hudson.plugins.folder.Folder", "name", EncodingUtils.encodeParam(folderName), "from", "", "Submit", "OK"); client.post_form(this.getUrl() + "/createItem?", params, crumbFlag); }
/** * Create a folder on the server (as a subfolder of this folder) * * @param folderName name of the folder to be created. * @param crumbFlag true/false. * @throws IOException in case of an error. */ public void createFolder(String folderName, Boolean crumbFlag) throws IOException { // https://gist.github.com/stuart-warren/7786892 was slightly helpful // here ImmutableMap<String, String> params = ImmutableMap.of("mode", "com.cloudbees.hudson.plugins.folder.Folder", "name", EncodingUtils.encodeParam(folderName), "from", "", "Submit", "OK"); client.post_form(this.getUrl() + "/createItem?", params, crumbFlag); }
/** * Create a job on the server (in the given folder) * * @param folder {@link FolderJob} * @param jobName name of the job. * @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> * <code>false</code> otherwise. * @throws IOException in case of an error. */ public void createFolder(FolderJob folder, String jobName, Boolean crumbFlag) throws IOException { // https://gist.github.com/stuart-warren/7786892 was slightly helpful // here ImmutableMap<String, String> params = ImmutableMap.of("mode", "com.cloudbees.hudson.plugins.folder.Folder", "name", EncodingUtils.encodeParam(jobName), "from", "", "Submit", "OK"); client.post_form(UrlUtils.toBaseUrl(folder) + "createItem?", params, crumbFlag); }
/** * Update the <code>description</code> of a build. * * @param description The description which should be set. * @param crumbFlag <code>true</code> or <code>false</code>. * @throws IOException in case of errors. */ public void updateDescription(String description, boolean crumbFlag) throws IOException { Objects.requireNonNull(description, "description is not allowed to be null."); String displayName = getDisplayName() == null ? "" : getDisplayName(); // TODO: Check what the "core:apply" means? ImmutableMap<String, String> params = ImmutableMap.of("displayName", displayName, "description", description, "core:apply", "", "Submit", "Save"); client.post_form(this.getUrl() + "/configSubmit?", params, crumbFlag); }
/** * Update <code>displayName</code> of a build. * * @param displayName The new displayName which should be set. * @param crumbFlag <code>true</code> or <code>false</code>. * @throws IOException in case of errors. */ public void updateDisplayName(String displayName, boolean crumbFlag) throws IOException { Objects.requireNonNull(displayName, "displayName is not allowed to be null."); String description = getDescription() == null ? "" : getDescription(); // TODO: Check what the "core:apply" means? ImmutableMap<String, String> params = ImmutableMap.of("displayName", displayName, "description", description, "core:apply", "", "Submit", "Save"); client.post_form(this.getUrl() + "/configSubmit?", params, crumbFlag); }