Skip to content

Commit fa6cece

Browse files
committed
merge upstream
2 parents 492c335 + 19acfcc commit fa6cece

26 files changed

Lines changed: 965 additions & 143 deletions

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ Notes
1010

1111
All changes
1212

13+
* [#585] (https://github.com/docker-java/docker-java/pull/585) Add RootDir property to GraphData
1314
* [#580] (https://github.com/docker-java/docker-java/pull/580) Fixes execute permissions for files when copied to container
1415
* [#579] (https://github.com/docker-java/docker-java/pull/579) Adds missing name filter evaluation to netty version of ListImagesCmdExec
1516
* [#578] (https://github.com/docker-java/docker-java/pull/578) Fix error during image build when Dockerfile in subdirectory of build context
1617
* [#575] (https://github.com/docker-java/docker-java/pull/575) Support binding of port ranges
1718
* [#574] (https://github.com/docker-java/docker-java/pull/574) Fix for copyArchiveToContainerCmd bug
1819
* [#572] (https://github.com/docker-java/docker-java/pull/572) Inspect container command now shows sizes if requested
1920
* [#563] (https://github.com/docker-java/docker-java/pull/563) Fix memory leak in netty implementation of DockerCmdExecFactory
20-
* [#550] (https://github.com/docker-java/docker-java/pull/550) Add ability to configure IPAM config for CreateNetworkCmd
21+
* [#550] (https://github.com/docker-java/docker-java/pull/550) Add ability to configure IPAM config for CreateNetworkCmd
22+
* [#484] (https://github.com/docker-java/docker-java/pull/484) Implement missing network api options for v1.22
2123

2224
Included in 3.0.0-RC5
2325

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

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

3+
import com.github.dockerjava.api.model.ContainerNetwork;
34
import com.github.dockerjava.core.RemoteApiVersion;
45

56
import javax.annotation.CheckForNull;
@@ -18,10 +19,15 @@ public interface ConnectToNetworkCmd extends SyncDockerCmd<Void> {
1819
@CheckForNull
1920
String getContainerId();
2021

22+
@CheckForNull
23+
ContainerNetwork getContainerConfig();
24+
2125
ConnectToNetworkCmd withNetworkId(@Nonnull String networkId);
2226

2327
ConnectToNetworkCmd withContainerId(@Nonnull String containerId);
2428

29+
ConnectToNetworkCmd withContainerNetwork(@Nonnull ContainerNetwork endpointConfig);
30+
2531
interface Exec extends DockerCmdSyncExec<ConnectToNetworkCmd, Void> {
2632
}
2733
}

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

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

3-
import java.util.List;
4-
import java.util.Map;
5-
6-
import javax.annotation.CheckForNull;
7-
83
import com.github.dockerjava.api.exception.ConflictException;
94
import com.github.dockerjava.api.exception.NotFoundException;
105
import com.github.dockerjava.api.model.Bind;
@@ -21,8 +16,15 @@
2116
import com.github.dockerjava.api.model.Volume;
2217
import com.github.dockerjava.api.model.VolumesFrom;
2318

19+
import javax.annotation.CheckForNull;
20+
import java.util.List;
21+
import java.util.Map;
22+
2423
public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerResponse> {
2524

25+
@CheckForNull
26+
List<String> getAliases();
27+
2628
@CheckForNull
2729
Bind[] getBinds();
2830

@@ -92,6 +94,12 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
9294
@CheckForNull
9395
String getImage();
9496

97+
@CheckForNull
98+
String getIpv4Address();
99+
100+
@CheckForNull
101+
String getIpv6Address();
102+
95103
@CheckForNull
96104
Map<String, String> getLabels();
97105

@@ -188,6 +196,18 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
188196
@CheckForNull
189197
Map<String, String> getTmpfs();
190198

199+
/**
200+
* Add network-scoped alias for the container
201+
* @param aliases on ore more aliases
202+
*/
203+
CreateContainerCmd withAliases(String... aliases);
204+
205+
/**
206+
* Add network-scoped alias for the container
207+
* @param aliases on ore more aliases
208+
*/
209+
CreateContainerCmd withAliases(List<String> aliases);
210+
191211
CreateContainerCmd withAttachStderr(Boolean attachStderr);
192212

193213
CreateContainerCmd withAttachStdin(Boolean attachStdin);
@@ -307,6 +327,10 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
307327

308328
CreateContainerCmd withImage(String image);
309329

330+
CreateContainerCmd withIpv4Address(String ipv4Address);
331+
332+
CreateContainerCmd withIpv6Address(String ipv6Address);
333+
310334
CreateContainerCmd withLabels(Map<String, String> labels);
311335

312336
/**

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

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

3-
import java.util.Map;
4-
5-
import javax.annotation.CheckForNull;
6-
import javax.annotation.Nonnull;
7-
83
import com.github.dockerjava.api.model.Network;
94
import com.github.dockerjava.api.model.Network.Ipam;
105
import com.github.dockerjava.core.RemoteApiVersion;
116

7+
import javax.annotation.CheckForNull;
8+
import javax.annotation.Nonnull;
9+
import java.util.Map;
10+
1211
/**
1312
* Create a network.
1413
*
@@ -25,18 +24,36 @@ public interface CreateNetworkCmd extends SyncDockerCmd<CreateNetworkResponse> {
2524
@CheckForNull
2625
Network.Ipam getIpam();
2726

27+
@CheckForNull
28+
Map<String, String> getOptions();
29+
30+
@CheckForNull
31+
Boolean getCheckDuplicate();
32+
33+
@CheckForNull
34+
Boolean getInternal();
35+
36+
@CheckForNull
37+
Boolean getEnableIPv6();
38+
2839
/** The new network's name. Required. */
2940
CreateNetworkCmd withName(@Nonnull String name);
3041

31-
/** Optional custom IP scheme for the network. */
32-
CreateNetworkCmd withIpamConfig(Ipam.Config config);
33-
3442
/** Name of the network driver to use. Defaults to <code>bridge</code>. */
3543
CreateNetworkCmd withDriver(String driver);
3644

45+
/** Ipam config, such es subnet, gateway and ip range of the network */
46+
CreateNetworkCmd withIpam(Ipam ipam);
47+
3748
/** Driver specific options */
3849
CreateNetworkCmd withOptions(Map<String, String> options);
3950

51+
CreateNetworkCmd withCheckDuplicate(boolean checkForDuplicate);
52+
53+
CreateNetworkCmd withInternal(boolean internal);
54+
55+
CreateNetworkCmd withEnableIpv6(boolean enableIpv6);
56+
4057
interface Exec extends DockerCmdSyncExec<CreateNetworkCmd, CreateNetworkResponse> {
4158
}
4259
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@ public interface DisconnectFromNetworkCmd extends SyncDockerCmd<Void> {
1818
@CheckForNull
1919
String getContainerId();
2020

21+
@CheckForNull
22+
Boolean getForce();
23+
2124
DisconnectFromNetworkCmd withNetworkId(@Nonnull String networkId);
2225

2326
DisconnectFromNetworkCmd withContainerId(@Nonnull String containerId);
2427

28+
DisconnectFromNetworkCmd withForce(@Nonnull Boolean force);
29+
2530
interface Exec extends DockerCmdSyncExec<DisconnectFromNetworkCmd, Void> {
2631
}
2732
}

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

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

3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
34
import com.fasterxml.jackson.annotation.JsonProperty;
5+
46
import org.apache.commons.lang.builder.EqualsBuilder;
57
import org.apache.commons.lang.builder.HashCodeBuilder;
68
import org.apache.commons.lang.builder.ToStringBuilder;
@@ -11,7 +13,12 @@
1113
* part of {@link GraphDriver}
1214
* @author Kanstantsin Shautsou
1315
*/
16+
@JsonIgnoreProperties(ignoreUnknown = true)
1417
public class GraphData {
18+
19+
@JsonProperty("RootDir")
20+
private String rootDir;
21+
1522
@JsonProperty("DeviceId")
1623
private String deviceId;
1724

@@ -21,6 +28,22 @@ public class GraphData {
2128
@JsonProperty("DeviceSize")
2229
private String deviceSize;
2330

31+
/**
32+
* @see #rootDir
33+
*/
34+
@CheckForNull
35+
public String getRootDir() {
36+
return rootDir;
37+
}
38+
39+
/**
40+
* @see #rootDir
41+
*/
42+
public GraphData withRootDir(String rootDir) {
43+
this.rootDir = rootDir;
44+
return this;
45+
}
46+
2447
/**
2548
* @see #deviceId
2649
*/

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

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

3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
34
import com.fasterxml.jackson.annotation.JsonProperty;
5+
46
import org.apache.commons.lang.builder.EqualsBuilder;
57
import org.apache.commons.lang.builder.HashCodeBuilder;
68
import org.apache.commons.lang.builder.ToStringBuilder;
@@ -13,6 +15,7 @@
1315
* @author Kanstantsin Shautsou
1416
* @since {@link com.github.dockerjava.core.RemoteApiVersion#VERSION_1_21}
1517
*/
18+
@JsonIgnoreProperties(ignoreUnknown = true)
1619
public class GraphDriver {
1720
/**
1821
* @since {@link com.github.dockerjava.core.RemoteApiVersion#VERSION_1_21}

src/main/java/com/github/dockerjava/api/model/ContainerNetwork.java

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.dockerjava.api.model;
22

3+
import com.fasterxml.jackson.annotation.JsonIgnore;
34
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
45
import com.fasterxml.jackson.annotation.JsonProperty;
56
import com.github.dockerjava.core.RemoteApiVersion;
@@ -8,9 +9,14 @@
89
import org.apache.commons.lang.builder.ToStringBuilder;
910

1011
import javax.annotation.CheckForNull;
12+
import java.util.Arrays;
1113
import java.util.List;
1214

1315
/**
16+
* Types taken form
17+
* {@see https://github.com/docker/engine-api/blob/release/1.10/types/network/network.go}
18+
* Docker named it EndpointSettings
19+
*
1420
* @see ContainerNetworkSettings
1521
* @author Kanstantsin Shautsou
1622
*/
@@ -20,16 +26,16 @@ public class ContainerNetwork {
2026
* FIXME verify
2127
*/
2228
@JsonProperty("IPAMConfig")
23-
private Network.Ipam.Config ipamConfig;
29+
private Ipam ipamConfig;
2430

2531
/**
2632
* FIXME verify
2733
*/
2834
@JsonProperty("Links")
29-
private List<String> links;
35+
private Links links;
3036

3137
/**
32-
* FIXME no docs, unknown field.
38+
* Add network-scoped alias for the container
3339
* Type picked from `docker/vendor/src/github.com/docker/engine-api/types/network/network.go`
3440
*
3541
* @since {@link RemoteApiVersion#VERSION_1_22}
@@ -80,6 +86,14 @@ public ContainerNetwork withAliases(List<String> aliases) {
8086
return this;
8187
}
8288

89+
/**
90+
* @see #aliases
91+
*/
92+
public ContainerNetwork withAliases(String... aliases) {
93+
this.aliases = Arrays.asList(aliases);
94+
return this;
95+
}
96+
8397
/**
8498
* @see #endpointId
8599
*/
@@ -155,7 +169,7 @@ public String getIpAddress() {
155169
/**
156170
* @see #ipAddress
157171
*/
158-
public ContainerNetwork withIpAddress(String ipAddress) {
172+
public ContainerNetwork withIpv4Address(String ipAddress) {
159173
this.ipAddress = ipAddress;
160174
return this;
161175
}
@@ -164,14 +178,14 @@ public ContainerNetwork withIpAddress(String ipAddress) {
164178
* @see #ipamConfig
165179
*/
166180
@CheckForNull
167-
public Network.Ipam.Config getIpamConfig() {
181+
public Ipam getIpamConfig() {
168182
return ipamConfig;
169183
}
170184

171185
/**
172186
* @see #ipamConfig
173187
*/
174-
public ContainerNetwork withIpamConfig(Network.Ipam.Config ipamConfig) {
188+
public ContainerNetwork withIpamConfig(Ipam ipamConfig) {
175189
this.ipamConfig = ipamConfig;
176190
return this;
177191
}
@@ -212,15 +226,24 @@ public ContainerNetwork withIpV6Gateway(String ipV6Gateway) {
212226
* @see #links
213227
*/
214228
@CheckForNull
215-
public List<String> getLinks() {
216-
return links;
229+
@JsonIgnore
230+
public Link[] getLinks() {
231+
return links == null ? new Link[0] : links.getLinks();
232+
}
233+
234+
/**
235+
* @see #links
236+
*/
237+
public ContainerNetwork withLinks(List<Link> links) {
238+
this.links = new Links(links);
239+
return this;
217240
}
218241

219242
/**
220243
* @see #links
221244
*/
222-
public ContainerNetwork withLinks(List<String> links) {
223-
this.links = links;
245+
public ContainerNetwork withLinks(Link... links) {
246+
this.links = new Links(links);
224247
return this;
225248
}
226249

@@ -270,4 +293,34 @@ public boolean equals(Object o) {
270293
public int hashCode() {
271294
return HashCodeBuilder.reflectionHashCode(this);
272295
}
296+
297+
/**
298+
* Docker named it EndpointIPAMConfig
299+
*/
300+
public static class Ipam {
301+
302+
@JsonProperty("IPv4Address")
303+
private String ipv4Address;
304+
305+
@JsonProperty("IPv6Address")
306+
private String ipv6Address;
307+
308+
public String getIpv4Address() {
309+
return ipv4Address;
310+
}
311+
312+
public String getIpv6Address() {
313+
return ipv6Address;
314+
}
315+
316+
public Ipam withIpv4Address(String ipv4Address) {
317+
this.ipv4Address = ipv4Address;
318+
return this;
319+
}
320+
321+
public Ipam withIpv6Address(String ipv6Address) {
322+
this.ipv6Address = ipv6Address;
323+
return this;
324+
}
325+
}
273326
}

0 commit comments

Comments
 (0)