forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListContainersCmdImpl.java
More file actions
122 lines (98 loc) · 3.02 KB
/
Copy pathListContainersCmdImpl.java
File metadata and controls
122 lines (98 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package com.github.dockerjava.core.command;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List;
import java.util.Map;
import com.github.dockerjava.api.command.ListContainersCmd;
import com.github.dockerjava.api.model.Container;
import com.github.dockerjava.core.util.FiltersBuilder;
/**
* List containers.
*/
public class ListContainersCmdImpl extends AbstrDockerCmd<ListContainersCmd, List<Container>> implements
ListContainersCmd {
private Integer limit = -1;
private Boolean showSize, showAll = false;
private String sinceId, beforeId;
private FiltersBuilder filters = new FiltersBuilder();
public ListContainersCmdImpl(ListContainersCmd.Exec exec) {
super(exec);
}
@Override
public Integer getLimit() {
return limit;
}
@Override
public Boolean hasShowSizeEnabled() {
return showSize;
}
@Override
public Boolean hasShowAllEnabled() {
return showAll;
}
@Override
public String getSinceId() {
return sinceId;
}
@Override
public String getBeforeId() {
return beforeId;
}
@Override
public Map<String, List<String>> getFilters() {
return filters.build();
}
@Override
public ListContainersCmd withShowAll(Boolean showAll) {
this.showAll = showAll;
return this;
}
@Override
public ListContainersCmd withShowSize(Boolean showSize) {
this.showSize = showSize;
return this;
}
@Override
public ListContainersCmd withLimit(Integer limit) {
checkNotNull(limit, "limit was not specified");
checkArgument(limit > 0, "limit must be greater 0");
this.limit = limit;
return this;
}
@Override
public ListContainersCmd withSince(String since) {
checkNotNull(since, "since was not specified");
this.sinceId = since;
return this;
}
@Override
public ListContainersCmd withBefore(String before) {
checkNotNull(before, "before was not specified");
this.beforeId = before;
return this;
}
@Override
public ListContainersCmd withLabelFilter(String... labels) {
checkNotNull(labels, "labels was not specified");
this.filters.withLabels(labels);
return this;
}
@Override
public ListContainersCmd withLabelFilter(Map<String, String> labels) {
checkNotNull(labels, "labels was not specified");
this.filters.withLabels(labels);
return this;
}
@Override
public ListContainersCmd withExitcodeFilter(Integer exitcode) {
checkNotNull(exitcode, "exitcode was not specified");
this.filters.withFilter("exitcode", exitcode.toString());
return this;
}
@Override
public ListContainersCmd withStatusFilter(String status) {
checkNotNull(status, "status was not specified");
this.filters.withFilter("status", status);
return this;
}
}