Skip to content

Commit f196c02

Browse files
yuting-liuKostyaSha
authored andcommitted
Add new getter of API v1.23 (docker-java#956)
* Add getter of containers/json * Change Mounts with List * Add new getters of Internal and EnableIPv6 in /networks/(name)
1 parent 932202e commit f196c02

3 files changed

Lines changed: 202 additions & 0 deletions

File tree

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import javax.annotation.CheckForNull;
1414
import java.io.Serializable;
15+
import java.util.List;
1516
import java.util.Map;
1617

1718
/**
@@ -54,6 +55,12 @@ public class Container implements Serializable {
5455
@JsonProperty("Status")
5556
private String status;
5657

58+
/**
59+
* @since ~{@link RemoteApiVersion#VERSION_1_23}
60+
*/
61+
@JsonProperty("State")
62+
private String state;
63+
5764
/**
5865
* @since ~{@link RemoteApiVersion#VERSION_1_19}
5966
*/
@@ -83,6 +90,12 @@ public class Container implements Serializable {
8390
@JsonProperty("NetworkSettings")
8491
private ContainerNetworkSettings networkSettings;
8592

93+
/**
94+
* @since ~{@link RemoteApiVersion#VERSION_1_23}
95+
*/
96+
@JsonProperty("Mounts")
97+
private List<ContainerMount> mounts;
98+
8699
public String getId() {
87100
return id;
88101
}
@@ -108,6 +121,10 @@ public String getStatus() {
108121
return status;
109122
}
110123

124+
public String getState() {
125+
return state;
126+
}
127+
111128
public ContainerPort[] getPorts() {
112129
return ports;
113130
}
@@ -152,6 +169,10 @@ public ContainerHostConfig getHostConfig() {
152169
return hostConfig;
153170
}
154171

172+
public List<ContainerMount> getMounts() {
173+
return mounts;
174+
}
175+
155176
@Override
156177
public String toString() {
157178
return ToStringBuilder.reflectionToString(this);
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import org.apache.commons.lang.builder.EqualsBuilder;
6+
import org.apache.commons.lang.builder.HashCodeBuilder;
7+
import org.apache.commons.lang.builder.ToStringBuilder;
8+
9+
import javax.annotation.CheckForNull;
10+
import java.io.Serializable;
11+
12+
/**
13+
* @author Yuting Liu
14+
* @see Container
15+
*/
16+
@JsonIgnoreProperties(ignoreUnknown = true)
17+
public class ContainerMount implements Serializable {
18+
private static final long serialVersionUID = 1L;
19+
20+
@JsonProperty("Name")
21+
String name;
22+
23+
@JsonProperty("Source")
24+
String source;
25+
26+
@JsonProperty("Destination")
27+
String destination;
28+
29+
@JsonProperty("Driver")
30+
String driver;
31+
32+
@JsonProperty("Mode")
33+
String mode;
34+
35+
@JsonProperty("RW")
36+
boolean rw;
37+
38+
@JsonProperty("Propagation")
39+
String propagation;
40+
41+
/**
42+
* @see #name
43+
*/
44+
@CheckForNull
45+
public String getName() {
46+
return name;
47+
}
48+
49+
/**
50+
* @see #name
51+
*/
52+
public ContainerMount withName(String name) {
53+
this.name = name;
54+
return this;
55+
}
56+
57+
/**
58+
* @see #source
59+
*/
60+
@CheckForNull
61+
public String getSource() {
62+
return source;
63+
}
64+
65+
/**
66+
* @see #source
67+
*/
68+
public ContainerMount withSource(String source) {
69+
this.source = source;
70+
return this;
71+
}
72+
73+
/**
74+
* @see #destination
75+
*/
76+
@CheckForNull
77+
public String getDestination() {
78+
return destination;
79+
}
80+
81+
/**
82+
* @see #destination
83+
*/
84+
public ContainerMount withDestination(String destination) {
85+
this.destination = destination;
86+
return this;
87+
}
88+
89+
/**
90+
* @see #driver
91+
*/
92+
@CheckForNull
93+
public String getDriver() {
94+
return driver;
95+
}
96+
97+
/**
98+
* @see #driver
99+
*/
100+
public ContainerMount withDriver(String driver) {
101+
this.driver = driver;
102+
return this;
103+
}
104+
105+
/**
106+
* @see #mode
107+
*/
108+
@CheckForNull
109+
public String getMode() {
110+
return driver;
111+
}
112+
113+
/**
114+
* @see #mode
115+
*/
116+
public ContainerMount withMode(String mode) {
117+
this.mode = mode;
118+
return this;
119+
}
120+
121+
/**
122+
* @see #rw
123+
*/
124+
@CheckForNull
125+
public Boolean getRw() {
126+
return rw;
127+
}
128+
129+
/**
130+
* @see #rw
131+
*/
132+
public ContainerMount withRw(Boolean rw) {
133+
this.rw = rw;
134+
return this;
135+
}
136+
137+
/**
138+
* @see #propagation
139+
*/
140+
@CheckForNull
141+
public String getPropagation() {
142+
return propagation;
143+
}
144+
145+
/**
146+
* @see #propagation
147+
*/
148+
public ContainerMount withPropagation(String propagation) {
149+
this.propagation = propagation;
150+
return this;
151+
}
152+
153+
@Override
154+
public String toString() {
155+
return ToStringBuilder.reflectionToString(this);
156+
}
157+
158+
@Override
159+
public boolean equals(Object o) {
160+
return EqualsBuilder.reflectionEquals(this, o);
161+
}
162+
163+
@Override
164+
public int hashCode() {
165+
return HashCodeBuilder.reflectionHashCode(this);
166+
}
167+
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public class Network implements Serializable {
2828
@JsonProperty("Driver")
2929
private String driver;
3030

31+
@JsonProperty("EnableIPv6")
32+
private Boolean enableIPv6;
33+
34+
@JsonProperty("Internal")
35+
private Boolean internal;
36+
3137
@JsonProperty("IPAM")
3238
private Ipam ipam;
3339

@@ -59,6 +65,14 @@ public String getDriver() {
5965
return driver;
6066
}
6167

68+
public Boolean getEnableIPv6() {
69+
return enableIPv6;
70+
}
71+
72+
public Boolean getInternal() {
73+
return internal;
74+
}
75+
6276
public Ipam getIpam() {
6377
return ipam;
6478
}

0 commit comments

Comments
 (0)