Skip to content
49 changes: 41 additions & 8 deletions src/main/java/com/github/dockerjava/api/command/EventsCmd.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,66 @@
package com.github.dockerjava.api.command;

import java.util.List;
import java.util.Map;

import javax.annotation.CheckForNull;

import com.github.dockerjava.api.model.Event;
import com.github.dockerjava.api.model.Filters;

/**
* Get events
*
* @param since
* - Show all events created since timestamp
* @param until
* - Stream events until this timestamp
*/
public interface EventsCmd extends AsyncDockerCmd<EventsCmd, Event> {

@CheckForNull
public Filters getFilters();
public Map<String, List<String>> getFilters();

@CheckForNull
public String getSince();

@CheckForNull
public String getUntil();

public EventsCmd withFilters(Filters filters);
/**
* @param container
* - container to filter
*/
public EventsCmd withContainerFilter(String... container);

/**
* @param event
* - event to filter (pull | create | attach | start | stop | kill)
*/
public EventsCmd withEventFilter(String... event);

/**
* @param image
* - image to filter
*/
public EventsCmd withImageFilter(String... image);

/**
* @param label
* - label to filter
*/
public EventsCmd withLabelFilter(String... label);

/**
* @param labels
* - labels to filter (map of names and values)
*/
public EventsCmd withLabelFilter(Map<String, String> labels);

/**
* @param since
* - Show all events created since timestamp
*/
public EventsCmd withSince(String since);

/**
* @param until
* - Show all events created until timestamp
*/
public EventsCmd withUntil(String until);

public static interface Exec extends DockerCmdAsyncExec<EventsCmd, Event> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
package com.github.dockerjava.api.command;

import java.util.List;
import java.util.Map;

import javax.annotation.CheckForNull;

import com.github.dockerjava.api.model.Container;
import com.github.dockerjava.api.model.Filters;

/**
* List containers
*
* @param showAll
* - true or false, Show all containers. Only running containers are shown by default.
* @param showSize
* - true or false, Show the containers sizes. This is false by default.
* @param limit
* - Show `limit` last created containers, include non-running ones. There is no limit by default.
* @param sinceId
* - Show only containers created since Id, include non-running ones.
* @param beforeId
* - Show only containers created before Id, include non-running ones.
*
*/
public interface ListContainersCmd extends SyncDockerCmd<List<Container>> {

@CheckForNull
public String getBeforeId();

@CheckForNull
public Filters getFilters();
public Map<String, List<String>> getFilters();

@CheckForNull
public Integer getLimit();
Expand All @@ -42,16 +31,59 @@ public interface ListContainersCmd extends SyncDockerCmd<List<Container>> {
@CheckForNull
public Boolean hasShowSizeEnabled();

/**
* @param beforeId
* - Show only containers created before Id, include non-running ones.
*/
public ListContainersCmd withBefore(String before);

public ListContainersCmd withFilters(Filters filters);

/**
* @param exitcode
* - Show only containers that exited with the passed exitcode.
*/
public ListContainersCmd withExitcodeFilter(Integer exitcode);

/**
* @param exitcode
* - Show only containers with the passed status (created|restarting|running|paused|exited).
*/
public ListContainersCmd withStatusFilter(String status);

/**
* @param labels
* - Show only containers with the passed labels.
*/
public ListContainersCmd withLabelFilter(String... labels);

/**
* @param labels
* - Show only containers with the passed labels. Labels is a {@link Map} that contains label keys and
* values
*/
public ListContainersCmd withLabelFilter(Map<String, String> labels);

/**
* @param limit
* - Show `limit` last created containers, include non-running ones. There is no limit by default.
*/
public ListContainersCmd withLimit(Integer limit);

/**
* @param showAll
* - Show all containers. Only running containers are shown by default.
*/
public ListContainersCmd withShowAll(Boolean showAll);

/**
* @param showSize
* - Show the containers sizes. This is false by default.
*/
public ListContainersCmd withShowSize(Boolean showSize);

/**
* @param sinceId
* - Show only containers created since Id, include non-running ones.
*/
public ListContainersCmd withSince(String since);

public static interface Exec extends DockerCmdSyncExec<ListContainersCmd, List<Container>> {
Expand Down
32 changes: 25 additions & 7 deletions src/main/java/com/github/dockerjava/api/command/ListImagesCmd.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
package com.github.dockerjava.api.command;

import java.util.List;
import java.util.Map;

import javax.annotation.CheckForNull;

import com.github.dockerjava.api.model.Image;

/**
* List images
*
* @param showAll
* - Show all images (by default filter out the intermediate images used to build)
* @param filters
* - a json encoded value of the filters (a map[string][]string) to process on the images list.
*/
public interface ListImagesCmd extends SyncDockerCmd<List<Image>> {

@CheckForNull
public String getFilters();
public Map<String, List<String>> getFilters();

public String getImageNameFilter();

@CheckForNull
public Boolean hasShowAllEnabled();

/**
* Show all images (by default filter out the intermediate images used to build)
*/
public ListImagesCmd withShowAll(Boolean showAll);

public ListImagesCmd withFilters(String filters);
public ListImagesCmd withImageNameFilter(String imageName);

/**
* Filter dangling images
*/
public ListImagesCmd withDanglingFilter(Boolean dangling);

/**
* @param labels
* - string array in the form ["key"] or ["key=value"] or a mix of both
*/
public ListImagesCmd withLabelFilter(String... label);

/**
* @param labels
* - {@link Map} of labels that contains label keys and values
*/
public ListImagesCmd withLabelFilter(Map<String, String> labels);

public static interface Exec extends DockerCmdSyncExec<ListImagesCmd, List<Image>> {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.github.dockerjava.api.command;

import com.github.dockerjava.api.model.Filters;
import com.github.dockerjava.api.model.Network;
import com.github.dockerjava.core.RemoteApiVersion;

import javax.annotation.CheckForNull;

import java.util.List;
import java.util.Map;

/**
* List networks.
Expand All @@ -16,9 +16,11 @@
public interface ListNetworksCmd extends SyncDockerCmd<List<Network>> {

@CheckForNull
public Filters getFilters();
public Map<String, List<String>> getFilters();

ListNetworksCmd withFilters(Filters filters);
ListNetworksCmd withNameFilter(String... networkName);

ListNetworksCmd withIdFilter(String... networkId);

public static interface Exec extends DockerCmdSyncExec<ListNetworksCmd, List<Network>> {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
package com.github.dockerjava.api.command;

import java.util.List;
import java.util.Map;

import javax.annotation.CheckForNull;

/**
* List volumes.
*
*
* @author Marcus Linke
*/
public interface ListVolumesCmd extends SyncDockerCmd<ListVolumesResponse> {

@CheckForNull
public String getFilters();
public Map<String, List<String>> getFilters();

/**
* @param filters
* - JSON encoded value of the filters (a map[string][]string) to process on the volumes list. There is
* one available filter: dangling=true
* @param dangling
* - Show dangling volumes filter
*/
public ListVolumesCmd withFilters(String filters);
public ListVolumesCmd withDanglingFilter(Boolean dangling);

public static interface Exec extends DockerCmdSyncExec<ListVolumesCmd, ListVolumesResponse> {
}
Expand Down
37 changes: 0 additions & 37 deletions src/main/java/com/github/dockerjava/api/model/EventFilters.java

This file was deleted.

15 changes: 0 additions & 15 deletions src/main/java/com/github/dockerjava/api/model/NetworkFilters.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ public boolean isPullSuccessIndicated() {
return (getStatus().contains(DOWNLOAD_COMPLETE) || getStatus().contains(IMAGE_UP_TO_DATE)
|| getStatus().contains(DOWNLOADED_NEWER_IMAGE) || getStatus().contains(LEGACY_REGISTRY));
}

}
Loading