Skip to content

Commit fba4fd1

Browse files
committed
Add isolation property support in Info response
1 parent a5be86d commit fba4fd1

File tree

4 files changed

+154
-0
lines changed

4 files changed

+154
-0
lines changed

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

+22
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ public class Info implements Serializable {
230230
@JsonProperty("Swarm")
231231
private SwarmInfo swarm;
232232

233+
/**
234+
* @since {@link com.github.dockerjava.core.RemoteApiVersion#VERSION_1_25}
235+
*/
236+
@JsonProperty("Isolation")
237+
private String isolation;
238+
233239
/**
234240
* @see #architecture
235241
*/
@@ -1046,6 +1052,22 @@ public Info withSwarm(SwarmInfo swarm) {
10461052
return this;
10471053
}
10481054

1055+
/**
1056+
* @see #isolation
1057+
*/
1058+
@CheckForNull
1059+
public String getIsolation() {
1060+
return isolation;
1061+
}
1062+
1063+
/**
1064+
* @see #isolation
1065+
*/
1066+
public Info withIsolation(String isolation) {
1067+
this.isolation = isolation;
1068+
return this;
1069+
}
1070+
10491071
@Override
10501072
public String toString() {
10511073
return ToStringBuilder.reflectionToString(this);

src/main/java/com/github/dockerjava/core/RemoteApiVersion.java

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public class RemoteApiVersion implements Serializable {
8787
public static final RemoteApiVersion VERSION_1_34 = RemoteApiVersion.create(1, 34);
8888
public static final RemoteApiVersion VERSION_1_35 = RemoteApiVersion.create(1, 35);
8989
public static final RemoteApiVersion VERSION_1_36 = RemoteApiVersion.create(1, 36);
90+
public static final RemoteApiVersion VERSION_1_37 = RemoteApiVersion.create(1, 37);
91+
public static final RemoteApiVersion VERSION_1_38 = RemoteApiVersion.create(1, 38);
9092

9193

9294
/**

src/test/java/com/github/dockerjava/api/model/InfoTest.java

+37
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
import com.fasterxml.jackson.databind.JavaType;
44
import com.fasterxml.jackson.databind.ObjectMapper;
55
import com.github.dockerjava.api.model.InfoRegistryConfig.IndexConfig;
6+
import com.github.dockerjava.core.RemoteApiVersion;
67
import org.hamcrest.CoreMatchers;
78
import org.junit.Test;
89

910
import java.io.IOException;
11+
import java.util.Arrays;
1012
import java.util.Collections;
1113
import java.util.LinkedHashMap;
1214
import java.util.List;
@@ -327,4 +329,39 @@ public void serder2Json() throws IOException {
327329

328330
assertThat(info, is(withInfo));
329331
}
332+
333+
@Test
334+
public void info_1_38() throws IOException {
335+
final ObjectMapper mapper = new ObjectMapper();
336+
final JavaType type = mapper.getTypeFactory().constructType(Info.class);
337+
338+
final Info info = testRoundTrip(RemoteApiVersion.VERSION_1_38,
339+
"info/lcow.json",
340+
type
341+
);
342+
343+
assertThat(info, notNullValue());
344+
assertThat(info.getArchitecture(), is("x86_64"));
345+
assertThat(info.getDockerRootDir(), is("C:\\ProgramData\\Docker"));
346+
assertThat(info.getDriver(), is("windowsfilter (windows) lcow (linux)"));
347+
348+
assertThat(info.getDriverStatuses(), equalTo(Arrays.asList(
349+
Arrays.asList("Windows", ""),
350+
Arrays.asList("LCOW", "")
351+
)));
352+
353+
assertThat(info.getIsolation(), is("hyperv"));
354+
assertThat(info.getKernelVersion(), is("10.0 17134 (17134.1.amd64fre.rs4_release.180410-1804)"));
355+
assertThat(info.getOsType(), is("windows"));
356+
assertThat(info.getOperatingSystem(), is("Windows 10 Pro Version 1803 (OS Build 17134.228)"));
357+
358+
final Map<String, List<String>> plugins = new LinkedHashMap<>();
359+
plugins.put("Authorization", null);
360+
plugins.put("Log", asList("awslogs", "etwlogs", "fluentd", "gelf", "json-file", "logentries", "splunk", "syslog"));
361+
plugins.put("Network", asList("ics", "l2bridge", "l2tunnel", "nat", "null", "overlay", "transparent"));
362+
plugins.put("Volume", singletonList("local"));
363+
assertThat(info.getPlugins(), equalTo(plugins));
364+
365+
assertThat(info.getServerVersion(), is("18.06.1-ce"));
366+
}
330367
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"Architecture": "x86_64",
3+
"BridgeNfIp6tables": true,
4+
"BridgeNfIptables": true,
5+
"CPUSet": false,
6+
"CPUShares": false,
7+
"CgroupDriver": "",
8+
"ClusterAdvertise": "",
9+
"ClusterStore": "",
10+
"ContainerdCommit": {
11+
"Expected": "",
12+
"ID": ""
13+
},
14+
"Containers": 3,
15+
"ContainersPaused": 0,
16+
"ContainersRunning": 0,
17+
"ContainersStopped": 3,
18+
"CpuCfsPeriod": false,
19+
"CpuCfsQuota": false,
20+
"Debug": true,
21+
"DefaultRuntime": "",
22+
"DockerRootDir": "C:\\ProgramData\\Docker",
23+
"Driver": "windowsfilter (windows) lcow (linux)",
24+
"DriverStatus": [["Windows", ""], ["LCOW", ""]],
25+
"ExperimentalBuild": true,
26+
"GenericResources": null,
27+
"HttpProxy": "",
28+
"HttpsProxy": "",
29+
"ID": "ZOGT:VB24:YEPZ:Y7HU:JHPB:WNUE:UYQG:7YRY:VLZV:FLWV:R65B:ICZG",
30+
"IPv4Forwarding": true,
31+
"Images": 2,
32+
"IndexServerAddress": "https://index.docker.io/v1/",
33+
"InitBinary": "",
34+
"InitCommit": {
35+
"Expected": "",
36+
"ID": ""
37+
},
38+
"Isolation": "hyperv",
39+
"KernelMemory": false,
40+
"KernelVersion": "10.0 17134 (17134.1.amd64fre.rs4_release.180410-1804)",
41+
"Labels": [],
42+
"LiveRestoreEnabled": false,
43+
"LoggingDriver": "json-file",
44+
"MemTotal": 68684476416,
45+
"MemoryLimit": false,
46+
"NCPU": 8,
47+
"NEventsListener": 1,
48+
"NFd": -1,
49+
"NGoroutines": 28,
50+
"Name": "somename",
51+
"NoProxy": "",
52+
"OSType": "windows",
53+
"OomKillDisable": false,
54+
"OperatingSystem": "Windows 10 Pro Version 1803 (OS Build 17134.228)",
55+
"Plugins": {
56+
"Authorization": null,
57+
"Log": ["awslogs", "etwlogs", "fluentd", "gelf", "json-file", "logentries", "splunk", "syslog"],
58+
"Network": ["ics", "l2bridge", "l2tunnel", "nat", "null", "overlay", "transparent"],
59+
"Volume": ["local"]
60+
},
61+
"RegistryConfig": {
62+
"AllowNondistributableArtifactsCIDRs": [],
63+
"AllowNondistributableArtifactsHostnames": [],
64+
"IndexConfigs": {
65+
"docker.io": {
66+
"Mirrors": [],
67+
"Name": "docker.io",
68+
"Official": true,
69+
"Secure": true
70+
}
71+
},
72+
"InsecureRegistryCIDRs": ["127.0.0.0/8"],
73+
"Mirrors": []
74+
},
75+
"RuncCommit": {
76+
"Expected": "",
77+
"ID": ""
78+
},
79+
"Runtimes": null,
80+
"SecurityOptions": [],
81+
"ServerVersion": "18.06.1-ce",
82+
"SwapLimit": false,
83+
"Swarm": {
84+
"ControlAvailable": false,
85+
"Error": "",
86+
"LocalNodeState": "inactive",
87+
"NodeAddr": "",
88+
"NodeID": "",
89+
"RemoteManagers": null
90+
},
91+
"SystemStatus": null,
92+
"SystemTime": "2018-09-14T09:40:05.1369294+02:00"
93+
}

0 commit comments

Comments
 (0)