@Override protected InputStream execute(CopyFileFromContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/copy").resolveTemplate("id", command.getContainerId()); LOGGER.trace("POST: " + webResource.toString()); return webResource.request().accept(MediaType.APPLICATION_OCTET_STREAM) .post(command); }
@Override protected Void execute0(StatsCmd command, ResultCallback<Statistics> resultCallback) { WebTarget webTarget = getBaseResource().path("/containers/{id}/stats").resolveTemplate("id", command.getContainerId()); LOGGER.trace("GET: {}", webTarget); webTarget.request().get(new TypeReference<Statistics>() { }, resultCallback); return null; } }
@Override protected UpdateContainerResponse execute(UpdateContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/update") .resolveTemplate("id", command.getContainerId()); LOGGER.trace("POST: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON) .post(command, new TypeReference<UpdateContainerResponse>() { }); } }
@Override protected InspectExecResponse execute(InspectExecCmd command) { WebTarget webResource = getBaseResource().path("/exec/{id}/json").resolveTemplate("id", command.getExecId()); LOGGER.debug("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(new TypeReference<InspectExecResponse>() { }); } }
@Override protected InspectImageResponse execute(InspectImageCmd command) { WebTarget webResource = getBaseResource().path("/images/{id}/json").resolveTemplate("id", command.getImageId()); LOGGER.trace("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(new TypeReference<InspectImageResponse>() { }); }
@Override protected Void execute(PauseContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/pause").resolveTemplate("id", command.getContainerId()); LOGGER.trace("POST: {}", webResource); webResource.request().accept(MediaType.APPLICATION_JSON).post(null); return null; }
@Override protected InspectVolumeResponse execute(InspectVolumeCmd command) { WebTarget webResource = getBaseResource().path("/volumes/{name}").resolveTemplate("name", command.getName()); LOGGER.trace("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(new TypeReference<InspectVolumeResponse>() { }); } }
@Override protected SwarmNode execute(InspectSwarmNodeCmd command) { WebTarget webResource = getBaseResource().path("/nodes/{id}").resolveTemplate("id", command.getSwarmNodeId()); LOGGER.debug("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON) .get(new TypeReference<SwarmNode>() { }); } }
@Override protected Void execute(UnpauseContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/unpause").resolveTemplate("id", command.getContainerId()); LOGGER.trace("POST: {}", webResource); webResource.request().accept(MediaType.APPLICATION_JSON).post(null); return null; }
@Override protected Void execute(StartContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/start").resolveTemplate("id", command.getContainerId()); LOGGER.trace("POST: {}", webResource); webResource.request() .accept(MediaType.APPLICATION_JSON) .post(command); return null; }
@Override protected ExecCreateCmdResponse execute(ExecCreateCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/exec").resolveTemplate("id", command.getContainerId()); LOGGER.trace("POST: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON) .post(command, new TypeReference<ExecCreateCmdResponse>() { }); } }
@Override protected List<ChangeLog> execute(ContainerDiffCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/changes").resolveTemplate("id", command.getContainerId()); LOGGER.trace("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(new TypeReference<List<ChangeLog>>() { }); }
@Override protected InputStream execute(CopyArchiveFromContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/archive").resolveTemplate("id", command.getContainerId()); LOGGER.trace("Get: " + webResource.toString()); return webResource.queryParam("path", command.getResource()).request().accept(MediaType.APPLICATION_X_TAR) .get(); } }
@Override protected TopContainerResponse execute(TopContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/top").resolveTemplate("id", command.getContainerId()); if (!StringUtils.isEmpty(command.getPsArgs())) { webResource = webResource.queryParam("ps_args", command.getPsArgs()); } LOGGER.trace("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(new TypeReference<TopContainerResponse>() { }); }
@Override protected Void execute(StopContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/stop").resolveTemplate("id", command.getContainerId()); if (command.getTimeout() != null) { webResource = webResource.queryParam("t", String.valueOf(command.getTimeout())); } LOGGER.trace("POST: {}", webResource); webResource.request().accept(MediaType.APPLICATION_JSON).post(null); return null; } }
@Override protected Void execute(RenameContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/rename") .resolveTemplate("id", command.getContainerId()) .queryParam("name", command.getName()); LOG.trace("POST: {}", webResource); webResource.request().accept(MediaType.APPLICATION_JSON).post(null); return null; } }
@Override protected Void execute(UpdateServiceCmd command) { WebTarget webResource = getBaseResource().path("/services/{id}/update") .resolveTemplate("id", command.getServiceId()) .queryParam("version", command.getVersion()); LOGGER.trace("POST: {}", webResource); webResource.request().accept(MediaType.APPLICATION_JSON) .post(command.getServiceSpec()); return null; } }
@Override protected Void execute(KillContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/kill").resolveTemplate("id", command.getContainerId()); if (command.getSignal() != null) { webResource = webResource.queryParam("signal", command.getSignal()); } LOGGER.trace("POST: {}", webResource); webResource.request().accept(MediaType.APPLICATION_JSON).post(null); return null; }
@Override protected Void execute(UpdateSwarmNodeCmd command) { WebTarget webResource = getBaseResource().path("/nodes/{id}/update") .resolveTemplate("id", command.getSwarmNodeId()) .queryParam("version", command.getVersion()); LOGGER.trace("POST: {}", webResource); webResource.request().accept(MediaType.APPLICATION_JSON) .post(command.getSwarmNodeSpec()); return null; } }
@Override protected Void execute0(ExecStartCmd command, ResultCallback<Frame> resultCallback) { WebTarget webTarget = getBaseResource().path("/exec/{id}/start").resolveTemplate("id", command.getExecId()); webTarget.request().accept(MediaType.APPLICATION_JSON).post(command, command.getStdin(), resultCallback); return null; } }