diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..9a39f9173 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Unix shell files use Unix line endings +*.sh text eol=lf + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/src/main/java/com/github/dockerjava/client/DockerClient.java b/src/main/java/com/github/dockerjava/client/DockerClient.java index b7d0993ed..e30472403 100644 --- a/src/main/java/com/github/dockerjava/client/DockerClient.java +++ b/src/main/java/com/github/dockerjava/client/DockerClient.java @@ -54,7 +54,6 @@ import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; -import com.sun.jersey.api.client.filter.LoggingFilter; import com.sun.jersey.client.apache4.ApacheHttpClient4; import com.sun.jersey.client.apache4.ApacheHttpClient4Handler; @@ -63,7 +62,7 @@ */ public class DockerClient { - private Client client; + private Client client; private WebResource baseResource; private AuthConfig authConfig; @@ -110,7 +109,7 @@ private DockerClient(Config config) { // client = new UnixSocketClient(clientConfig); client.addFilter(new JsonClientFilter()); - client.addFilter(new LoggingFilter()); + client.addFilter(new SelectiveLoggingFilter()); baseResource = client.resource(config.url + "/v" + config.version); } diff --git a/src/main/java/com/github/dockerjava/client/SelectiveLoggingFilter.java b/src/main/java/com/github/dockerjava/client/SelectiveLoggingFilter.java new file mode 100644 index 000000000..fbdbfc7a2 --- /dev/null +++ b/src/main/java/com/github/dockerjava/client/SelectiveLoggingFilter.java @@ -0,0 +1,47 @@ +package com.github.dockerjava.client; + +import java.util.Set; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; + +import com.google.common.collect.ImmutableSet; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.filter.LoggingFilter; + +/** + * A version of the logging filter that will avoid trying to log entities which can cause + * issues with the console. + * + * @author sfitts + * + */ +public class SelectiveLoggingFilter extends LoggingFilter { + + private static final Set SKIPPED_CONTENT = ImmutableSet.builder() + .add(MediaType.APPLICATION_OCTET_STREAM) + .add("application/tar") + .build(); + + @Override + public ClientResponse handle(ClientRequest request) throws ClientHandlerException { + // Unless the content type is in the list of those we want to ellide, then just have + // our super-class handle things. + Object contentType = request.getHeaders().getFirst(HttpHeaders.CONTENT_TYPE); + if (contentType != null && SKIPPED_CONTENT.contains(contentType.toString())) { + // Skip logging this. + // + // N.B. -- I'd actually love to reproduce (or better yet just use) the logging code from + // our super-class. However, everything is private (so we can't use it) and the code + // is under a modified GPL which means we can't pull it into an ASL project. Right now + // I don't have the energy to do a clean implementation. + return getNext().handle(request); + } + + // Do what we normally would + return super.handle(request); + } + +} diff --git a/src/main/java/com/github/dockerjava/client/command/AbstrDockerCmd.java b/src/main/java/com/github/dockerjava/client/command/AbstrDockerCmd.java index a10b22088..e5e2f2be0 100644 --- a/src/main/java/com/github/dockerjava/client/command/AbstrDockerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/AbstrDockerCmd.java @@ -1,9 +1,14 @@ package com.github.dockerjava.client.command; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.google.common.base.Preconditions; import com.sun.jersey.api.client.WebResource; public abstract class AbstrDockerCmd, RES_T> implements DockerCmd { + + private final static Logger LOGGER = LoggerFactory.getLogger(AbstrDockerCmd.class); protected WebResource baseResource; @@ -18,6 +23,7 @@ public T withBaseResource(WebResource baseResource) { @Override public RES_T exec() { Preconditions.checkNotNull(baseResource, "baseResource was not specified"); + LOGGER.debug("Cmd: {}", this); return impl(); } } \ No newline at end of file diff --git a/src/main/java/com/github/dockerjava/client/command/AuthCmd.java b/src/main/java/com/github/dockerjava/client/command/AuthCmd.java index f5f7b7ede..85f681033 100644 --- a/src/main/java/com/github/dockerjava/client/command/AuthCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/AuthCmd.java @@ -34,4 +34,9 @@ protected Void impl() throws DockerException { throw new DockerException(e); } } + + @Override + public String toString() { + return "authenticate using " + this.authConfig; + } } diff --git a/src/main/java/com/github/dockerjava/client/command/BuildImgCmd.java b/src/main/java/com/github/dockerjava/client/command/BuildImgCmd.java index edaa3110c..5a92fb56f 100644 --- a/src/main/java/com/github/dockerjava/client/command/BuildImgCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/BuildImgCmd.java @@ -61,6 +61,15 @@ public BuildImgCmd withNoCache(boolean noCache) { return this; } + @Override + public String toString() { + return new StringBuilder("build ") + .append(tag != null ? "-t " + tag + " " : "") + .append(noCache ? "--nocache=true " : "") + .append(dockerFolder != null ? dockerFolder.getPath() : "-") + .toString(); + } + protected ClientResponse impl() { if (tarInputStream == null) { File dockerFolderTar = buildDockerFolderTar(); diff --git a/src/main/java/com/github/dockerjava/client/command/CommitCmd.java b/src/main/java/com/github/dockerjava/client/command/CommitCmd.java index 3dc350eaf..16a76985f 100644 --- a/src/main/java/com/github/dockerjava/client/command/CommitCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/CommitCmd.java @@ -67,7 +67,17 @@ public CommitCmd withRun(String run) { return this; } - + @Override + public String toString() { + return new StringBuilder("commit ") + .append(commitConfig.getAuthor() != null ? "--author " + commitConfig.getAuthor() + " " : "") + .append(commitConfig.getMessage() != null ? "--message " + commitConfig.getMessage() + " " : "") + .append(commitConfig.getContainerId()) + .append(commitConfig.getRepo() != null ? " " + commitConfig.getRepo() + ":" : " ") + .append(commitConfig.getTag() != null ? commitConfig.getTag() : "") + .toString(); + } + private void checkCommitConfig(CommitConfig commitConfig) { Preconditions.checkNotNull(commitConfig, "CommitConfig was not specified"); } diff --git a/src/main/java/com/github/dockerjava/client/command/ContainerDiffCmd.java b/src/main/java/com/github/dockerjava/client/command/ContainerDiffCmd.java index a0225beca..ed684d04f 100644 --- a/src/main/java/com/github/dockerjava/client/command/ContainerDiffCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/ContainerDiffCmd.java @@ -37,7 +37,14 @@ public ContainerDiffCmd withContainerId(String containerId) { return this; } - protected List impl() throws DockerException { + @Override + public String toString() { + return new StringBuilder("diff ") + .append(containerId) + .toString(); + } + + protected List impl() throws DockerException { WebResource webResource = baseResource.path(String.format("/containers/%s/changes", containerId)); try { diff --git a/src/main/java/com/github/dockerjava/client/command/CopyFileFromContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/CopyFileFromContainerCmd.java index d95434183..3e374aa57 100644 --- a/src/main/java/com/github/dockerjava/client/command/CopyFileFromContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/CopyFileFromContainerCmd.java @@ -40,6 +40,15 @@ public CopyFileFromContainerCmd withResource(String resource) { return this; } + @Override + public String toString() { + return new StringBuilder("cp ") + .append(containerId) + .append(":") + .append(resource) + .toString(); + } + protected ClientResponse impl() throws DockerException { CopyConfig copyConfig = new CopyConfig(); copyConfig.setResource(resource); diff --git a/src/main/java/com/github/dockerjava/client/command/CreateContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/CreateContainerCmd.java index b37950899..94b46bb8a 100644 --- a/src/main/java/com/github/dockerjava/client/command/CreateContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/CreateContainerCmd.java @@ -81,6 +81,14 @@ public CreateContainerCmd withExposedPorts(ExposedPort... exposedPorts) { return this; } + @Override + public String toString() { + return new StringBuilder("create container ") + .append(name != null ? "name=" + name + " " : "") + .append(containerCreateConfig) + .toString(); + } + protected ContainerCreateResponse impl() { MultivaluedMap params = new MultivaluedMapImpl(); if (name != null) { diff --git a/src/main/java/com/github/dockerjava/client/command/ImportImageCmd.java b/src/main/java/com/github/dockerjava/client/command/ImportImageCmd.java index 4797110d9..020d5e750 100644 --- a/src/main/java/com/github/dockerjava/client/command/ImportImageCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/ImportImageCmd.java @@ -62,6 +62,14 @@ public ImportImageCmd withTag(String tag) { return this; } + @Override + public String toString() { + return new StringBuilder("import - ") + .append(repository != null ? repository + ":" : "") + .append(tag != null ? tag : "") + .toString(); + } + protected ImageCreateResponse impl() { MultivaluedMap params = new MultivaluedMapImpl(); params.add("repo", repository); diff --git a/src/main/java/com/github/dockerjava/client/command/InfoCmd.java b/src/main/java/com/github/dockerjava/client/command/InfoCmd.java index 810718f08..42985e632 100644 --- a/src/main/java/com/github/dockerjava/client/command/InfoCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/InfoCmd.java @@ -12,15 +12,17 @@ /** - * - * - * + * Return Docker server info */ public class InfoCmd extends AbstrDockerCmd { private static final Logger LOGGER = LoggerFactory.getLogger(InfoCmd.class); - + @Override + public String toString() { + return "info"; + } + protected Info impl() throws DockerException { WebResource webResource = baseResource.path("/info"); diff --git a/src/main/java/com/github/dockerjava/client/command/InspectContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/InspectContainerCmd.java index ba6eedd57..ff031537e 100644 --- a/src/main/java/com/github/dockerjava/client/command/InspectContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/InspectContainerCmd.java @@ -13,9 +13,7 @@ import com.sun.jersey.api.client.WebResource; /** - * - * - * + * Inspect the details of a container. */ public class InspectContainerCmd extends AbstrDockerCmd { @@ -33,6 +31,11 @@ public InspectContainerCmd withContainerId(String containerId) { return this; } + @Override + public String toString() { + return "inspect " + containerId; + } + protected ContainerInspectResponse impl() throws DockerException { WebResource webResource = baseResource.path(String.format("/containers/%s/json", containerId)); diff --git a/src/main/java/com/github/dockerjava/client/command/InspectImageCmd.java b/src/main/java/com/github/dockerjava/client/command/InspectImageCmd.java index 23f6a7756..ab4f3510d 100644 --- a/src/main/java/com/github/dockerjava/client/command/InspectImageCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/InspectImageCmd.java @@ -14,9 +14,7 @@ /** - * - * - * + * Inspect the details of an image. */ public class InspectImageCmd extends AbstrDockerCmd { @@ -34,6 +32,11 @@ public InspectImageCmd withImageId(String imageId) { return this; } + @Override + public String toString() { + return "inspect " + imageId; + } + protected ImageInspectResponse impl() { WebResource webResource = baseResource.path(String.format("/images/%s/json", imageId)); diff --git a/src/main/java/com/github/dockerjava/client/command/KillContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/KillContainerCmd.java index 758745597..58ac5564f 100644 --- a/src/main/java/com/github/dockerjava/client/command/KillContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/KillContainerCmd.java @@ -11,9 +11,7 @@ import com.sun.jersey.api.client.WebResource; /** - * - * - * + * Kill a running container. */ public class KillContainerCmd extends AbstrDockerCmd { @@ -31,6 +29,11 @@ public KillContainerCmd withContainerId(String containerId) { return this; } + @Override + public String toString() { + return "kill " + containerId; + } + protected Void impl() throws DockerException { WebResource webResource = baseResource.path(String.format("/containers/%s/kill", containerId)); diff --git a/src/main/java/com/github/dockerjava/client/command/ListContainersCmd.java b/src/main/java/com/github/dockerjava/client/command/ListContainersCmd.java index 9724fa15c..774061556 100644 --- a/src/main/java/com/github/dockerjava/client/command/ListContainersCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/ListContainersCmd.java @@ -61,6 +61,17 @@ public ListContainersCmd withBefore(String before) { return this; } + @Override + public String toString() { + return new StringBuilder("ps ") + .append(showAll ? "--all=true" : "") + .append(showSize ? "--size=true" : "") + .append(sinceId != null ? "--since " + sinceId : "") + .append(beforeId != null ? "--before " + beforeId : "") + .append(limit != -1 ? "-n " + limit : "") + .toString(); + } + protected List impl() { MultivaluedMap params = new MultivaluedMapImpl(); if(limit >= 0) { diff --git a/src/main/java/com/github/dockerjava/client/command/ListImagesCmd.java b/src/main/java/com/github/dockerjava/client/command/ListImagesCmd.java index 5756b72d3..e4611f511 100644 --- a/src/main/java/com/github/dockerjava/client/command/ListImagesCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/ListImagesCmd.java @@ -41,6 +41,14 @@ public ListImagesCmd withFilter(String filter) { return this; } + @Override + public String toString() { + return new StringBuilder("images ") + .append(showAll ? "--all=true" : "") + .append(filter != null ? "--filter " + filter : "") + .toString(); + } + protected List impl() { MultivaluedMap params = new MultivaluedMapImpl(); params.add("filter", filter); diff --git a/src/main/java/com/github/dockerjava/client/command/LogContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/LogContainerCmd.java index c924be298..cda2e0909 100644 --- a/src/main/java/com/github/dockerjava/client/command/LogContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/LogContainerCmd.java @@ -78,7 +78,14 @@ public LogContainerCmd withStdErr(boolean stderr) { return this; } - + @Override + public String toString() { + return new StringBuilder("logs ") + .append(followStream ? "--follow=true" : "") + .append(timestamps ? "--timestamps=true" : "") + .append(containerId) + .toString(); + } protected ClientResponse impl() throws DockerException { MultivaluedMap params = new MultivaluedMapImpl(); diff --git a/src/main/java/com/github/dockerjava/client/command/PullImageCmd.java b/src/main/java/com/github/dockerjava/client/command/PullImageCmd.java index 0c6ee7a3e..16e0ee710 100644 --- a/src/main/java/com/github/dockerjava/client/command/PullImageCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/PullImageCmd.java @@ -48,6 +48,14 @@ public PullImageCmd withRegistry(String registry) { return this; } + @Override + public String toString() { + return new StringBuilder("pull ") + .append(repository) + .append(tag != null ? ":" + tag : "") + .toString(); + } + protected ClientResponse impl() { Preconditions.checkNotNull(repository, "Repository was not specified"); diff --git a/src/main/java/com/github/dockerjava/client/command/PushImageCmd.java b/src/main/java/com/github/dockerjava/client/command/PushImageCmd.java index dc0b35b15..6d54a7562 100644 --- a/src/main/java/com/github/dockerjava/client/command/PushImageCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/PushImageCmd.java @@ -36,6 +36,13 @@ public PushImageCmd withName(String name) { return this; } + @Override + public String toString() { + return new StringBuilder("push ") + .append(name) + .toString(); + } + protected ClientResponse impl() { WebResource webResource = baseResource.path("/images/" + name(name) + "/push"); try { diff --git a/src/main/java/com/github/dockerjava/client/command/RemoveContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/RemoveContainerCmd.java index b8e107654..e13cd9701 100644 --- a/src/main/java/com/github/dockerjava/client/command/RemoveContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/RemoveContainerCmd.java @@ -49,6 +49,15 @@ public RemoveContainerCmd withForce(boolean force) { return this; } + @Override + public String toString() { + return new StringBuilder("rm ") + .append(removeVolumes ? "--volumes=true" : "") + .append(force ? "--force=true" : "") + .append(containerId) + .toString(); + } + protected Void impl() throws DockerException { Preconditions.checkState(!StringUtils.isEmpty(containerId), "Container ID can't be empty"); diff --git a/src/main/java/com/github/dockerjava/client/command/RemoveImageCmd.java b/src/main/java/com/github/dockerjava/client/command/RemoveImageCmd.java index cef438fee..da6f658cb 100644 --- a/src/main/java/com/github/dockerjava/client/command/RemoveImageCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/RemoveImageCmd.java @@ -43,6 +43,15 @@ public RemoveImageCmd withNoPrune(boolean noPrune) { return this; } + @Override + public String toString() { + return new StringBuilder("rmi ") + .append(noPrune ? "--no-prune=true" : "") + .append(force ? "--force=true" : "") + .append(imageId) + .toString(); + } + protected Void impl() throws DockerException { Preconditions.checkState(!StringUtils.isEmpty(imageId), "Image ID can't be empty"); diff --git a/src/main/java/com/github/dockerjava/client/command/RestartContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/RestartContainerCmd.java index b8da9dbd4..48a436c98 100644 --- a/src/main/java/com/github/dockerjava/client/command/RestartContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/RestartContainerCmd.java @@ -41,6 +41,14 @@ public RestartContainerCmd withtTimeout(int timeout) { return this; } + @Override + public String toString() { + return new StringBuilder("restart ") + .append("--time=" + timeout + " ") + .append(containerId) + .toString(); + } + protected Void impl() throws DockerException { WebResource webResource = baseResource.path(String.format("/containers/%s/restart", containerId)) .queryParam("t", String.valueOf(timeout));; diff --git a/src/main/java/com/github/dockerjava/client/command/SearchImagesCmd.java b/src/main/java/com/github/dockerjava/client/command/SearchImagesCmd.java index 784e49de3..90df5b787 100644 --- a/src/main/java/com/github/dockerjava/client/command/SearchImagesCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/SearchImagesCmd.java @@ -36,6 +36,13 @@ public SearchImagesCmd withTerm(String term) { return this; } + @Override + public String toString() { + return new StringBuilder("search ") + .append(term) + .toString(); + } + protected List impl() { WebResource webResource = baseResource.path("/images/search").queryParam("term", term); try { diff --git a/src/main/java/com/github/dockerjava/client/command/StartContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/StartContainerCmd.java index 36822ce9d..305dd8668 100644 --- a/src/main/java/com/github/dockerjava/client/command/StartContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/StartContainerCmd.java @@ -16,9 +16,7 @@ import com.sun.jersey.api.client.WebResource.Builder; /** - * - * - * + * Run a container */ public class StartContainerCmd extends AbstrDockerCmd { @@ -75,6 +73,15 @@ public StartContainerCmd withContainerId(String containerId) { return this; } + @Override + public String toString() { + return new StringBuilder("run ") + .append(containerId) + .append(" using ") + .append(startContainerConfig) + .toString(); + } + protected Void impl() throws DockerException { WebResource webResource = baseResource.path(String.format("/containers/%s/start", containerId)); diff --git a/src/main/java/com/github/dockerjava/client/command/StopContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/StopContainerCmd.java index cb2e26f96..ed3956197 100644 --- a/src/main/java/com/github/dockerjava/client/command/StopContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/StopContainerCmd.java @@ -41,6 +41,14 @@ public StopContainerCmd withTimeout(int timeout) { return this; } + @Override + public String toString() { + return new StringBuilder("stop ") + .append("--time=" + timeout + " ") + .append(containerId) + .toString(); + } + protected Void impl() throws DockerException { WebResource webResource = baseResource.path(String.format("/containers/%s/stop", containerId)) .queryParam("t", String.valueOf(timeout)); diff --git a/src/main/java/com/github/dockerjava/client/command/TagImageCmd.java b/src/main/java/com/github/dockerjava/client/command/TagImageCmd.java index f06ab3761..802890501 100644 --- a/src/main/java/com/github/dockerjava/client/command/TagImageCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/TagImageCmd.java @@ -65,6 +65,16 @@ public TagImageCmd withForce(boolean force) { return this; } + @Override + public String toString() { + return new StringBuilder("tag ") + .append(force ? "--force=true " : "") + .append(repository != null ? repository + "/" : "") + .append(imageId) + .append(tag != null ? ":" + tag : "") + .toString(); + } + protected Integer impl() { MultivaluedMap params = new MultivaluedMapImpl(); diff --git a/src/main/java/com/github/dockerjava/client/command/TopContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/TopContainerCmd.java index 34be6e978..490f1951f 100644 --- a/src/main/java/com/github/dockerjava/client/command/TopContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/TopContainerCmd.java @@ -43,6 +43,14 @@ public TopContainerCmd withPsArgs(String psArgs) { return this; } + @Override + public String toString() { + return new StringBuilder("top ") + .append(containerId) + .append(psArgs != null ? " " + psArgs : "") + .toString(); + } + protected ContainerTopResponse impl() throws DockerException { WebResource webResource = baseResource.path(String.format("/containers/%s/top", containerId)); diff --git a/src/main/java/com/github/dockerjava/client/command/VersionCmd.java b/src/main/java/com/github/dockerjava/client/command/VersionCmd.java index 15fd00bc7..c1809e4e7 100644 --- a/src/main/java/com/github/dockerjava/client/command/VersionCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/VersionCmd.java @@ -12,15 +12,18 @@ /** - * - * - * + * Return the Docker version info. */ public class VersionCmd extends AbstrDockerCmd { private static final Logger LOGGER = LoggerFactory.getLogger(VersionCmd.class); + @Override + public String toString() { + return "version"; + } + protected Version impl() throws DockerException { WebResource webResource = baseResource.path("/version"); diff --git a/src/main/java/com/github/dockerjava/client/command/WaitContainerCmd.java b/src/main/java/com/github/dockerjava/client/command/WaitContainerCmd.java index 711348950..41202f141 100644 --- a/src/main/java/com/github/dockerjava/client/command/WaitContainerCmd.java +++ b/src/main/java/com/github/dockerjava/client/command/WaitContainerCmd.java @@ -13,9 +13,7 @@ import com.sun.jersey.api.client.WebResource; /** - * - * - * + * Wait for a container to exit and print its exit code */ public class WaitContainerCmd extends AbstrDockerCmd { @@ -33,6 +31,11 @@ public WaitContainerCmd withContainerId(String containerId) { return this; } + @Override + public String toString() { + return "wait " + containerId; + } + protected Integer impl() throws DockerException { WebResource webResource = baseResource.path(String.format("/containers/%s/wait", containerId)); diff --git a/src/main/java/com/github/dockerjava/client/model/ChangeLog.java b/src/main/java/com/github/dockerjava/client/model/ChangeLog.java index 7fba4cfe3..cc4c5ece8 100644 --- a/src/main/java/com/github/dockerjava/client/model/ChangeLog.java +++ b/src/main/java/com/github/dockerjava/client/model/ChangeLog.java @@ -1,35 +1,35 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ChangeLog { - - @JsonProperty("Path") - private String path; - - @JsonProperty("Kind") - private int kind; - - public String getPath() { - return path; - } - - public int getKind() { - return kind; - } - - @Override - public String toString() { - return "ChangeLog{" + - "path='" + path + '\'' + - ", kind=" + kind + - '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ChangeLog { + + @JsonProperty("Path") + private String path; + + @JsonProperty("Kind") + private int kind; + + public String getPath() { + return path; + } + + public int getKind() { + return kind; + } + + @Override + public String toString() { + return "ChangeLog{" + + "path='" + path + '\'' + + ", kind=" + kind + + '}'; + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/CommitConfig.java b/src/main/java/com/github/dockerjava/client/model/CommitConfig.java index a8e6892bf..734119e8d 100644 --- a/src/main/java/com/github/dockerjava/client/model/CommitConfig.java +++ b/src/main/java/com/github/dockerjava/client/model/CommitConfig.java @@ -1,87 +1,87 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class CommitConfig { - - @JsonProperty("container") - private String containerId; - - @JsonProperty("repo") - private String repo; - - @JsonProperty("tag") - private String tag; - - @JsonProperty("m") - private String message; - - //author (eg. “John Hannibal Smith ”) - @JsonProperty("author") - private String author; - - //config automatically applied when the image is run. (ex: {“Cmd”: [“cat”, “/world”], “PortSpecs”:[“22”]}) - @JsonProperty("run") - private String run; - - public String getContainerId() { - return containerId; - } - - public String getRepo() { - return repo; - } - - public String getTag() { - return tag; - } - - public String getMessage() { - return message; - } - - public String getAuthor() { - return author; - } - - public String getRun() { - return run; - } - - public CommitConfig setRepo(String repo) { - this.repo = repo; - return this; - } - - public CommitConfig setTag(String tag) { - this.tag = tag; - return this; - } - - public CommitConfig setMessage(String message) { - this.message = message; - return this; - } - - public CommitConfig setAuthor(String author) { - this.author = author; - return this; - } - - public CommitConfig setRun(String run) { - this.run = run; - return this; - } - - public CommitConfig(String containerId) { - this.containerId = containerId; - } - -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class CommitConfig { + + @JsonProperty("container") + private String containerId; + + @JsonProperty("repo") + private String repo; + + @JsonProperty("tag") + private String tag; + + @JsonProperty("m") + private String message; + + //author (eg. “John Hannibal Smith ”) + @JsonProperty("author") + private String author; + + //config automatically applied when the image is run. (ex: {“Cmd”: [“cat”, “/world”], “PortSpecs”:[“22”]}) + @JsonProperty("run") + private String run; + + public String getContainerId() { + return containerId; + } + + public String getRepo() { + return repo; + } + + public String getTag() { + return tag; + } + + public String getMessage() { + return message; + } + + public String getAuthor() { + return author; + } + + public String getRun() { + return run; + } + + public CommitConfig setRepo(String repo) { + this.repo = repo; + return this; + } + + public CommitConfig setTag(String tag) { + this.tag = tag; + return this; + } + + public CommitConfig setMessage(String message) { + this.message = message; + return this; + } + + public CommitConfig setAuthor(String author) { + this.author = author; + return this; + } + + public CommitConfig setRun(String run) { + this.run = run; + return this; + } + + public CommitConfig(String containerId) { + this.containerId = containerId; + } + +} diff --git a/src/main/java/com/github/dockerjava/client/model/Container.java b/src/main/java/com/github/dockerjava/client/model/Container.java index e368758d4..3f0d642af 100644 --- a/src/main/java/com/github/dockerjava/client/model/Container.java +++ b/src/main/java/com/github/dockerjava/client/model/Container.java @@ -1,140 +1,140 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.Arrays; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown=true) -public class Container { - - @JsonProperty("Id") - private String id; - - @JsonProperty("Command") - private String command; - - @JsonProperty("Image") - private String image; - - @JsonProperty("Created") - private long created; - - @JsonProperty("Status") - private String status; - - @JsonProperty("Ports") - public Port[] ports; - - @JsonProperty("SizeRw") - private int size; - - @JsonProperty("SizeRootFs") - private int sizeRootFs; - - @JsonProperty("Names") - private String[] names; - - public String getId() { - return id; - } - - public String getCommand() { - return command; - } - - public String getImage() { - return image; - } - - public long getCreated() { - return created; - } - - public String getStatus() { - return status; - } - - public Port[] getPorts() { - return ports; - } - - public void setPorts(Port[] ports) { - this.ports = ports; - } - - public int getSize() { - return size; - } - - public int getSizeRootFs() { - return sizeRootFs; - } - - public String[] getNames() { - return names; - } - - - @Override - public String toString() { - return "Container{" + - "id='" + id + '\'' + - ", command='" + command + '\'' + - ", image='" + image + '\'' + - ", created=" + created + - ", status='" + status + '\'' + - ", ports=" + Arrays.toString(ports) + - ", size=" + size + - ", sizeRootFs=" + sizeRootFs + - ", names=" + Arrays.toString(names) + - '}'; - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static class Port { - - @JsonProperty("IP") - private String ip; - - @JsonProperty("PrivatePort") - private Integer privatePort; - - @JsonProperty("PublicPort") - private Integer publicPort; - - @JsonProperty("Type") - private String type; - - public String getIp() { - return ip; - } - - public Integer getPrivatePort() { - return privatePort; - } - - public Integer getPublicPort() { - return publicPort; - } - - public String getType() { - return type; - } - - @Override - public String toString() { - return "Port{" + - "IP='" + ip + '\'' + - ", privatePort='" + privatePort + '\'' + - ", publicPort='" + publicPort + '\'' + - ", type='" + type + '\'' + - '}'; - } - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Arrays; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown=true) +public class Container { + + @JsonProperty("Id") + private String id; + + @JsonProperty("Command") + private String command; + + @JsonProperty("Image") + private String image; + + @JsonProperty("Created") + private long created; + + @JsonProperty("Status") + private String status; + + @JsonProperty("Ports") + public Port[] ports; + + @JsonProperty("SizeRw") + private int size; + + @JsonProperty("SizeRootFs") + private int sizeRootFs; + + @JsonProperty("Names") + private String[] names; + + public String getId() { + return id; + } + + public String getCommand() { + return command; + } + + public String getImage() { + return image; + } + + public long getCreated() { + return created; + } + + public String getStatus() { + return status; + } + + public Port[] getPorts() { + return ports; + } + + public void setPorts(Port[] ports) { + this.ports = ports; + } + + public int getSize() { + return size; + } + + public int getSizeRootFs() { + return sizeRootFs; + } + + public String[] getNames() { + return names; + } + + + @Override + public String toString() { + return "Container{" + + "id='" + id + '\'' + + ", command='" + command + '\'' + + ", image='" + image + '\'' + + ", created=" + created + + ", status='" + status + '\'' + + ", ports=" + Arrays.toString(ports) + + ", size=" + size + + ", sizeRootFs=" + sizeRootFs + + ", names=" + Arrays.toString(names) + + '}'; + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class Port { + + @JsonProperty("IP") + private String ip; + + @JsonProperty("PrivatePort") + private Integer privatePort; + + @JsonProperty("PublicPort") + private Integer publicPort; + + @JsonProperty("Type") + private String type; + + public String getIp() { + return ip; + } + + public Integer getPrivatePort() { + return privatePort; + } + + public Integer getPublicPort() { + return publicPort; + } + + public String getType() { + return type; + } + + @Override + public String toString() { + return "Port{" + + "IP='" + ip + '\'' + + ", privatePort='" + privatePort + '\'' + + ", publicPort='" + publicPort + '\'' + + ", type='" + type + '\'' + + '}'; + } + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/ContainerConfig.java b/src/main/java/com/github/dockerjava/client/model/ContainerConfig.java index ebd1006d2..b623e408b 100644 --- a/src/main/java/com/github/dockerjava/client/model/ContainerConfig.java +++ b/src/main/java/com/github/dockerjava/client/model/ContainerConfig.java @@ -1,299 +1,299 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - - -import java.util.Arrays; -import java.util.Map; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ContainerConfig { - - @JsonProperty("Hostname") private String hostName = ""; - @JsonProperty("PortSpecs") private String[] portSpecs; - @JsonProperty("User") private String user = ""; - @JsonProperty("Tty") private boolean tty = false; - @JsonProperty("OpenStdin") private boolean stdinOpen = false; - @JsonProperty("StdinOnce") private boolean stdInOnce = false; - @JsonProperty("Memory") private long memoryLimit = 0; - @JsonProperty("MemorySwap") private long memorySwap = 0; - @JsonProperty("CpuShares") private int cpuShares = 0; - @JsonProperty("AttachStdin") private boolean attachStdin = false; - @JsonProperty("AttachStdout") private boolean attachStdout = false; - @JsonProperty("AttachStderr") private boolean attachStderr = false; - @JsonProperty("Env") private String[] env; - @JsonProperty("Cmd") private String[] cmd; - @JsonProperty("Dns") private String[] dns; - @JsonProperty("Image") private String image; - @JsonProperty("Volumes") private Map volumes; - @JsonProperty("VolumesFrom") private String volumesFrom = ""; - @JsonProperty("Entrypoint") private String[] entrypoint = new String[]{}; - @JsonProperty("NetworkDisabled") private boolean networkDisabled = false; - @JsonProperty("Privileged") private boolean privileged = false; - @JsonProperty("WorkingDir") private String workingDir = ""; - @JsonProperty("Domainname") private String domainName = ""; - @JsonProperty("ExposedPorts") private ExposedPorts exposedPorts; - - @JsonProperty("OnBuild") private int[] onBuild; - - @JsonIgnore - public ExposedPort[] getExposedPorts() { - return exposedPorts.getExposedPorts(); - } - - @JsonIgnore - public void setExposedPorts(ExposedPort[] exposedPorts) { - this.exposedPorts = new ExposedPorts(exposedPorts); - } - - public boolean isNetworkDisabled() { - return networkDisabled; - } - - public String getDomainName() { - return domainName; - } - - public String getWorkingDir() { return workingDir; } - - public ContainerConfig setWorkingDir(String workingDir) { - this.workingDir = workingDir; - return this; - } - - public boolean isPrivileged() { - return privileged; - } - - public ContainerConfig setPrivileged(boolean privileged) { - this.privileged = privileged; - return this; - } - - public String getHostName() { - return hostName; - } - - public ContainerConfig setNetworkDisabled(boolean networkDisabled) { - this.networkDisabled = networkDisabled; - return this; - } - - public ContainerConfig setHostName(String hostName) { - this.hostName = hostName; - return this; - } - - public String[] getPortSpecs() { - return portSpecs; - } - - public ContainerConfig setPortSpecs(String[] portSpecs) { - this.portSpecs = portSpecs; - return this; - } - - public String getUser() { - return user; - } - - public ContainerConfig setUser(String user) { - this.user = user; - return this; - } - - public boolean isTty() { - return tty; - } - - public ContainerConfig setTty(boolean tty) { - this.tty = tty; - return this; - } - - public boolean isStdinOpen() { - return stdinOpen; - } - - public ContainerConfig setStdinOpen(boolean stdinOpen) { - this.stdinOpen = stdinOpen; - return this; - } - - public boolean isStdInOnce() { - return stdInOnce; - } - - public ContainerConfig setStdInOnce(boolean stdInOnce) { - this.stdInOnce = stdInOnce; - return this; - } - - public long getMemoryLimit() { - return memoryLimit; - } - - public ContainerConfig setMemoryLimit(long memoryLimit) { - this.memoryLimit = memoryLimit; - return this; - } - - public long getMemorySwap() { - return memorySwap; - } - - public ContainerConfig setMemorySwap(long memorySwap) { - this.memorySwap = memorySwap; - return this; - } - - public int getCpuShares() { - return cpuShares; - } - - public ContainerConfig setCpuShares(int cpuShares) { - this.cpuShares = cpuShares; - return this; - } - - public boolean isAttachStdin() { - return attachStdin; - } - - public ContainerConfig setAttachStdin(boolean attachStdin) { - this.attachStdin = attachStdin; - return this; - } - - public boolean isAttachStdout() { - return attachStdout; - } - - public ContainerConfig setAttachStdout(boolean attachStdout) { - this.attachStdout = attachStdout; - return this; - } - - public boolean isAttachStderr() { - return attachStderr; - } - - public ContainerConfig setAttachStderr(boolean attachStderr) { - this.attachStderr = attachStderr; - return this; - } - - public String[] getEnv() { - return env; - } - - public ContainerConfig setEnv(String[] env) { - this.env = env; - return this; - } - - public String[] getCmd() { - return cmd; - } - - public ContainerConfig setCmd(String[] cmd) { - this.cmd = cmd; - return this; - } - - public String[] getDns() { - return dns; - } - - public ContainerConfig setDns(String[] dns) { - this.dns = dns; - return this; - } - - public String getImage() { - return image; - } - - public ContainerConfig setImage(String image) { - this.image = image; - return this; - } - - public Map getVolumes() { - return volumes; - } - - public ContainerConfig setVolumes(Map volumes) { - this.volumes = volumes; - return this; - } - - public String getVolumesFrom() { - return volumesFrom; - } - - public ContainerConfig setVolumesFrom(String volumesFrom) { - this.volumesFrom = volumesFrom; - return this; - } - - public String[] getEntrypoint() { - return entrypoint; - } - - public ContainerConfig setEntrypoint(String[] entrypoint) { - this.entrypoint = entrypoint; - return this; - } - - public void setOnBuild(int[] onBuild) { - this.onBuild = onBuild; - } - - public int[] getOnBuild() { - return onBuild; - } - - public void setDomainName(String domainName) { - this.domainName = domainName; - } - - - @Override - public String toString() { - return "ContainerConfig{" + - "hostName='" + hostName + '\'' + - ", portSpecs=" + Arrays.toString(portSpecs) + - ", user='" + user + '\'' + - ", tty=" + tty + - ", stdinOpen=" + stdinOpen + - ", stdInOnce=" + stdInOnce + - ", memoryLimit=" + memoryLimit + - ", memorySwap=" + memorySwap + - ", cpuShares=" + cpuShares + - ", attachStdin=" + attachStdin + - ", attachStdout=" + attachStdout + - ", attachStderr=" + attachStderr + - ", env=" + Arrays.toString(env) + - ", cmd=" + Arrays.toString(cmd) + - ", dns=" + Arrays.toString(dns) + - ", image='" + image + '\'' + - ", volumes=" + volumes + - ", volumesFrom='" + volumesFrom + '\'' + - ", entrypoint=" + Arrays.toString(entrypoint) + - ", networkDisabled=" + networkDisabled + - ", privileged=" + privileged + - ", workingDir='" + workingDir + '\'' + - ", domainName='" + domainName + '\'' + - ", onBuild='" + Arrays.toString(onBuild) + '\'' + - '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + + +import java.util.Arrays; +import java.util.Map; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ContainerConfig { + + @JsonProperty("Hostname") private String hostName = ""; + @JsonProperty("PortSpecs") private String[] portSpecs; + @JsonProperty("User") private String user = ""; + @JsonProperty("Tty") private boolean tty = false; + @JsonProperty("OpenStdin") private boolean stdinOpen = false; + @JsonProperty("StdinOnce") private boolean stdInOnce = false; + @JsonProperty("Memory") private long memoryLimit = 0; + @JsonProperty("MemorySwap") private long memorySwap = 0; + @JsonProperty("CpuShares") private int cpuShares = 0; + @JsonProperty("AttachStdin") private boolean attachStdin = false; + @JsonProperty("AttachStdout") private boolean attachStdout = false; + @JsonProperty("AttachStderr") private boolean attachStderr = false; + @JsonProperty("Env") private String[] env; + @JsonProperty("Cmd") private String[] cmd; + @JsonProperty("Dns") private String[] dns; + @JsonProperty("Image") private String image; + @JsonProperty("Volumes") private Map volumes; + @JsonProperty("VolumesFrom") private String volumesFrom = ""; + @JsonProperty("Entrypoint") private String[] entrypoint = new String[]{}; + @JsonProperty("NetworkDisabled") private boolean networkDisabled = false; + @JsonProperty("Privileged") private boolean privileged = false; + @JsonProperty("WorkingDir") private String workingDir = ""; + @JsonProperty("Domainname") private String domainName = ""; + @JsonProperty("ExposedPorts") private ExposedPorts exposedPorts; + + @JsonProperty("OnBuild") private int[] onBuild; + + @JsonIgnore + public ExposedPort[] getExposedPorts() { + return exposedPorts.getExposedPorts(); + } + + @JsonIgnore + public void setExposedPorts(ExposedPort[] exposedPorts) { + this.exposedPorts = new ExposedPorts(exposedPorts); + } + + public boolean isNetworkDisabled() { + return networkDisabled; + } + + public String getDomainName() { + return domainName; + } + + public String getWorkingDir() { return workingDir; } + + public ContainerConfig setWorkingDir(String workingDir) { + this.workingDir = workingDir; + return this; + } + + public boolean isPrivileged() { + return privileged; + } + + public ContainerConfig setPrivileged(boolean privileged) { + this.privileged = privileged; + return this; + } + + public String getHostName() { + return hostName; + } + + public ContainerConfig setNetworkDisabled(boolean networkDisabled) { + this.networkDisabled = networkDisabled; + return this; + } + + public ContainerConfig setHostName(String hostName) { + this.hostName = hostName; + return this; + } + + public String[] getPortSpecs() { + return portSpecs; + } + + public ContainerConfig setPortSpecs(String[] portSpecs) { + this.portSpecs = portSpecs; + return this; + } + + public String getUser() { + return user; + } + + public ContainerConfig setUser(String user) { + this.user = user; + return this; + } + + public boolean isTty() { + return tty; + } + + public ContainerConfig setTty(boolean tty) { + this.tty = tty; + return this; + } + + public boolean isStdinOpen() { + return stdinOpen; + } + + public ContainerConfig setStdinOpen(boolean stdinOpen) { + this.stdinOpen = stdinOpen; + return this; + } + + public boolean isStdInOnce() { + return stdInOnce; + } + + public ContainerConfig setStdInOnce(boolean stdInOnce) { + this.stdInOnce = stdInOnce; + return this; + } + + public long getMemoryLimit() { + return memoryLimit; + } + + public ContainerConfig setMemoryLimit(long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + public long getMemorySwap() { + return memorySwap; + } + + public ContainerConfig setMemorySwap(long memorySwap) { + this.memorySwap = memorySwap; + return this; + } + + public int getCpuShares() { + return cpuShares; + } + + public ContainerConfig setCpuShares(int cpuShares) { + this.cpuShares = cpuShares; + return this; + } + + public boolean isAttachStdin() { + return attachStdin; + } + + public ContainerConfig setAttachStdin(boolean attachStdin) { + this.attachStdin = attachStdin; + return this; + } + + public boolean isAttachStdout() { + return attachStdout; + } + + public ContainerConfig setAttachStdout(boolean attachStdout) { + this.attachStdout = attachStdout; + return this; + } + + public boolean isAttachStderr() { + return attachStderr; + } + + public ContainerConfig setAttachStderr(boolean attachStderr) { + this.attachStderr = attachStderr; + return this; + } + + public String[] getEnv() { + return env; + } + + public ContainerConfig setEnv(String[] env) { + this.env = env; + return this; + } + + public String[] getCmd() { + return cmd; + } + + public ContainerConfig setCmd(String[] cmd) { + this.cmd = cmd; + return this; + } + + public String[] getDns() { + return dns; + } + + public ContainerConfig setDns(String[] dns) { + this.dns = dns; + return this; + } + + public String getImage() { + return image; + } + + public ContainerConfig setImage(String image) { + this.image = image; + return this; + } + + public Map getVolumes() { + return volumes; + } + + public ContainerConfig setVolumes(Map volumes) { + this.volumes = volumes; + return this; + } + + public String getVolumesFrom() { + return volumesFrom; + } + + public ContainerConfig setVolumesFrom(String volumesFrom) { + this.volumesFrom = volumesFrom; + return this; + } + + public String[] getEntrypoint() { + return entrypoint; + } + + public ContainerConfig setEntrypoint(String[] entrypoint) { + this.entrypoint = entrypoint; + return this; + } + + public void setOnBuild(int[] onBuild) { + this.onBuild = onBuild; + } + + public int[] getOnBuild() { + return onBuild; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } + + + @Override + public String toString() { + return "ContainerConfig{" + + "hostName='" + hostName + '\'' + + ", portSpecs=" + Arrays.toString(portSpecs) + + ", user='" + user + '\'' + + ", tty=" + tty + + ", stdinOpen=" + stdinOpen + + ", stdInOnce=" + stdInOnce + + ", memoryLimit=" + memoryLimit + + ", memorySwap=" + memorySwap + + ", cpuShares=" + cpuShares + + ", attachStdin=" + attachStdin + + ", attachStdout=" + attachStdout + + ", attachStderr=" + attachStderr + + ", env=" + Arrays.toString(env) + + ", cmd=" + Arrays.toString(cmd) + + ", dns=" + Arrays.toString(dns) + + ", image='" + image + '\'' + + ", volumes=" + volumes + + ", volumesFrom='" + volumesFrom + '\'' + + ", entrypoint=" + Arrays.toString(entrypoint) + + ", networkDisabled=" + networkDisabled + + ", privileged=" + privileged + + ", workingDir='" + workingDir + '\'' + + ", domainName='" + domainName + '\'' + + ", onBuild='" + Arrays.toString(onBuild) + '\'' + + '}'; + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/ContainerCreateResponse.java b/src/main/java/com/github/dockerjava/client/model/ContainerCreateResponse.java index 4cd75b589..d912ecc19 100644 --- a/src/main/java/com/github/dockerjava/client/model/ContainerCreateResponse.java +++ b/src/main/java/com/github/dockerjava/client/model/ContainerCreateResponse.java @@ -1,45 +1,45 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.Arrays; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ContainerCreateResponse { - - @JsonProperty("Id") - private String id; - - @JsonProperty("Warnings") - private String[] warnings; - - public String getId() { - return id; - } - - public String[] getWarnings() { - return warnings; - } - - public void setId(String id) { - this.id = id; - } - - public void setWarnings(String[] warnings) { - this.warnings = warnings; - } - - @Override - public String toString() { - return "ContainerCreateResponse{" + - "id='" + id + '\'' + - ", warnings=" + Arrays.toString(warnings) + - '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Arrays; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ContainerCreateResponse { + + @JsonProperty("Id") + private String id; + + @JsonProperty("Warnings") + private String[] warnings; + + public String getId() { + return id; + } + + public String[] getWarnings() { + return warnings; + } + + public void setId(String id) { + this.id = id; + } + + public void setWarnings(String[] warnings) { + this.warnings = warnings; + } + + @Override + public String toString() { + return "ContainerCreateResponse{" + + "id='" + id + '\'' + + ", warnings=" + Arrays.toString(warnings) + + '}'; + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/ContainerInspectResponse.java b/src/main/java/com/github/dockerjava/client/model/ContainerInspectResponse.java index dd7a6a14c..2db41cdb4 100644 --- a/src/main/java/com/github/dockerjava/client/model/ContainerInspectResponse.java +++ b/src/main/java/com/github/dockerjava/client/model/ContainerInspectResponse.java @@ -1,343 +1,343 @@ -package com.github.dockerjava.client.model; - - -import java.util.Arrays; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ContainerInspectResponse { - - @JsonProperty("ID") - private String id; - - @JsonProperty("Created") - private String created; - - @JsonProperty("Path") - private String path; - - @JsonProperty("Args") - private String[] args; - - @JsonProperty("Config") - public ContainerConfig config; - - @JsonProperty("State") - private ContainerState state; - - @JsonProperty("Image") - private String imageId; - - @JsonProperty("NetworkSettings") - private NetworkSettings networkSettings; - - @JsonProperty("SysInitPath") - private String sysInitPath; - - @JsonProperty("ResolvConfPath") - private String resolvConfPath; - - @JsonProperty("Volumes") - private Map volumes; - - @JsonProperty("VolumesRW") - private Map volumesRW; - - @JsonProperty("HostnamePath") - private String hostnamePath; - - @JsonProperty("HostsPath") - private String hostsPath; - - @JsonProperty("Name") - private String name; - - @JsonProperty("Driver") - private String driver; - - @JsonProperty("HostConfig") - private HostConfig hostConfig; - - @JsonProperty("ExecDriver") - private String execDriver; - - @JsonProperty("MountLabel") - private String mountLabel; - - public String getId() { - return id; - } - - public String getCreated() { - return created; - } - - public String getPath() { - return path; - } - - public String[] getArgs() { - return args; - } - - public ContainerConfig getConfig() { - return config; - } - - public ContainerState getState() { - return state; - } - - public String getImageId() { - return imageId; - } - - public NetworkSettings getNetworkSettings() { - return networkSettings; - } - - public String getSysInitPath() { - return sysInitPath; - } - - public String getResolvConfPath() { - return resolvConfPath; - } - - public Map getVolumes() { - return volumes; - } - - public Map getVolumesRW() { - return volumesRW; - } - - public String getHostnamePath() { - return hostnamePath; - } - - public String getHostsPath() { - return hostsPath; - } - - public String getName() { - return name; - } - - public String getDriver() { - return driver; - } - - public HostConfig getHostConfig() { - return hostConfig; - } - - public String getExecDriver() { - return execDriver; - } - - public String getMountLabel() { - return mountLabel; - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public class NetworkSettings { - - @JsonProperty("IPAddress") private String ipAddress; - @JsonProperty("IPPrefixLen") private int ipPrefixLen; - @JsonProperty("Gateway") private String gateway; - @JsonProperty("Bridge") private String bridge; - @JsonProperty("PortMapping") private Map> portMapping; - @JsonProperty("Ports") private Ports ports; - - public String getIpAddress() { - return ipAddress; - } - - public int getIpPrefixLen() { - return ipPrefixLen; - } - - public String getGateway() { - return gateway; - } - - public String getBridge() { - return bridge; - } - - public Map> getPortMapping() { - return portMapping; - } - - public Ports getPorts() { - return ports; - } - - - @Override - public String toString() { - return "NetworkSettings{" + - "ports=" + ports + - ", portMapping=" + portMapping + - ", bridge='" + bridge + '\'' + - ", gateway='" + gateway + '\'' + - ", ipPrefixLen=" + ipPrefixLen + - ", ipAddress='" + ipAddress + '\'' + - '}'; - } - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public class ContainerState { - - @JsonProperty("Running") private boolean running; - @JsonProperty("Paused") private boolean paused; - @JsonProperty("Pid") private int pid; - @JsonProperty("ExitCode") private int exitCode; - @JsonProperty("StartedAt") private String startedAt; - @JsonProperty("FinishedAt") private String finishedAt; - - public boolean isRunning() { - return running; - } - - public boolean isPaused() { - return paused; - } - - public int getPid() { - return pid; - } - - public int getExitCode() { - return exitCode; - } - - public String getStartedAt() { - return startedAt; - } - - public String getFinishedAt() { - return finishedAt; - } - - @Override - public String toString() { - return "ContainerState{" + - "running=" + running + - ", paused=" + paused + - ", pid=" + pid + - ", exitCode=" + exitCode + - ", startedAt='" + startedAt + '\'' + - ", finishedAt='" + finishedAt + '\'' + - '}'; - } - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public class HostConfig { - - @JsonProperty("Binds") - private String[] binds; - - @JsonProperty("LxcConf") - private LxcConf[] lxcConf; - - @JsonProperty("PortBindings") - private Ports portBindings; - - @JsonProperty("PublishAllPorts") - private boolean publishAllPorts; - - @JsonProperty("Privileged") - private boolean privileged; - - @JsonProperty("Dns") - private String dns; - - @JsonProperty("VolumesFrom") - private String volumesFrom; - - @JsonProperty("ContainerIDFile") - private String containerIDFile; - - @JsonProperty("DnsSearch") - private String dnsSearch; - - @JsonProperty("Links") - private String[] links; - - @JsonProperty("NetworkMode") - private String networkMode; - - public String[] getBinds() { - return binds; - } - - public LxcConf[] getLxcConf() { - return lxcConf; - } - - public Ports getPortBindings() { - return portBindings; - } - - public boolean isPublishAllPorts() { - return publishAllPorts; - } - - public boolean isPrivileged() { - return privileged; - } - - public String getDns() { - return dns; - } - - public String getVolumesFrom() { - return volumesFrom; - } - - public String getContainerIDFile() { - return containerIDFile; - } - - public String getDnsSearch() { - return dnsSearch; - } - - public String[] getLinks() { - return links; - } - - public String getNetworkMode() { - return networkMode; - } - - @Override - public String toString() { - return "HostConfig{" + - "binds=" + Arrays.toString(binds) + - ", containerIDFile='" + containerIDFile + '\'' + - ", lxcConf=" + Arrays.toString(lxcConf) + - ", links=" + Arrays.toString(links) + - ", portBindings=" + portBindings + - ", privileged=" + privileged + - ", publishAllPorts=" + publishAllPorts + - ", networkMode=" + networkMode + - ", dns='" + dns + '\'' + - '}'; - } - - } - -} +package com.github.dockerjava.client.model; + + +import java.util.Arrays; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ContainerInspectResponse { + + @JsonProperty("ID") + private String id; + + @JsonProperty("Created") + private String created; + + @JsonProperty("Path") + private String path; + + @JsonProperty("Args") + private String[] args; + + @JsonProperty("Config") + public ContainerConfig config; + + @JsonProperty("State") + private ContainerState state; + + @JsonProperty("Image") + private String imageId; + + @JsonProperty("NetworkSettings") + private NetworkSettings networkSettings; + + @JsonProperty("SysInitPath") + private String sysInitPath; + + @JsonProperty("ResolvConfPath") + private String resolvConfPath; + + @JsonProperty("Volumes") + private Map volumes; + + @JsonProperty("VolumesRW") + private Map volumesRW; + + @JsonProperty("HostnamePath") + private String hostnamePath; + + @JsonProperty("HostsPath") + private String hostsPath; + + @JsonProperty("Name") + private String name; + + @JsonProperty("Driver") + private String driver; + + @JsonProperty("HostConfig") + private HostConfig hostConfig; + + @JsonProperty("ExecDriver") + private String execDriver; + + @JsonProperty("MountLabel") + private String mountLabel; + + public String getId() { + return id; + } + + public String getCreated() { + return created; + } + + public String getPath() { + return path; + } + + public String[] getArgs() { + return args; + } + + public ContainerConfig getConfig() { + return config; + } + + public ContainerState getState() { + return state; + } + + public String getImageId() { + return imageId; + } + + public NetworkSettings getNetworkSettings() { + return networkSettings; + } + + public String getSysInitPath() { + return sysInitPath; + } + + public String getResolvConfPath() { + return resolvConfPath; + } + + public Map getVolumes() { + return volumes; + } + + public Map getVolumesRW() { + return volumesRW; + } + + public String getHostnamePath() { + return hostnamePath; + } + + public String getHostsPath() { + return hostsPath; + } + + public String getName() { + return name; + } + + public String getDriver() { + return driver; + } + + public HostConfig getHostConfig() { + return hostConfig; + } + + public String getExecDriver() { + return execDriver; + } + + public String getMountLabel() { + return mountLabel; + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public class NetworkSettings { + + @JsonProperty("IPAddress") private String ipAddress; + @JsonProperty("IPPrefixLen") private int ipPrefixLen; + @JsonProperty("Gateway") private String gateway; + @JsonProperty("Bridge") private String bridge; + @JsonProperty("PortMapping") private Map> portMapping; + @JsonProperty("Ports") private Ports ports; + + public String getIpAddress() { + return ipAddress; + } + + public int getIpPrefixLen() { + return ipPrefixLen; + } + + public String getGateway() { + return gateway; + } + + public String getBridge() { + return bridge; + } + + public Map> getPortMapping() { + return portMapping; + } + + public Ports getPorts() { + return ports; + } + + + @Override + public String toString() { + return "NetworkSettings{" + + "ports=" + ports + + ", portMapping=" + portMapping + + ", bridge='" + bridge + '\'' + + ", gateway='" + gateway + '\'' + + ", ipPrefixLen=" + ipPrefixLen + + ", ipAddress='" + ipAddress + '\'' + + '}'; + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public class ContainerState { + + @JsonProperty("Running") private boolean running; + @JsonProperty("Paused") private boolean paused; + @JsonProperty("Pid") private int pid; + @JsonProperty("ExitCode") private int exitCode; + @JsonProperty("StartedAt") private String startedAt; + @JsonProperty("FinishedAt") private String finishedAt; + + public boolean isRunning() { + return running; + } + + public boolean isPaused() { + return paused; + } + + public int getPid() { + return pid; + } + + public int getExitCode() { + return exitCode; + } + + public String getStartedAt() { + return startedAt; + } + + public String getFinishedAt() { + return finishedAt; + } + + @Override + public String toString() { + return "ContainerState{" + + "running=" + running + + ", paused=" + paused + + ", pid=" + pid + + ", exitCode=" + exitCode + + ", startedAt='" + startedAt + '\'' + + ", finishedAt='" + finishedAt + '\'' + + '}'; + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public class HostConfig { + + @JsonProperty("Binds") + private String[] binds; + + @JsonProperty("LxcConf") + private LxcConf[] lxcConf; + + @JsonProperty("PortBindings") + private Ports portBindings; + + @JsonProperty("PublishAllPorts") + private boolean publishAllPorts; + + @JsonProperty("Privileged") + private boolean privileged; + + @JsonProperty("Dns") + private String dns; + + @JsonProperty("VolumesFrom") + private String volumesFrom; + + @JsonProperty("ContainerIDFile") + private String containerIDFile; + + @JsonProperty("DnsSearch") + private String dnsSearch; + + @JsonProperty("Links") + private String[] links; + + @JsonProperty("NetworkMode") + private String networkMode; + + public String[] getBinds() { + return binds; + } + + public LxcConf[] getLxcConf() { + return lxcConf; + } + + public Ports getPortBindings() { + return portBindings; + } + + public boolean isPublishAllPorts() { + return publishAllPorts; + } + + public boolean isPrivileged() { + return privileged; + } + + public String getDns() { + return dns; + } + + public String getVolumesFrom() { + return volumesFrom; + } + + public String getContainerIDFile() { + return containerIDFile; + } + + public String getDnsSearch() { + return dnsSearch; + } + + public String[] getLinks() { + return links; + } + + public String getNetworkMode() { + return networkMode; + } + + @Override + public String toString() { + return "HostConfig{" + + "binds=" + Arrays.toString(binds) + + ", containerIDFile='" + containerIDFile + '\'' + + ", lxcConf=" + Arrays.toString(lxcConf) + + ", links=" + Arrays.toString(links) + + ", portBindings=" + portBindings + + ", privileged=" + privileged + + ", publishAllPorts=" + publishAllPorts + + ", networkMode=" + networkMode + + ", dns='" + dns + '\'' + + '}'; + } + + } + +} diff --git a/src/main/java/com/github/dockerjava/client/model/ContainerTopResponse.java b/src/main/java/com/github/dockerjava/client/model/ContainerTopResponse.java index 6b43690a1..080bccc25 100644 --- a/src/main/java/com/github/dockerjava/client/model/ContainerTopResponse.java +++ b/src/main/java/com/github/dockerjava/client/model/ContainerTopResponse.java @@ -1,46 +1,46 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.Joiner; - -/** - * - * @author marcus - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ContainerTopResponse { - - @JsonProperty("Titles") - private String[] titles; - - @JsonProperty("Processes") - private String[][] processes; - - public String[] getTitles() { - return titles; - } - - public String[][] getProcesses() { - return processes; - } - - @Override - public String toString() { - Joiner joiner = Joiner.on("; ").skipNulls(); - - StringBuffer buffer = new StringBuffer(); - buffer.append("["); - for(String[] fields: processes) { - buffer.append("[" + joiner.join(fields) + "]"); - } - buffer.append("]"); - - return "ContainerTopResponse{" + - "titles=" + joiner.join(titles) + - ", processes=" + buffer.toString() + - '}'; - } - -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.Joiner; + +/** + * + * @author marcus + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ContainerTopResponse { + + @JsonProperty("Titles") + private String[] titles; + + @JsonProperty("Processes") + private String[][] processes; + + public String[] getTitles() { + return titles; + } + + public String[][] getProcesses() { + return processes; + } + + @Override + public String toString() { + Joiner joiner = Joiner.on("; ").skipNulls(); + + StringBuffer buffer = new StringBuffer(); + buffer.append("["); + for(String[] fields: processes) { + buffer.append("[" + joiner.join(fields) + "]"); + } + buffer.append("]"); + + return "ContainerTopResponse{" + + "titles=" + joiner.join(titles) + + ", processes=" + buffer.toString() + + '}'; + } + +} diff --git a/src/main/java/com/github/dockerjava/client/model/CreateContainerConfig.java b/src/main/java/com/github/dockerjava/client/model/CreateContainerConfig.java index 232d2782f..687161a17 100644 --- a/src/main/java/com/github/dockerjava/client/model/CreateContainerConfig.java +++ b/src/main/java/com/github/dockerjava/client/model/CreateContainerConfig.java @@ -1,274 +1,274 @@ -package com.github.dockerjava.client.model; - - -import java.util.Arrays; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - * "Hostname":"", - "User":"", - "Memory":0, - "MemorySwap":0, - "AttachStdin":false, - "AttachStdout":true, - "AttachStderr":true, - "PortSpecs":null, - "Tty":false, - "OpenStdin":false, - "StdinOnce":false, - "Env":null, - "Cmd":[ - "date" - ], - "Dns":null, - "Image":"base", - "Volumes":{ - "/tmp": {} - }, - "VolumesFrom":"", - "WorkingDir":"", - "DisableNetwork": false, - "ExposedPorts":{ - "22/tcp": {} - } - * - * - */ -public class CreateContainerConfig { - - @JsonProperty("Hostname") private String hostName = ""; - @JsonProperty("User") private String user = ""; - @JsonProperty("Memory") private long memoryLimit = 0; - @JsonProperty("MemorySwap") private long memorySwap = 0; - @JsonProperty("AttachStdin") private boolean attachStdin = false; - @JsonProperty("AttachStdout") private boolean attachStdout = false; - @JsonProperty("AttachStderr") private boolean attachStderr = false; - @JsonProperty("PortSpecs") private String[] portSpecs; - @JsonProperty("Tty") private boolean tty = false; - @JsonProperty("OpenStdin") private boolean stdinOpen = false; - @JsonProperty("StdinOnce") private boolean stdInOnce = false; - @JsonProperty("Env") private String[] env; - @JsonProperty("Cmd") private String[] cmd; - @JsonProperty("Dns") private String[] dns; - @JsonProperty("Image") private String image; - @JsonProperty("Volumes") private Map volumes; - @JsonProperty("VolumesFrom") private String volumesFrom = ""; - @JsonProperty("WorkingDir") private String workingDir = ""; - @JsonProperty("DisableNetwork") private boolean disableNetwork = false; - @JsonProperty("ExposedPorts") private ExposedPorts exposedPorts; - - public CreateContainerConfig withExposedPorts(ExposedPort[] exposedPorts) { - this.exposedPorts = new ExposedPorts(exposedPorts); - return this; - } - - @JsonIgnore - public ExposedPort[] getExposedPorts() { - return exposedPorts.getExposedPorts(); - } - - - public boolean isDisableNetwork() { - return disableNetwork; - } - - public String getWorkingDir() { return workingDir; } - - public CreateContainerConfig withWorkingDir(String workingDir) { - this.workingDir = workingDir; - return this; - } - - - public String getHostName() { - return hostName; - } - - public CreateContainerConfig withDisableNetwork(boolean disableNetwork) { - this.disableNetwork = disableNetwork; - return this; - } - - public CreateContainerConfig withHostName(String hostName) { - this.hostName = hostName; - return this; - } - - public String[] getPortSpecs() { - return portSpecs; - } - - public CreateContainerConfig withPortSpecs(String[] portSpecs) { - this.portSpecs = portSpecs; - return this; - } - - public String getUser() { - return user; - } - - public CreateContainerConfig withUser(String user) { - this.user = user; - return this; - } - - public boolean isTty() { - return tty; - } - - public CreateContainerConfig withTty(boolean tty) { - this.tty = tty; - return this; - } - - public boolean isStdinOpen() { - return stdinOpen; - } - - public CreateContainerConfig withStdinOpen(boolean stdinOpen) { - this.stdinOpen = stdinOpen; - return this; - } - - public boolean isStdInOnce() { - return stdInOnce; - } - - public CreateContainerConfig withStdInOnce(boolean stdInOnce) { - this.stdInOnce = stdInOnce; - return this; - } - - public long getMemoryLimit() { - return memoryLimit; - } - - public CreateContainerConfig withMemoryLimit(long memoryLimit) { - this.memoryLimit = memoryLimit; - return this; - } - - public long getMemorySwap() { - return memorySwap; - } - - public CreateContainerConfig withMemorySwap(long memorySwap) { - this.memorySwap = memorySwap; - return this; - } - - - public boolean isAttachStdin() { - return attachStdin; - } - - public CreateContainerConfig withAttachStdin(boolean attachStdin) { - this.attachStdin = attachStdin; - return this; - } - - public boolean isAttachStdout() { - return attachStdout; - } - - public CreateContainerConfig withAttachStdout(boolean attachStdout) { - this.attachStdout = attachStdout; - return this; - } - - public boolean isAttachStderr() { - return attachStderr; - } - - public CreateContainerConfig withAttachStderr(boolean attachStderr) { - this.attachStderr = attachStderr; - return this; - } - - public String[] getEnv() { - return env; - } - - public CreateContainerConfig withEnv(String[] env) { - this.env = env; - return this; - } - - public String[] getCmd() { - return cmd; - } - - public CreateContainerConfig withCmd(String[] cmd) { - this.cmd = cmd; - return this; - } - - public String[] getDns() { - return dns; - } - - public CreateContainerConfig withDns(String[] dns) { - this.dns = dns; - return this; - } - - public String getImage() { - return image; - } - - public CreateContainerConfig withImage(String image) { - this.image = image; - return this; - } - - public Map getVolumes() { - return volumes; - } - - public CreateContainerConfig withVolumes(Map volumes) { - this.volumes = volumes; - return this; - } - - public String getVolumesFrom() { - return volumesFrom; - } - - public CreateContainerConfig withVolumesFrom(String volumesFrom) { - this.volumesFrom = volumesFrom; - return this; - } - - @Override - public String toString() { - return "CreateContainerConfig{" + - "hostName='" + hostName + '\'' + - ", portSpecs=" + Arrays.toString(portSpecs) + - ", user='" + user + '\'' + - ", tty=" + tty + - ", stdinOpen=" + stdinOpen + - ", stdInOnce=" + stdInOnce + - ", memoryLimit=" + memoryLimit + - ", memorySwap=" + memorySwap + - ", attachStdin=" + attachStdin + - ", attachStdout=" + attachStdout + - ", attachStderr=" + attachStderr + - ", env=" + Arrays.toString(env) + - ", cmd=" + Arrays.toString(cmd) + - ", dns=" + Arrays.toString(dns) + - ", image='" + image + '\'' + - ", volumes=" + volumes + - ", volumesFrom='" + volumesFrom + '\'' + - ", disableNetwork=" + disableNetwork + - ", workingDir='" + workingDir + '\'' + - '}'; - } - - -} +package com.github.dockerjava.client.model; + + +import java.util.Arrays; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + * "Hostname":"", + "User":"", + "Memory":0, + "MemorySwap":0, + "AttachStdin":false, + "AttachStdout":true, + "AttachStderr":true, + "PortSpecs":null, + "Tty":false, + "OpenStdin":false, + "StdinOnce":false, + "Env":null, + "Cmd":[ + "date" + ], + "Dns":null, + "Image":"base", + "Volumes":{ + "/tmp": {} + }, + "VolumesFrom":"", + "WorkingDir":"", + "DisableNetwork": false, + "ExposedPorts":{ + "22/tcp": {} + } + * + * + */ +public class CreateContainerConfig { + + @JsonProperty("Hostname") private String hostName = ""; + @JsonProperty("User") private String user = ""; + @JsonProperty("Memory") private long memoryLimit = 0; + @JsonProperty("MemorySwap") private long memorySwap = 0; + @JsonProperty("AttachStdin") private boolean attachStdin = false; + @JsonProperty("AttachStdout") private boolean attachStdout = false; + @JsonProperty("AttachStderr") private boolean attachStderr = false; + @JsonProperty("PortSpecs") private String[] portSpecs; + @JsonProperty("Tty") private boolean tty = false; + @JsonProperty("OpenStdin") private boolean stdinOpen = false; + @JsonProperty("StdinOnce") private boolean stdInOnce = false; + @JsonProperty("Env") private String[] env; + @JsonProperty("Cmd") private String[] cmd; + @JsonProperty("Dns") private String[] dns; + @JsonProperty("Image") private String image; + @JsonProperty("Volumes") private Map volumes; + @JsonProperty("VolumesFrom") private String volumesFrom = ""; + @JsonProperty("WorkingDir") private String workingDir = ""; + @JsonProperty("DisableNetwork") private boolean disableNetwork = false; + @JsonProperty("ExposedPorts") private ExposedPorts exposedPorts; + + public CreateContainerConfig withExposedPorts(ExposedPort[] exposedPorts) { + this.exposedPorts = new ExposedPorts(exposedPorts); + return this; + } + + @JsonIgnore + public ExposedPort[] getExposedPorts() { + return exposedPorts.getExposedPorts(); + } + + + public boolean isDisableNetwork() { + return disableNetwork; + } + + public String getWorkingDir() { return workingDir; } + + public CreateContainerConfig withWorkingDir(String workingDir) { + this.workingDir = workingDir; + return this; + } + + + public String getHostName() { + return hostName; + } + + public CreateContainerConfig withDisableNetwork(boolean disableNetwork) { + this.disableNetwork = disableNetwork; + return this; + } + + public CreateContainerConfig withHostName(String hostName) { + this.hostName = hostName; + return this; + } + + public String[] getPortSpecs() { + return portSpecs; + } + + public CreateContainerConfig withPortSpecs(String[] portSpecs) { + this.portSpecs = portSpecs; + return this; + } + + public String getUser() { + return user; + } + + public CreateContainerConfig withUser(String user) { + this.user = user; + return this; + } + + public boolean isTty() { + return tty; + } + + public CreateContainerConfig withTty(boolean tty) { + this.tty = tty; + return this; + } + + public boolean isStdinOpen() { + return stdinOpen; + } + + public CreateContainerConfig withStdinOpen(boolean stdinOpen) { + this.stdinOpen = stdinOpen; + return this; + } + + public boolean isStdInOnce() { + return stdInOnce; + } + + public CreateContainerConfig withStdInOnce(boolean stdInOnce) { + this.stdInOnce = stdInOnce; + return this; + } + + public long getMemoryLimit() { + return memoryLimit; + } + + public CreateContainerConfig withMemoryLimit(long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + public long getMemorySwap() { + return memorySwap; + } + + public CreateContainerConfig withMemorySwap(long memorySwap) { + this.memorySwap = memorySwap; + return this; + } + + + public boolean isAttachStdin() { + return attachStdin; + } + + public CreateContainerConfig withAttachStdin(boolean attachStdin) { + this.attachStdin = attachStdin; + return this; + } + + public boolean isAttachStdout() { + return attachStdout; + } + + public CreateContainerConfig withAttachStdout(boolean attachStdout) { + this.attachStdout = attachStdout; + return this; + } + + public boolean isAttachStderr() { + return attachStderr; + } + + public CreateContainerConfig withAttachStderr(boolean attachStderr) { + this.attachStderr = attachStderr; + return this; + } + + public String[] getEnv() { + return env; + } + + public CreateContainerConfig withEnv(String[] env) { + this.env = env; + return this; + } + + public String[] getCmd() { + return cmd; + } + + public CreateContainerConfig withCmd(String[] cmd) { + this.cmd = cmd; + return this; + } + + public String[] getDns() { + return dns; + } + + public CreateContainerConfig withDns(String[] dns) { + this.dns = dns; + return this; + } + + public String getImage() { + return image; + } + + public CreateContainerConfig withImage(String image) { + this.image = image; + return this; + } + + public Map getVolumes() { + return volumes; + } + + public CreateContainerConfig withVolumes(Map volumes) { + this.volumes = volumes; + return this; + } + + public String getVolumesFrom() { + return volumesFrom; + } + + public CreateContainerConfig withVolumesFrom(String volumesFrom) { + this.volumesFrom = volumesFrom; + return this; + } + + @Override + public String toString() { + return "CreateContainerConfig{" + + "hostName='" + hostName + '\'' + + ", portSpecs=" + Arrays.toString(portSpecs) + + ", user='" + user + '\'' + + ", tty=" + tty + + ", stdinOpen=" + stdinOpen + + ", stdInOnce=" + stdInOnce + + ", memoryLimit=" + memoryLimit + + ", memorySwap=" + memorySwap + + ", attachStdin=" + attachStdin + + ", attachStdout=" + attachStdout + + ", attachStderr=" + attachStderr + + ", env=" + Arrays.toString(env) + + ", cmd=" + Arrays.toString(cmd) + + ", dns=" + Arrays.toString(dns) + + ", image='" + image + '\'' + + ", volumes=" + volumes + + ", volumesFrom='" + volumesFrom + '\'' + + ", disableNetwork=" + disableNetwork + + ", workingDir='" + workingDir + '\'' + + '}'; + } + + +} diff --git a/src/main/java/com/github/dockerjava/client/model/DriverStatus.java b/src/main/java/com/github/dockerjava/client/model/DriverStatus.java index c9794f02a..187e35d59 100644 --- a/src/main/java/com/github/dockerjava/client/model/DriverStatus.java +++ b/src/main/java/com/github/dockerjava/client/model/DriverStatus.java @@ -1,33 +1,33 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Created by ben on 12/12/13. - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class DriverStatus { - - @JsonProperty("Root Dir") - private String rootDir; - - @JsonProperty("Dirs") - private int dirs; - - public String getRootDir() { - return rootDir; - } - - public int getDirs() { - return dirs; - } - - @Override - public String toString() { - return "DriverStatus{" + - "rootDir='" + rootDir + '\'' + - ", dirs=" + dirs + - '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by ben on 12/12/13. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class DriverStatus { + + @JsonProperty("Root Dir") + private String rootDir; + + @JsonProperty("Dirs") + private int dirs; + + public String getRootDir() { + return rootDir; + } + + public int getDirs() { + return dirs; + } + + @Override + public String toString() { + return "DriverStatus{" + + "rootDir='" + rootDir + '\'' + + ", dirs=" + dirs + + '}'; + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/HostConfig.java b/src/main/java/com/github/dockerjava/client/model/HostConfig.java index d359689d1..be78c1bd8 100644 --- a/src/main/java/com/github/dockerjava/client/model/HostConfig.java +++ b/src/main/java/com/github/dockerjava/client/model/HostConfig.java @@ -1,67 +1,67 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - - -import java.util.Arrays; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class HostConfig { - - @JsonProperty("Binds") - public String[] binds; - - @JsonProperty("LxcConf") - public LxcConf[] lxcConf; - - @JsonProperty("PortBindings") - public Ports portBindings; - - @JsonProperty("PublishAllPorts") - public boolean publishAllPorts; - - @JsonProperty("Privileged") - public boolean privileged; - - @JsonProperty("Dns") - public String dns; - - @JsonProperty("VolumesFrom") - public String volumesFrom; - - @JsonProperty("ContainerIDFile") - public String containerIDFile; - - @JsonProperty("DnsSearch") - public String dnsSearch; - - @JsonProperty("Links") - public String[] links; - - @JsonProperty("NetworkMode") - public String networkMode; - - - - @Override - public String toString() { - return "HostConfig{" + - "binds=" + Arrays.toString(binds) + - ", containerIDFile='" + containerIDFile + '\'' + - ", lxcConf=" + Arrays.toString(lxcConf) + - ", links=" + Arrays.toString(links) + - ", portBindings=" + portBindings + - ", privileged=" + privileged + - ", publishAllPorts=" + publishAllPorts + - ", networkMode=" + networkMode + - ", dns='" + dns + '\'' + - '}'; - } - -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + + +import java.util.Arrays; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class HostConfig { + + @JsonProperty("Binds") + public String[] binds; + + @JsonProperty("LxcConf") + public LxcConf[] lxcConf; + + @JsonProperty("PortBindings") + public Ports portBindings; + + @JsonProperty("PublishAllPorts") + public boolean publishAllPorts; + + @JsonProperty("Privileged") + public boolean privileged; + + @JsonProperty("Dns") + public String dns; + + @JsonProperty("VolumesFrom") + public String volumesFrom; + + @JsonProperty("ContainerIDFile") + public String containerIDFile; + + @JsonProperty("DnsSearch") + public String dnsSearch; + + @JsonProperty("Links") + public String[] links; + + @JsonProperty("NetworkMode") + public String networkMode; + + + + @Override + public String toString() { + return "HostConfig{" + + "binds=" + Arrays.toString(binds) + + ", containerIDFile='" + containerIDFile + '\'' + + ", lxcConf=" + Arrays.toString(lxcConf) + + ", links=" + Arrays.toString(links) + + ", portBindings=" + portBindings + + ", privileged=" + privileged + + ", publishAllPorts=" + publishAllPorts + + ", networkMode=" + networkMode + + ", dns='" + dns + '\'' + + '}'; + } + +} diff --git a/src/main/java/com/github/dockerjava/client/model/Image.java b/src/main/java/com/github/dockerjava/client/model/Image.java index 5472c3e2a..33d81a217 100644 --- a/src/main/java/com/github/dockerjava/client/model/Image.java +++ b/src/main/java/com/github/dockerjava/client/model/Image.java @@ -1,118 +1,118 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.Arrays; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class Image { - - @JsonProperty("Id") - private String id; - - @JsonProperty("RepoTags") - private String[] repoTags; - - @JsonProperty("Repository") - private String repository; - - @JsonProperty("Tag") - private String tag; - - - @JsonProperty("ParentId") - private String parentId; - - @JsonProperty("Created") - private long created; - - @JsonProperty("Size") - private long size; - - @JsonProperty("VirtualSize") - private long virtualSize; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String[] getRepoTags() { - return repoTags; - } - - public void setRepoTags(String[] repoTags) { - this.repoTags = repoTags; - } - - public String getRepository() { - return repository; - } - - public void setRepository(String repository) { - this.repository = repository; - } - - public String getTag() { - return tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public long getCreated() { - return created; - } - - public void setCreated(long created) { - this.created = created; - } - - public long getSize() { - return size; - } - - public void setSize(long size) { - this.size = size; - } - - public long getVirtualSize() { - return virtualSize; - } - - public void setVirtualSize(long virtualSize) { - this.virtualSize = virtualSize; - } - - @Override - public String toString() { - return "Image{" + - "virtualSize=" + virtualSize + - ", id='" + id + '\'' + - ", repoTags=" + Arrays.toString(repoTags) + - ", repository='" + repository + '\'' + - ", tag='" + tag + '\'' + - ", parentId='" + parentId + '\'' + - ", created=" + created + - ", size=" + size + - '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Arrays; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class Image { + + @JsonProperty("Id") + private String id; + + @JsonProperty("RepoTags") + private String[] repoTags; + + @JsonProperty("Repository") + private String repository; + + @JsonProperty("Tag") + private String tag; + + + @JsonProperty("ParentId") + private String parentId; + + @JsonProperty("Created") + private long created; + + @JsonProperty("Size") + private long size; + + @JsonProperty("VirtualSize") + private long virtualSize; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String[] getRepoTags() { + return repoTags; + } + + public void setRepoTags(String[] repoTags) { + this.repoTags = repoTags; + } + + public String getRepository() { + return repository; + } + + public void setRepository(String repository) { + this.repository = repository; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public long getCreated() { + return created; + } + + public void setCreated(long created) { + this.created = created; + } + + public long getSize() { + return size; + } + + public void setSize(long size) { + this.size = size; + } + + public long getVirtualSize() { + return virtualSize; + } + + public void setVirtualSize(long virtualSize) { + this.virtualSize = virtualSize; + } + + @Override + public String toString() { + return "Image{" + + "virtualSize=" + virtualSize + + ", id='" + id + '\'' + + ", repoTags=" + Arrays.toString(repoTags) + + ", repository='" + repository + '\'' + + ", tag='" + tag + '\'' + + ", parentId='" + parentId + '\'' + + ", created=" + created + + ", size=" + size + + '}'; + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/ImageCreateResponse.java b/src/main/java/com/github/dockerjava/client/model/ImageCreateResponse.java index 05cc00b9d..d23aff500 100644 --- a/src/main/java/com/github/dockerjava/client/model/ImageCreateResponse.java +++ b/src/main/java/com/github/dockerjava/client/model/ImageCreateResponse.java @@ -1,30 +1,30 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Parse reponses from /images/create - * - * @author Ryan Campbell (ryan.campbell@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ImageCreateResponse { - - @JsonProperty("status") - private String id; - - - public String getId() { - return id; - } - - - @Override - public String toString() { - return "ContainerCreateResponse{" + - "id='" + id + '\'' + - '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parse reponses from /images/create + * + * @author Ryan Campbell (ryan.campbell@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ImageCreateResponse { + + @JsonProperty("status") + private String id; + + + public String getId() { + return id; + } + + + @Override + public String toString() { + return "ContainerCreateResponse{" + + "id='" + id + '\'' + + '}'; + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/ImageInspectResponse.java b/src/main/java/com/github/dockerjava/client/model/ImageInspectResponse.java index 31bd46b1e..b927eb607 100644 --- a/src/main/java/com/github/dockerjava/client/model/ImageInspectResponse.java +++ b/src/main/java/com/github/dockerjava/client/model/ImageInspectResponse.java @@ -1,152 +1,152 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ImageInspectResponse { - - @JsonProperty("id") - private String id; - - @JsonProperty("parent") private String parent; - - @JsonProperty("created") private String created; - - @JsonProperty("container") private String container; - - @JsonProperty("container_config") private ContainerConfig containerConfig; - - @JsonProperty("Size") private long size; - - @JsonProperty("docker_version") private String dockerVersion; - - @JsonProperty("config") private ContainerConfig config; - - @JsonProperty("architecture") private String arch; - - @JsonProperty("comment") private String comment; - - @JsonProperty("author") private String author; - - @JsonProperty("os") private String os; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getParent() { - return parent; - } - - public void setParent(String parent) { - this.parent = parent; - } - - public String getCreated() { - return created; - } - - public void setCreated(String created) { - this.created = created; - } - - public String getContainer() { - return container; - } - - public void setContainer(String container) { - this.container = container; - } - - public ContainerConfig getContainerConfig() { - return containerConfig; - } - - public void setContainerConfig(ContainerConfig containerConfig) { - this.containerConfig = containerConfig; - } - - public long getSize() { - return size; - } - - public void setSize(long size) { - this.size = size; - } - - public String getDockerVersion() { - return dockerVersion; - } - - public void setDockerVersion(String dockerVersion) { - this.dockerVersion = dockerVersion; - } - - public ContainerConfig getConfig() { - return config; - } - - public void setConfig(ContainerConfig config) { - this.config = config; - } - - public String getArch() { - return arch; - } - - public void setArch(String arch) { - this.arch = arch; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getOs() { - return os; - } - - public void setOs(String os) { - this.os = os; - } - - @Override - public String toString() { - return "ImageInspectResponse{" + - "id='" + id + '\'' + - ", parent='" + parent + '\'' + - ", created='" + created + '\'' + - ", container='" + container + '\'' + - ", containerConfig=" + containerConfig + - ", size=" + size + - ", dockerVersion='" + dockerVersion + '\'' + - ", config=" + config + - ", arch='" + arch + '\'' + - ", comment='" + comment + '\'' + - ", author='" + author + '\'' + - ", os='" + os + '\'' + - '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ImageInspectResponse { + + @JsonProperty("id") + private String id; + + @JsonProperty("parent") private String parent; + + @JsonProperty("created") private String created; + + @JsonProperty("container") private String container; + + @JsonProperty("container_config") private ContainerConfig containerConfig; + + @JsonProperty("Size") private long size; + + @JsonProperty("docker_version") private String dockerVersion; + + @JsonProperty("config") private ContainerConfig config; + + @JsonProperty("architecture") private String arch; + + @JsonProperty("comment") private String comment; + + @JsonProperty("author") private String author; + + @JsonProperty("os") private String os; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getParent() { + return parent; + } + + public void setParent(String parent) { + this.parent = parent; + } + + public String getCreated() { + return created; + } + + public void setCreated(String created) { + this.created = created; + } + + public String getContainer() { + return container; + } + + public void setContainer(String container) { + this.container = container; + } + + public ContainerConfig getContainerConfig() { + return containerConfig; + } + + public void setContainerConfig(ContainerConfig containerConfig) { + this.containerConfig = containerConfig; + } + + public long getSize() { + return size; + } + + public void setSize(long size) { + this.size = size; + } + + public String getDockerVersion() { + return dockerVersion; + } + + public void setDockerVersion(String dockerVersion) { + this.dockerVersion = dockerVersion; + } + + public ContainerConfig getConfig() { + return config; + } + + public void setConfig(ContainerConfig config) { + this.config = config; + } + + public String getArch() { + return arch; + } + + public void setArch(String arch) { + this.arch = arch; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getOs() { + return os; + } + + public void setOs(String os) { + this.os = os; + } + + @Override + public String toString() { + return "ImageInspectResponse{" + + "id='" + id + '\'' + + ", parent='" + parent + '\'' + + ", created='" + created + '\'' + + ", container='" + container + '\'' + + ", containerConfig=" + containerConfig + + ", size=" + size + + ", dockerVersion='" + dockerVersion + '\'' + + ", config=" + config + + ", arch='" + arch + '\'' + + ", comment='" + comment + '\'' + + ", author='" + author + '\'' + + ", os='" + os + '\'' + + '}'; + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/Info.java b/src/main/java/com/github/dockerjava/client/model/Info.java index b26531f1a..ddbc85fa7 100644 --- a/src/main/java/com/github/dockerjava/client/model/Info.java +++ b/src/main/java/com/github/dockerjava/client/model/Info.java @@ -1,230 +1,230 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -import java.util.List; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) -@JsonInclude(Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Info { - - @JsonProperty("Debug") - private boolean debug; - - @JsonProperty("Containers") - private int containers; - - @JsonProperty("Driver") - private String driver; - - @JsonProperty("DriverStatus") - private List driverStatuses; - - - @JsonProperty("Images") - private int images; - - @JsonProperty("IPv4Forwarding") - private String IPv4Forwarding; - - @JsonProperty("IndexServerAddress") - private String IndexServerAddress; - - - @JsonProperty("InitPath") - private String initPath; - - @JsonProperty("InitSha1") - private String initSha1; - - @JsonProperty("KernelVersion") - private String kernelVersion; - - @JsonProperty("LXCVersion") - private String lxcVersion; - - @JsonProperty("MemoryLimit") - private boolean memoryLimit; - - @JsonProperty("NEventsListener") - private long nEventListener; - - @JsonProperty("NFd") - private int NFd; - - @JsonProperty("NGoroutines") - private int NGoroutines; - - @JsonProperty("SwapLimit") - private int swapLimit; - - @JsonProperty("ExecutionDriver") - private String executionDriver; - - public boolean isDebug() { - return debug; - } - - public void setDebug(boolean debug) { - this.debug = debug; - } - - public int getContainers() { - return containers; - } - - public void setContainers(int containers) { - this.containers = containers; - } - - public String getDriver() { - return driver; - } - - public void setDriver(String driver) { - this.driver = driver; - } - - public List getDriverStatuses() { - return driverStatuses; - } - - public void setDriverStatuses(List driverStatuses) { - this.driverStatuses = driverStatuses; - } - - public int getImages() { - return images; - } - - public void setImages(int images) { - this.images = images; - } - - public String getIPv4Forwarding() { - return IPv4Forwarding; - } - - public void setIPv4Forwarding(String IPv4Forwarding) { - this.IPv4Forwarding = IPv4Forwarding; - } - - public String getIndexServerAddress() { - return IndexServerAddress; - } - - public void setIndexServerAddress(String indexServerAddress) { - IndexServerAddress = indexServerAddress; - } - - public String getInitPath() { - return initPath; - } - - public void setInitPath(String initPath) { - this.initPath = initPath; - } - - public String getInitSha1() { - return initSha1; - } - - public void setInitSha1(String initSha1) { - this.initSha1 = initSha1; - } - - public String getKernelVersion() { - return kernelVersion; - } - - public void setKernelVersion(String kernelVersion) { - this.kernelVersion = kernelVersion; - } - - public String getLxcVersion() { - return lxcVersion; - } - - public void setLxcVersion(String lxcVersion) { - this.lxcVersion = lxcVersion; - } - - public boolean isMemoryLimit() { - return memoryLimit; - } - - public void setMemoryLimit(boolean memoryLimit) { - this.memoryLimit = memoryLimit; - } - - public long getnEventListener() { - return nEventListener; - } - - public void setnEventListener(long nEventListener) { - this.nEventListener = nEventListener; - } - - public int getNFd() { - return NFd; - } - - public void setNFd(int NFd) { - this.NFd = NFd; - } - - public int getNGoroutines() { - return NGoroutines; - } - - public void setNGoroutines(int NGoroutines) { - this.NGoroutines = NGoroutines; - } - - public int getSwapLimit() { - return swapLimit; - } - - public void setSwapLimit(int swapLimit) { - this.swapLimit = swapLimit; - } - public String getExecutionDriver() { - return executionDriver; - } - - public void setExecutionDriver(String executionDriver) { - this.executionDriver=executionDriver; - } - - @Override - public String toString() { - return "Info{" + - "debug=" + debug + - ", containers=" + containers + - ", driver='" + driver + '\'' + - ", driverStatuses=" + driverStatuses + - ", images=" + images + - ", IPv4Forwarding='" + IPv4Forwarding + '\'' + - ", IndexServerAddress='" + IndexServerAddress + '\'' + - ", initPath='" + initPath + '\'' + - ", initSha1='" + initSha1 + '\'' + - ", kernelVersion='" + kernelVersion + '\'' + - ", lxcVersion='" + lxcVersion + '\'' + - ", memoryLimit=" + memoryLimit + - ", nEventListener=" + nEventListener + - ", NFd=" + NFd + - ", NGoroutines=" + NGoroutines + - ", swapLimit=" + swapLimit + - '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import java.util.List; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Info { + + @JsonProperty("Debug") + private boolean debug; + + @JsonProperty("Containers") + private int containers; + + @JsonProperty("Driver") + private String driver; + + @JsonProperty("DriverStatus") + private List driverStatuses; + + + @JsonProperty("Images") + private int images; + + @JsonProperty("IPv4Forwarding") + private String IPv4Forwarding; + + @JsonProperty("IndexServerAddress") + private String IndexServerAddress; + + + @JsonProperty("InitPath") + private String initPath; + + @JsonProperty("InitSha1") + private String initSha1; + + @JsonProperty("KernelVersion") + private String kernelVersion; + + @JsonProperty("LXCVersion") + private String lxcVersion; + + @JsonProperty("MemoryLimit") + private boolean memoryLimit; + + @JsonProperty("NEventsListener") + private long nEventListener; + + @JsonProperty("NFd") + private int NFd; + + @JsonProperty("NGoroutines") + private int NGoroutines; + + @JsonProperty("SwapLimit") + private int swapLimit; + + @JsonProperty("ExecutionDriver") + private String executionDriver; + + public boolean isDebug() { + return debug; + } + + public void setDebug(boolean debug) { + this.debug = debug; + } + + public int getContainers() { + return containers; + } + + public void setContainers(int containers) { + this.containers = containers; + } + + public String getDriver() { + return driver; + } + + public void setDriver(String driver) { + this.driver = driver; + } + + public List getDriverStatuses() { + return driverStatuses; + } + + public void setDriverStatuses(List driverStatuses) { + this.driverStatuses = driverStatuses; + } + + public int getImages() { + return images; + } + + public void setImages(int images) { + this.images = images; + } + + public String getIPv4Forwarding() { + return IPv4Forwarding; + } + + public void setIPv4Forwarding(String IPv4Forwarding) { + this.IPv4Forwarding = IPv4Forwarding; + } + + public String getIndexServerAddress() { + return IndexServerAddress; + } + + public void setIndexServerAddress(String indexServerAddress) { + IndexServerAddress = indexServerAddress; + } + + public String getInitPath() { + return initPath; + } + + public void setInitPath(String initPath) { + this.initPath = initPath; + } + + public String getInitSha1() { + return initSha1; + } + + public void setInitSha1(String initSha1) { + this.initSha1 = initSha1; + } + + public String getKernelVersion() { + return kernelVersion; + } + + public void setKernelVersion(String kernelVersion) { + this.kernelVersion = kernelVersion; + } + + public String getLxcVersion() { + return lxcVersion; + } + + public void setLxcVersion(String lxcVersion) { + this.lxcVersion = lxcVersion; + } + + public boolean isMemoryLimit() { + return memoryLimit; + } + + public void setMemoryLimit(boolean memoryLimit) { + this.memoryLimit = memoryLimit; + } + + public long getnEventListener() { + return nEventListener; + } + + public void setnEventListener(long nEventListener) { + this.nEventListener = nEventListener; + } + + public int getNFd() { + return NFd; + } + + public void setNFd(int NFd) { + this.NFd = NFd; + } + + public int getNGoroutines() { + return NGoroutines; + } + + public void setNGoroutines(int NGoroutines) { + this.NGoroutines = NGoroutines; + } + + public int getSwapLimit() { + return swapLimit; + } + + public void setSwapLimit(int swapLimit) { + this.swapLimit = swapLimit; + } + public String getExecutionDriver() { + return executionDriver; + } + + public void setExecutionDriver(String executionDriver) { + this.executionDriver=executionDriver; + } + + @Override + public String toString() { + return "Info{" + + "debug=" + debug + + ", containers=" + containers + + ", driver='" + driver + '\'' + + ", driverStatuses=" + driverStatuses + + ", images=" + images + + ", IPv4Forwarding='" + IPv4Forwarding + '\'' + + ", IndexServerAddress='" + IndexServerAddress + '\'' + + ", initPath='" + initPath + '\'' + + ", initSha1='" + initSha1 + '\'' + + ", kernelVersion='" + kernelVersion + '\'' + + ", lxcVersion='" + lxcVersion + '\'' + + ", memoryLimit=" + memoryLimit + + ", nEventListener=" + nEventListener + + ", NFd=" + NFd + + ", NGoroutines=" + NGoroutines + + ", swapLimit=" + swapLimit + + '}'; + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/SearchItem.java b/src/main/java/com/github/dockerjava/client/model/SearchItem.java index e98a151b2..76dadab32 100644 --- a/src/main/java/com/github/dockerjava/client/model/SearchItem.java +++ b/src/main/java/com/github/dockerjava/client/model/SearchItem.java @@ -1,54 +1,54 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class SearchItem { - - @JsonProperty("star_count") - private int starCount; - - @JsonProperty("is_official") - private boolean isOfficial; - - @JsonProperty("is_trusted") - private boolean isTrusted; - - @JsonProperty("name") - private String name; - - @JsonProperty("description") - private String description; - - public int getStarCount() { - return starCount; - } - - public boolean isOfficial() { - return isOfficial; - } - - public boolean isTrusted() { - return isTrusted; - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - @Override - public String toString() { - return "name='" + name + '\'' + - ", description='" + description + '\'' + '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class SearchItem { + + @JsonProperty("star_count") + private int starCount; + + @JsonProperty("is_official") + private boolean isOfficial; + + @JsonProperty("is_trusted") + private boolean isTrusted; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + public int getStarCount() { + return starCount; + } + + public boolean isOfficial() { + return isOfficial; + } + + public boolean isTrusted() { + return isTrusted; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + @Override + public String toString() { + return "name='" + name + '\'' + + ", description='" + description + '\'' + '}'; + } +} diff --git a/src/main/java/com/github/dockerjava/client/model/StartContainerConfig.java b/src/main/java/com/github/dockerjava/client/model/StartContainerConfig.java index b04d13315..db5f859d1 100644 --- a/src/main/java/com/github/dockerjava/client/model/StartContainerConfig.java +++ b/src/main/java/com/github/dockerjava/client/model/StartContainerConfig.java @@ -1,50 +1,50 @@ -package com.github.dockerjava.client.model; - -import java.util.Arrays; - -import com.fasterxml.jackson.annotation.JsonProperty; - - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -public class StartContainerConfig { - - @JsonProperty("Binds") - public String[] binds; - - @JsonProperty("LxcConf") - public LxcConf[] lxcConf; - - @JsonProperty("PortBindings") - public Ports portBindings; - - @JsonProperty("PublishAllPorts") - public boolean publishAllPorts; - - @JsonProperty("Privileged") - public boolean privileged; - - @JsonProperty("Dns") - public String dns; - - @JsonProperty("VolumesFrom") - public String volumesFrom; - - @Override - public String toString() { - return "StartContainerConfig{" + - "binds=" + Arrays.toString(binds) + - ", lxcConf=" + Arrays.toString(lxcConf) + - ", portBindings=" + portBindings + - ", privileged=" + privileged + - ", publishAllPorts=" + publishAllPorts + - ", dns='" + dns + '\'' + - '}'; - } - - - -} +package com.github.dockerjava.client.model; + +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +public class StartContainerConfig { + + @JsonProperty("Binds") + public String[] binds; + + @JsonProperty("LxcConf") + public LxcConf[] lxcConf; + + @JsonProperty("PortBindings") + public Ports portBindings; + + @JsonProperty("PublishAllPorts") + public boolean publishAllPorts; + + @JsonProperty("Privileged") + public boolean privileged; + + @JsonProperty("Dns") + public String dns; + + @JsonProperty("VolumesFrom") + public String volumesFrom; + + @Override + public String toString() { + return "StartContainerConfig{" + + "binds=" + Arrays.toString(binds) + + ", lxcConf=" + Arrays.toString(lxcConf) + + ", portBindings=" + portBindings + + ", privileged=" + privileged + + ", publishAllPorts=" + publishAllPorts + + ", dns='" + dns + '\'' + + '}'; + } + + + +} diff --git a/src/main/java/com/github/dockerjava/client/model/Version.java b/src/main/java/com/github/dockerjava/client/model/Version.java index 35843ca45..ff6af729a 100644 --- a/src/main/java/com/github/dockerjava/client/model/Version.java +++ b/src/main/java/com/github/dockerjava/client/model/Version.java @@ -1,103 +1,103 @@ -package com.github.dockerjava.client.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * - * @author Konstantin Pelykh (kpelykh@gmail.com) - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class Version { - - @JsonProperty("Version") - private String version; - - @JsonProperty("GitCommit") - private String gitCommit; - - @JsonProperty("GoVersion") - private String goVersion; - - @JsonProperty("KernelVersion") - private String kernelVersion; - - @JsonProperty("Arch") - private String arch; - - @JsonProperty("Os") - private String operatingSystem; - - @JsonProperty("ApiVersion") - private String apiVersion; - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getGitCommit() { - return gitCommit; - } - - public void setGitCommit(String gitCommit) { - this.gitCommit = gitCommit; - } - - public String getGoVersion() { - return goVersion; - } - - public void setGoVersion(String goVersion) { - this.goVersion = goVersion; - } - - public String getKernelVersion() { - return kernelVersion; - } - - public void setKernelVersion(String kernelVersion) { - this.kernelVersion = kernelVersion; - } - - public String getArch() { - return arch; - } - - public void setArch(String arch) { - this.arch = arch; - } - - public String getOperatingSystem() { - return operatingSystem; - } - - public void setOperatingSystem(String operatingSystem) { - this.operatingSystem = operatingSystem; - } - - public void setApiVersion(String apiVersion) { - this.apiVersion = apiVersion; - } - - public String getApiVersion() { - return apiVersion; - } - - @Override - public String toString() { - return "Version{" + - "version='" + version + '\'' + - ", gitCommit='" + gitCommit + '\'' + - ", goVersion='" + goVersion + '\'' + - ", kernelVersion='" + kernelVersion + '\'' + - ", arch='" + arch + '\'' + - ", operatingSystem='" + operatingSystem + '\'' + - ", apiVersion='" + apiVersion + '\'' + - '}'; - } -} +package com.github.dockerjava.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * + * @author Konstantin Pelykh (kpelykh@gmail.com) + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class Version { + + @JsonProperty("Version") + private String version; + + @JsonProperty("GitCommit") + private String gitCommit; + + @JsonProperty("GoVersion") + private String goVersion; + + @JsonProperty("KernelVersion") + private String kernelVersion; + + @JsonProperty("Arch") + private String arch; + + @JsonProperty("Os") + private String operatingSystem; + + @JsonProperty("ApiVersion") + private String apiVersion; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getGitCommit() { + return gitCommit; + } + + public void setGitCommit(String gitCommit) { + this.gitCommit = gitCommit; + } + + public String getGoVersion() { + return goVersion; + } + + public void setGoVersion(String goVersion) { + this.goVersion = goVersion; + } + + public String getKernelVersion() { + return kernelVersion; + } + + public void setKernelVersion(String kernelVersion) { + this.kernelVersion = kernelVersion; + } + + public String getArch() { + return arch; + } + + public void setArch(String arch) { + this.arch = arch; + } + + public String getOperatingSystem() { + return operatingSystem; + } + + public void setOperatingSystem(String operatingSystem) { + this.operatingSystem = operatingSystem; + } + + public void setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + } + + public String getApiVersion() { + return apiVersion; + } + + @Override + public String toString() { + return "Version{" + + "version='" + version + '\'' + + ", gitCommit='" + gitCommit + '\'' + + ", goVersion='" + goVersion + '\'' + + ", kernelVersion='" + kernelVersion + '\'' + + ", arch='" + arch + '\'' + + ", operatingSystem='" + operatingSystem + '\'' + + ", apiVersion='" + apiVersion + '\'' + + '}'; + } +} diff --git a/src/main/resources/docker.io.properties b/src/main/resources/docker.io.properties index 0ce162bdf..b154e8762 100644 --- a/src/main/resources/docker.io.properties +++ b/src/main/resources/docker.io.properties @@ -1,2 +1,2 @@ -docker.io.url=http://localhost:4243 +docker.io.url=http://localhost:2375 docker.io.version=1.11 \ No newline at end of file diff --git a/src/test/java/com/github/dockerjava/client/command/BuildImageCmdTest.java b/src/test/java/com/github/dockerjava/client/command/BuildImageCmdTest.java index e86ab2fd3..b5983c918 100644 --- a/src/test/java/com/github/dockerjava/client/command/BuildImageCmdTest.java +++ b/src/test/java/com/github/dockerjava/client/command/BuildImageCmdTest.java @@ -198,6 +198,7 @@ public void testNetCatDockerfileBuilder() throws DockerException, ImageInspectResponse imageInspectResponse = dockerClient .inspectImageCmd(imageId).exec(); assertThat(imageInspectResponse, not(nullValue())); + assertThat(imageInspectResponse.getId(), not(nullValue())); LOG.info("Image Inspect: {}", imageInspectResponse.toString()); tmpImgs.add(imageInspectResponse.getId());