Created
August 17, 2014 19:26
-
-
Save dflemstr/f42a90516f881db338ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package name.dflemstr.vessel.docker; | |
import java.io.InputStream; | |
import java.net.URI; | |
import java.util.List; | |
import java.util.Map; | |
import javax.ws.rs.Consumes; | |
import javax.ws.rs.DELETE; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.HeaderParam; | |
import javax.ws.rs.POST; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.PathParam; | |
import javax.ws.rs.Produces; | |
import javax.ws.rs.QueryParam; | |
import javax.ws.rs.core.MediaType; | |
import name.dflemstr.vessel.docker.message.AuthConfig; | |
import name.dflemstr.vessel.docker.message.BuildResult; | |
import name.dflemstr.vessel.docker.message.Container; | |
import name.dflemstr.vessel.docker.message.ContainerChanges; | |
import name.dflemstr.vessel.docker.message.ContainerConfig; | |
import name.dflemstr.vessel.docker.message.ContainerSummary; | |
import name.dflemstr.vessel.docker.message.ContainerTop; | |
import name.dflemstr.vessel.docker.message.CopyContainerConfig; | |
import name.dflemstr.vessel.docker.message.CreateContainerResult; | |
import name.dflemstr.vessel.docker.message.DockerEvent; | |
import name.dflemstr.vessel.docker.message.DockerImage; | |
import name.dflemstr.vessel.docker.message.DockerProgress; | |
import name.dflemstr.vessel.docker.message.ImageDeleteResult; | |
import name.dflemstr.vessel.docker.message.ImageHistory; | |
import name.dflemstr.vessel.docker.message.ImageSearchResult; | |
import name.dflemstr.vessel.docker.message.Info; | |
import name.dflemstr.vessel.docker.message.RegistryConfigFile; | |
import name.dflemstr.vessel.docker.message.StartContainerConfig; | |
import name.dflemstr.vessel.docker.message.Version; | |
import name.dflemstr.vessel.docker.message.WaitContainerResult; | |
public interface Docker { | |
@GET | |
@Path("/containers/json") | |
@Produces(MediaType.APPLICATION_JSON) | |
public List<ContainerSummary> getContainers( | |
@QueryParam("all") Boolean all, | |
@QueryParam("limit") Integer limit, | |
@QueryParam("since") String since, | |
@QueryParam("before") String before, | |
@QueryParam("size") Boolean size); | |
@POST | |
@Path("/containers/create") | |
@Consumes(MediaType.APPLICATION_JSON) | |
@Produces(MediaType.APPLICATION_JSON) | |
public CreateContainerResult createContainer( | |
ContainerConfig config, | |
@QueryParam("name") String name); | |
@GET | |
@Path("/containers/{id}/json") | |
@Produces(MediaType.APPLICATION_JSON) | |
public Container getContainer( | |
@PathParam("id") String id); | |
@GET | |
@Path("/containers/{id}/top") | |
@Produces(MediaType.APPLICATION_JSON) | |
public ContainerTop getContainerTop( | |
@PathParam("id") String id, | |
@QueryParam("ps_args") String psArgs); | |
@GET | |
@Path("/containers/{id}/logs") | |
@Produces("application/vnd.docker.raw-stream") | |
public DockerLogStream getContainerLogs( | |
@PathParam("id") String id, | |
@QueryParam("follow") Boolean follow, | |
@QueryParam("stdout") Boolean stdout, | |
@QueryParam("stderr") Boolean stderr, | |
@QueryParam("timestamps") Boolean timestamps, | |
@QueryParam("tail") Integer tail); | |
@GET | |
@Path("/containers/{id}/changes") | |
@Produces(MediaType.APPLICATION_JSON) | |
public ContainerChanges getContainerChanges( | |
@PathParam("id") String id); | |
@GET | |
@Path("/containers/{id}/export") | |
@Produces(MediaType.APPLICATION_OCTET_STREAM) | |
public InputStream getContainerExport( | |
@PathParam("id") String id); | |
@POST | |
@Path("/containers/{id}/start") | |
@Consumes(MediaType.APPLICATION_JSON) | |
public void startContaner( | |
@PathParam("id") String id, | |
StartContainerConfig config); | |
@POST | |
@Path("/containers/{id}/stop") | |
public void stopContaner( | |
@PathParam("id") String id, | |
@QueryParam("t") Integer timeout); | |
@POST | |
@Path("/containers/{id}/restart") | |
public void restartContaner( | |
@PathParam("id") String id, | |
@QueryParam("t") Integer timeout); | |
@POST | |
@Path("/containers/{id}/kill") | |
public void killContaner( | |
@PathParam("id") String id, | |
@QueryParam("signal") Signal signal); | |
@POST | |
@Path("/containers/{id}/pause") | |
public void pauseContaner( | |
@PathParam("id") String id); | |
@POST | |
@Path("/containers/{id}/unpause") | |
public void unpauseContaner( | |
@PathParam("id") String id); | |
@POST | |
@Path("/containers/{id}/attach") | |
@Produces("application/vnd.docker.raw-stream") | |
public DockerLogStream attachContaner( | |
@PathParam("id") String id, | |
@QueryParam("logs") Boolean logs, | |
@QueryParam("stream") Boolean stream, | |
@QueryParam("stdin") Boolean stdin, | |
@QueryParam("stdout") Boolean stdout, | |
@QueryParam("stderr") Boolean stderr); | |
@POST | |
@Path("/containers/{id}/wait") | |
@Produces(MediaType.APPLICATION_JSON) | |
public WaitContainerResult waitContaner( | |
@PathParam("id") String id); | |
@DELETE | |
@Path("/containers/{id}") | |
public void deleteContaner( | |
@PathParam("id") String id, | |
@QueryParam("v") Boolean removeVolumes, | |
@QueryParam("force") Boolean force); | |
@POST | |
@Path("/containers/{id}/copy") | |
@Consumes(MediaType.APPLICATION_JSON) | |
@Produces(MediaType.APPLICATION_OCTET_STREAM) | |
public InputStream copyContainer( | |
CopyContainerConfig config, | |
@PathParam("id") String id); | |
@GET | |
@Path("/images/json") | |
@Produces(MediaType.APPLICATION_JSON) | |
public List<DockerImage> getImages( | |
@QueryParam("all") Boolean all, | |
@QueryParam("filters") Map<String, List<String>> filters); | |
@POST | |
@Path("/images/create") | |
@Produces(MediaType.APPLICATION_JSON) | |
public List<DockerProgress> createImage( | |
@QueryParam("fromImage") String fromImage, | |
@QueryParam("fromSrc") String fromSrc, | |
@QueryParam("repo") String repository, | |
@QueryParam("tag") String tag, | |
@QueryParam("registry") String registry, | |
@HeaderParam("X-Registry-Auth") AuthConfig authConfig); | |
@POST | |
@Path("/images/{name}/insert") | |
@Produces(MediaType.APPLICATION_JSON) | |
public List<DockerProgress> insertImage( | |
@PathParam("name") String name, | |
@QueryParam("path") String path, | |
@QueryParam("url") URI url); | |
@GET | |
@Path("/images/{name}/json") | |
@Produces(MediaType.APPLICATION_JSON) | |
public DockerImage getImage( | |
@PathParam("name") String name); | |
@GET | |
@Path("/images/{name}/history") | |
@Produces(MediaType.APPLICATION_JSON) | |
public List<ImageHistory> getImageHistory( | |
@PathParam("name") String name); | |
@POST | |
@Path("/images/{name}/push") | |
@Produces(MediaType.APPLICATION_JSON) | |
public List<DockerProgress> pushImage( | |
@PathParam("name") String name, | |
@QueryParam("registry") String registry, | |
@HeaderParam("X-Registry-Auth") AuthConfig authConfig); | |
@POST | |
@Path("/images/{name}/tag") | |
public void tagImage( | |
@PathParam("name") String name, | |
@QueryParam("repo") String registry, | |
@QueryParam("force") Boolean force); | |
@DELETE | |
@Path("/images/{name}") | |
public ImageDeleteResult deleteImage( | |
@PathParam("name") String name, | |
@QueryParam("force") Boolean force, | |
@QueryParam("noprune") Boolean noprune); | |
@GET | |
@Path("/images/search") | |
public List<ImageSearchResult> getImageSearch( | |
@QueryParam("term") String term); | |
@POST | |
@Path("/build") | |
@Consumes("application/tar") | |
public BuildResult build( | |
InputStream dockerFile, | |
@QueryParam("t") String name, | |
@QueryParam("q") Boolean quiet, | |
@QueryParam("nocache") Boolean noCache, | |
@QueryParam("rm") Boolean removeIntermediate, | |
@QueryParam("forcerm") Boolean forceRemoveIntermediate, | |
@HeaderParam("X-Registry-Config") RegistryConfigFile configFile); | |
@POST | |
@Path("/auth") | |
@Consumes(MediaType.APPLICATION_JSON) | |
public void auth(AuthConfig config); | |
@GET | |
@Path("/info") | |
@Produces(MediaType.APPLICATION_JSON) | |
public Info getInfo(); | |
@GET | |
@Path("/version") | |
@Produces(MediaType.APPLICATION_JSON) | |
public Version getVersion(); | |
@GET | |
@Path("/_ping") | |
@Produces(MediaType.TEXT_PLAIN) | |
public String getPing(); | |
@POST | |
@Path("/commit") | |
@Consumes(MediaType.APPLICATION_JSON) | |
@Produces("application/vnd.docker.raw-stream") | |
public InputStream commit( | |
ContainerConfig containerConfig, | |
@QueryParam("container") String containerId, | |
@QueryParam("repo") String repository, | |
@QueryParam("tag") String tag, | |
@QueryParam("m") String commitMessage, | |
@QueryParam("author") String author); | |
@GET | |
@Path("/events") | |
@Produces(MediaType.APPLICATION_JSON) | |
public List<DockerEvent> getEvents( | |
@QueryParam("since") Long since, | |
@QueryParam("until") Long until); | |
// TODO: /images/{name}/get | |
// TODO: /images/load | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment