
org.testifyproject.github.dockerjava.jaxrs.LogContainerCmdExec Maven / Gradle / Ivy
package org.testifyproject.testifyproject.github.dockerjava.jaxrs;
import javax.ws.rs.client.WebTarget;
import org.testifyproject.slf4j.Logger;
import org.testifyproject.slf4j.LoggerFactory;
import org.testifyproject.testifyproject.github.dockerjava.api.async.ResultCallback;
import org.testifyproject.testifyproject.github.dockerjava.api.org.testifyproject.testifyprojectmand.LogContainerCmd;
import org.testifyproject.testifyproject.github.dockerjava.api.model.Frame;
import org.testifyproject.testifyproject.github.dockerjava.core.DockerClientConfig;
import org.testifyproject.testifyproject.github.dockerjava.core.async.FrameStreamProcessor;
import org.testifyproject.testifyproject.github.dockerjava.jaxrs.async.AbstractCallbackNotifier;
import org.testifyproject.testifyproject.github.dockerjava.jaxrs.async.GETCallbackNotifier;
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 org.testifyproject.testifyprojectmand,
ResultCallback resultCallback) {
WebTarget webTarget = getBaseResource().path("/containers/{id}/logs").resolveTemplate("id",
org.testifyproject.testifyprojectmand.getContainerId());
if (org.testifyproject.testifyprojectmand.getTail() != null) {
webTarget = webTarget.queryParam("tail", org.testifyproject.testifyprojectmand.getTail());
}
if (org.testifyproject.testifyprojectmand.getSince() != null) {
webTarget = webTarget.queryParam("since", org.testifyproject.testifyprojectmand.getSince());
}
webTarget = booleanQueryParam(webTarget, "timestamps", org.testifyproject.testifyprojectmand.hasTimestampsEnabled());
webTarget = booleanQueryParam(webTarget, "stdout", org.testifyproject.testifyprojectmand.hasStdoutEnabled());
webTarget = booleanQueryParam(webTarget, "stderr", org.testifyproject.testifyprojectmand.hasStderrEnabled());
webTarget = booleanQueryParam(webTarget, "follow", org.testifyproject.testifyprojectmand.hasFollowStreamEnabled());
LOGGER.trace("GET: {}", webTarget);
return new GETCallbackNotifier(new FrameStreamProcessor(), resultCallback, webTarget.request());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy