com.offbytwo.jenkins.model.Computer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jenkins-client Show documentation
Show all versions of jenkins-client Show documentation
A Jenkins API client for Java
/*
* Copyright (c) 2013 Rising Oak LLC.
*
* Distributed under the MIT license: http://opensource.org/licenses/MIT
*/
package com.offbytwo.jenkins.model;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import static java.net.URLEncoder.encode;
import static org.apache.commons.lang.StringUtils.join;
public class Computer extends BaseModel {
private String displayName;
public List getComputers() {
return computer;
}
public void setComputer(List computer) {
this.computer = computer;
}
List computer;
public Computer() {}
public Computer(String displayName) {
this();
this.displayName = displayName;
}
public String getDisplayName() {
return this.displayName;
}
public ComputerWithDetails details() throws IOException {
return client.get("/computer/" + displayName.replaceAll("master", "(master)"), ComputerWithDetails.class);
}
private static class MapEntryToQueryStringPair implements Function, String> {
@Override
public String apply(Map.Entry entry) {
return encode(entry.getKey()) + "=" + encode(entry.getValue());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy