com.fitbur.github.dockerjava.jaxrs.LogContainerCmdExec Maven / Gradle / Ivy
package com.fitbur.github.dockerjava.jaxrs;
import com.fitbur.github.dockerjava.api.async.ResultCallback;
import com.fitbur.github.dockerjava.api.com.fitburmand.LogContainerCmd;
import com.fitbur.github.dockerjava.api.model.Frame;
import com.fitbur.github.dockerjava.core.DockerClientConfig;
import com.fitbur.github.dockerjava.core.async.FrameStreamProcessor;
import com.fitbur.github.dockerjava.jaxrs.async.AbstractCallbackNotifier;
import com.fitbur.github.dockerjava.jaxrs.async.GETCallbackNotifier;
import com.fitbur.slf4j.Logger;
import com.fitbur.slf4j.LoggerFactory;
import javax.ws.rs.client.WebTarget;
public class LogContainerCmdExec extends AbstrAsyncDockerCmdExec implements
LogContainerCmd.Exec {
private static final Logger LOGGER = LoggerFactory.getLogger(LogContainerCmdExec.class);
public LogContainerCmdExec(WebTarget baseResource, DockerClientConfig dockerClientConfig) {
super(baseResource, dockerClientConfig);
}
@Override
protected AbstractCallbackNotifier callbackNotifier(LogContainerCmd com.fitburmand,
ResultCallback resultCallback) {
WebTarget webTarget = getBaseResource().path("/containers/{id}/logs")
.resolveTemplate("id", com.fitburmand.getContainerId())
.queryParam("timestamps", com.fitburmand.hasTimestampsEnabled() ? "1" : "0")
.queryParam("stdout", com.fitburmand.hasStdoutEnabled() ? "1" : "0")
.queryParam("stderr", com.fitburmand.hasStderrEnabled() ? "1" : "0")
.queryParam("follow", com.fitburmand.hasFollowStreamEnabled() ? "1" : "0")
.queryParam("since", com.fitburmand.getSince())
.queryParam("tail", com.fitburmand.getTail() < 0 ? "all" : "" + com.fitburmand.getTail());
LOGGER.trace("GET: {}", webTarget);
return new GETCallbackNotifier(new FrameStreamProcessor(), resultCallback, webTarget.request());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy