de.gesellix.docker.client.tasks.ManageTaskClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docker-client Show documentation
Show all versions of docker-client Show documentation
A Docker client for the JVM written in Groovy
package de.gesellix.docker.client.tasks;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.gesellix.docker.client.EngineResponseContent;
import de.gesellix.docker.remote.api.EngineApiClient;
import de.gesellix.docker.remote.api.Task;
import de.gesellix.util.QueryParameterEncoder;
public class ManageTaskClient implements ManageTask {
private final Logger log = LoggerFactory.getLogger(ManageTaskClient.class);
private final EngineApiClient client;
public ManageTaskClient(EngineApiClient client) {
this.client = client;
}
/**
* @see #tasks(String)
* @deprecated use {@link #tasks(String)}
*/
@Deprecated
@Override
public EngineResponseContent> tasks(Map query) {
Map actualQuery = new HashMap<>();
if (query != null) {
actualQuery.putAll(query);
}
new QueryParameterEncoder().jsonEncodeQueryParameter(actualQuery, "filters");
return tasks((String) actualQuery.get("filters"));
}
@Override
public EngineResponseContent> tasks(String filters) {
log.info("docker tasks");
List tasks = client.getTaskApi().taskList(filters);
return new EngineResponseContent<>(tasks);
}
@Override
public EngineResponseContent> tasks() {
return tasks((String) null);
}
@Override
public EngineResponseContent inspectTask(String name) {
log.info("docker task inspect");
Task taskInspect = client.getTaskApi().taskInspect(name);
return new EngineResponseContent<>(taskInspect);
}
}