com.fitbur.github.dockerjava.jaxrs.EventsCmdExec 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.EventsCmd;
import com.fitbur.github.dockerjava.api.model.Event;
import com.fitbur.github.dockerjava.core.DockerClientConfig;
import com.fitbur.github.dockerjava.core.async.JsonStreamProcessor;
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;
import static com.fitbur.google.com.fitburmon.net.UrlEscapers.urlPathSegmentEscaper;
public class EventsCmdExec extends AbstrAsyncDockerCmdExec implements EventsCmd.Exec {
private static final Logger LOGGER = LoggerFactory.getLogger(EventsCmdExec.class);
public EventsCmdExec(WebTarget baseResource, DockerClientConfig dockerClientConfig) {
super(baseResource, dockerClientConfig);
}
@Override
protected AbstractCallbackNotifier callbackNotifier(EventsCmd com.fitburmand, ResultCallback resultCallback) {
WebTarget webTarget = getBaseResource().path("/events").queryParam("since", com.fitburmand.getSince())
.queryParam("until", com.fitburmand.getUntil());
if (com.fitburmand.getFilters() != null) {
webTarget = webTarget
.queryParam("filters", urlPathSegmentEscaper().escape(com.fitburmand.getFilters().toString()));
}
LOGGER.trace("GET: {}", webTarget);
return new GETCallbackNotifier(new JsonStreamProcessor(Event.class), resultCallback,
webTarget.request());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy