Skip to content

Commit 3d08866

Browse files
authored
Merge branch 'master' into master
2 parents b69845e + fcb791a commit 3d08866

149 files changed

Lines changed: 4878 additions & 898 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/github/dockerjava/api/DockerClient.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import com.github.dockerjava.api.command.ListImagesCmd;
3535
import com.github.dockerjava.api.command.ListNetworksCmd;
3636
import com.github.dockerjava.api.command.ListServicesCmd;
37+
import com.github.dockerjava.api.command.ListSwarmNodesCmd;
38+
import com.github.dockerjava.api.command.ListTasksCmd;
3739
import com.github.dockerjava.api.command.ListVolumesCmd;
3840
import com.github.dockerjava.api.command.LoadImageCmd;
3941
import com.github.dockerjava.api.command.LogContainerCmd;
@@ -59,6 +61,7 @@
5961
import com.github.dockerjava.api.command.UpdateContainerCmd;
6062
import com.github.dockerjava.api.command.UpdateServiceCmd;
6163
import com.github.dockerjava.api.command.UpdateSwarmCmd;
64+
import com.github.dockerjava.api.command.UpdateSwarmNodeCmd;
6265
import com.github.dockerjava.api.command.VersionCmd;
6366
import com.github.dockerjava.api.command.WaitContainerCmd;
6467
import com.github.dockerjava.api.exception.DockerException;
@@ -308,6 +311,22 @@ public interface DockerClient extends Closeable {
308311
*/
309312
UpdateSwarmCmd updateSwarmCmd(SwarmSpec swarmSpec);
310313

314+
/**
315+
* Updates the swarm node
316+
*
317+
* @return the command
318+
* @since 1.24
319+
*/
320+
UpdateSwarmNodeCmd updateSwarmNodeCmd();
321+
322+
/**
323+
* List nodes in swarm
324+
*
325+
* @return the command
326+
* @since 1.24
327+
*/
328+
ListSwarmNodesCmd listSwarmNodesCmd();
329+
311330
/**
312331
* Command to list all services in a docker swarm. Only applicable if docker runs in swarm mode.
313332
*
@@ -347,6 +366,14 @@ public interface DockerClient extends Closeable {
347366
*/
348367
RemoveServiceCmd removeServiceCmd(String serviceId);
349368

369+
/**
370+
* List tasks in the swarm cluster
371+
*
372+
* @return the command
373+
* @since 1.24
374+
*/
375+
ListTasksCmd listTasksCmd();
376+
350377
@Override
351378
void close() throws IOException;
352379

src/main/java/com/github/dockerjava/api/command/DockerCmdExecFactory.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ public interface DockerCmdExecFactory extends Closeable {
193193
*/
194194
UpdateSwarmNodeCmd.Exec updateSwarmNodeCmdExec();
195195

196+
/**
197+
* Update a node. Node operations require the engine to be part of a swarm
198+
*
199+
* @since {@link RemoteApiVersion#VERSION_1_24}
200+
*/
201+
ListTasksCmd.Exec listTasksCmdExec();
196202

197203
@Override
198204
void close() throws IOException;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.github.dockerjava.api.command;
2+
3+
import com.github.dockerjava.api.exception.NotFoundException;
4+
import com.github.dockerjava.api.model.Task;
5+
6+
import javax.annotation.CheckForNull;
7+
8+
public interface InspectTaskCmd extends SyncDockerCmd<Task> {
9+
@CheckForNull
10+
String getTaskId();
11+
12+
InspectTaskCmd withTaskId();
13+
14+
@Override
15+
Task exec() throws NotFoundException;
16+
17+
interface Exec extends DockerCmdSyncExec<InspectTaskCmd, Task> {
18+
}
19+
}

src/main/java/com/github/dockerjava/api/command/ListContainersCmd.java

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.github.dockerjava.api.command;
22

3-
import java.util.List;
4-
import java.util.Map;
3+
import com.github.dockerjava.api.model.Container;
54

65
import javax.annotation.CheckForNull;
7-
8-
import com.github.dockerjava.api.model.Container;
6+
import java.util.Collection;
7+
import java.util.List;
8+
import java.util.Map;
99

1010
/**
1111
* List containers
@@ -38,22 +38,52 @@ public interface ListContainersCmd extends SyncDockerCmd<List<Container>> {
3838
ListContainersCmd withBefore(String before);
3939

4040
/**
41-
* @param exitcode
41+
* @param name
42+
* - Show only containers that has the container's name
43+
*/
44+
ListContainersCmd withNameFilter(Collection<String> name);
45+
46+
/**
47+
* @param id
48+
* - Show only containers that has the container's id
49+
*/
50+
ListContainersCmd withIdFilter(Collection<String> id);
51+
52+
/**
53+
* @param ancestor
54+
* - Show only containers created from an image or a descendant.
55+
*/
56+
ListContainersCmd withAncestorFilter(Collection<String> ancestor);
57+
58+
/**
59+
* @param volume
60+
* - Show only containers with volume name or mount point destination
61+
*/
62+
ListContainersCmd withVolumeFilter(Collection<String> volume);
63+
64+
/**
65+
* @param network
66+
* - Show only containers with network id or network name
67+
*/
68+
ListContainersCmd withNetworkFilter(Collection<String> network);
69+
70+
/**
71+
* @param exited
4272
* - Show only containers that exited with the passed exitcode.
4373
*/
44-
ListContainersCmd withExitcodeFilter(Integer exitcode);
74+
ListContainersCmd withExitedFilter(Integer exited);
4575

4676
/**
4777
* @param status
4878
* - Show only containers with the passed status (created|restarting|running|paused|exited).
4979
*/
50-
ListContainersCmd withStatusFilter(String status);
80+
ListContainersCmd withStatusFilter(Collection<String> status);
5181

5282
/**
5383
* @param labels
5484
* - Show only containers with the passed labels.
5585
*/
56-
ListContainersCmd withLabelFilter(String... labels);
86+
ListContainersCmd withLabelFilter(Collection<String> labels);
5787

5888
/**
5989
* @param labels
@@ -85,6 +115,13 @@ public interface ListContainersCmd extends SyncDockerCmd<List<Container>> {
85115
*/
86116
ListContainersCmd withSince(String since);
87117

118+
/**
119+
* @param filterName
120+
* @param filterValues
121+
* - Show only containers where the filter matches the given values
122+
*/
123+
ListContainersCmd withFilter(String filterName, Collection<String> filterValues);
124+
88125
interface Exec extends DockerCmdSyncExec<ListContainersCmd, List<Container>> {
89126
}
90127

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.github.dockerjava.api.command;
2+
3+
import com.github.dockerjava.api.exception.NotFoundException;
4+
import com.github.dockerjava.api.model.Task;
5+
import com.github.dockerjava.api.model.TaskState;
6+
7+
import javax.annotation.CheckForNull;
8+
import java.util.List;
9+
import java.util.Map;
10+
11+
public interface ListTasksCmd extends SyncDockerCmd<List<Task>> {
12+
@CheckForNull
13+
Map<String, List<String>> getFilters();
14+
15+
/**
16+
* @param labels - Show only tasks with the passed labels.
17+
* Labels is a {@link Map} that contains label keys and values
18+
*/
19+
ListTasksCmd withLabelFilter(Map<String, String> labels);
20+
21+
/**
22+
* @param labels - Show only tasks with the passed labels.
23+
*/
24+
ListTasksCmd withLabelFilter(String... labels);
25+
26+
/**
27+
* @param ids Task id(s)
28+
*/
29+
ListTasksCmd withIdFilter(String... ids);
30+
31+
/**
32+
* @param names Task name(s)
33+
*/
34+
ListTasksCmd withNameFilter(String... names);
35+
36+
/**
37+
* @param nodeNames Node id(s) or name(s)
38+
*/
39+
ListTasksCmd withNodeFilter(String... nodeNames);
40+
41+
/**
42+
* @param serviceNames Service name(s)
43+
*/
44+
ListTasksCmd withServiceFilter(String... serviceNames);
45+
46+
/**
47+
* @param desiredState The desired-state filter can take the values running, shutdown, or accepted.
48+
*/
49+
ListTasksCmd withStateFilter(TaskState... desiredState);
50+
51+
@Override
52+
List<Task> exec() throws NotFoundException;
53+
54+
interface Exec extends DockerCmdSyncExec<ListTasksCmd, List<Task>> {
55+
}
56+
}

src/main/java/com/github/dockerjava/api/command/UpdateSwarmNodeCmd.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public interface UpdateSwarmNodeCmd extends SyncDockerCmd<Void> {
2323

2424
UpdateSwarmNodeCmd withSwarmNodeSpec(SwarmNodeSpec swarmNodeSpec);
2525

26+
UpdateSwarmNodeCmd withVersion(@Nonnull Long versionId);
27+
28+
@CheckForNull
29+
Long getVersion();
30+
2631
interface Exec extends DockerCmdSyncExec<UpdateSwarmNodeCmd, Void> {
2732
}
2833
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonInclude;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import org.apache.commons.lang.builder.EqualsBuilder;
7+
import org.apache.commons.lang.builder.HashCodeBuilder;
8+
import org.apache.commons.lang.builder.ToStringBuilder;
9+
import org.apache.commons.lang.builder.ToStringStyle;
10+
11+
import java.io.Serializable;
12+
13+
/**
14+
* BlkioStat is not documented in pubic docker swapper.yaml yet, reference:
15+
* https://github.com/moby/moby/blob/master/api/types/stats.go
16+
*/
17+
@JsonIgnoreProperties(ignoreUnknown = true)
18+
@JsonInclude(JsonInclude.Include.NON_NULL)
19+
public class BlkioStatEntry implements Serializable {
20+
private static final long serialVersionUID = 1L;
21+
@JsonProperty("major")
22+
Long major;
23+
@JsonProperty("minor")
24+
Long minor;
25+
@JsonProperty("op")
26+
String op;
27+
@JsonProperty("value")
28+
Long value;
29+
30+
public Long getMajor() {
31+
return major;
32+
}
33+
34+
public BlkioStatEntry withMajor(Long major) {
35+
this.major = major;
36+
return this;
37+
}
38+
39+
public Long getMinor() {
40+
return minor;
41+
}
42+
43+
public BlkioStatEntry withMinor(Long minor) {
44+
this.minor = minor;
45+
return this;
46+
}
47+
48+
public String getOp() {
49+
return op;
50+
}
51+
52+
public BlkioStatEntry withOp(String op) {
53+
this.op = op;
54+
return this;
55+
}
56+
57+
public Long getValue() {
58+
return value;
59+
}
60+
61+
public BlkioStatEntry withValue(Long value) {
62+
this.value = value;
63+
return this;
64+
}
65+
66+
@Override
67+
public String toString() {
68+
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
69+
}
70+
71+
@Override
72+
public boolean equals(Object o) {
73+
return EqualsBuilder.reflectionEquals(this, o);
74+
}
75+
76+
@Override
77+
public int hashCode() {
78+
return HashCodeBuilder.reflectionHashCode(this);
79+
}
80+
}

0 commit comments

Comments
 (0)