forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerNetwork.java
More file actions
313 lines (265 loc) · 6.41 KB
/
Copy pathContainerNetwork.java
File metadata and controls
313 lines (265 loc) · 6.41 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
package com.github.dockerjava.api.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.annotation.CheckForNull;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
/**
* Types taken form
* {@see https://github.com/docker/engine-api/blob/release/1.10/types/network/network.go}
* Docker named it EndpointSettings
*
* @see ContainerNetworkSettings
* @author Kanstantsin Shautsou
*/
@EqualsAndHashCode
@ToString
public class ContainerNetwork implements Serializable {
private static final long serialVersionUID = 1L;
/**
* FIXME verify
*/
@JsonProperty("IPAMConfig")
private Ipam ipamConfig;
/**
* FIXME verify
*/
@JsonProperty("Links")
private Links links;
/**
* Add network-scoped alias for the container
* Type picked from `docker/vendor/src/github.com/docker/engine-api/types/network/network.go`
*
* @since {@link RemoteApiVersion#VERSION_1_22}
*/
@JsonProperty("Aliases")
private List<String> aliases;
@JsonProperty("NetworkID")
private String networkID;
@JsonProperty("EndpointID")
private String endpointId;
@JsonProperty("Gateway")
private String gateway;
@JsonProperty("IPAddress")
private String ipAddress;
@JsonProperty("IPPrefixLen")
private Integer ipPrefixLen;
@JsonProperty("IPv6Gateway")
private String ipV6Gateway;
@JsonProperty("GlobalIPv6Address")
private String globalIPv6Address;
@JsonProperty("GlobalIPv6PrefixLen")
private Integer globalIPv6PrefixLen;
@JsonProperty("MacAddress")
private String macAddress;
/**
* @see #aliases
*/
@CheckForNull
public List<String> getAliases() {
return aliases;
}
/**
* @see #aliases
*/
public ContainerNetwork withAliases(List<String> aliases) {
this.aliases = aliases;
return this;
}
/**
* @see #aliases
*/
public ContainerNetwork withAliases(String... aliases) {
this.aliases = Arrays.asList(aliases);
return this;
}
/**
* @see #endpointId
*/
@CheckForNull
public String getEndpointId() {
return endpointId;
}
/**
* @see #endpointId
*/
public ContainerNetwork withEndpointId(String endpointId) {
this.endpointId = endpointId;
return this;
}
/**
* @see #gateway
*/
@CheckForNull
public String getGateway() {
return gateway;
}
/**
* @see #gateway
*/
public ContainerNetwork withGateway(String gateway) {
this.gateway = gateway;
return this;
}
/**
* @see #globalIPv6Address
*/
@CheckForNull
public String getGlobalIPv6Address() {
return globalIPv6Address;
}
/**
* @see #globalIPv6Address
*/
public ContainerNetwork withGlobalIPv6Address(String globalIPv6Address) {
this.globalIPv6Address = globalIPv6Address;
return this;
}
/**
* @see #globalIPv6PrefixLen
*/
@CheckForNull
public Integer getGlobalIPv6PrefixLen() {
return globalIPv6PrefixLen;
}
/**
* @see #globalIPv6PrefixLen
*/
public ContainerNetwork withGlobalIPv6PrefixLen(Integer globalIPv6PrefixLen) {
this.globalIPv6PrefixLen = globalIPv6PrefixLen;
return this;
}
/**
* @see #ipAddress
*/
@CheckForNull
public String getIpAddress() {
return ipAddress;
}
/**
* @see #ipAddress
*/
public ContainerNetwork withIpv4Address(String ipAddress) {
this.ipAddress = ipAddress;
return this;
}
/**
* @see #ipamConfig
*/
@CheckForNull
public Ipam getIpamConfig() {
return ipamConfig;
}
/**
* @see #ipamConfig
*/
public ContainerNetwork withIpamConfig(Ipam ipamConfig) {
this.ipamConfig = ipamConfig;
return this;
}
/**
* @see #ipPrefixLen
*/
@CheckForNull
public Integer getIpPrefixLen() {
return ipPrefixLen;
}
/**
* @see #ipPrefixLen
*/
public ContainerNetwork withIpPrefixLen(Integer ipPrefixLen) {
this.ipPrefixLen = ipPrefixLen;
return this;
}
/**
* @see #ipV6Gateway
*/
@CheckForNull
public String getIpV6Gateway() {
return ipV6Gateway;
}
/**
* @see #ipV6Gateway
*/
public ContainerNetwork withIpV6Gateway(String ipV6Gateway) {
this.ipV6Gateway = ipV6Gateway;
return this;
}
/**
* @see #links
*/
@CheckForNull
@JsonIgnore
public Link[] getLinks() {
return links == null ? new Link[0] : links.getLinks();
}
/**
* @see #links
*/
public ContainerNetwork withLinks(List<Link> links) {
this.links = new Links(links);
return this;
}
/**
* @see #links
*/
public ContainerNetwork withLinks(Link... links) {
this.links = new Links(links);
return this;
}
/**
* @see #macAddress
*/
@CheckForNull
public String getMacAddress() {
return macAddress;
}
/**
* @see #macAddress
*/
public ContainerNetwork withMacAddress(String macAddress) {
this.macAddress = macAddress;
return this;
}
/**
* @see #networkID
*/
@CheckForNull
public String getNetworkID() {
return networkID;
}
/**
* @see #networkID
*/
public ContainerNetwork withNetworkID(String networkID) {
this.networkID = networkID;
return this;
}
/**
* Docker named it EndpointIPAMConfig
*/
public static class Ipam implements Serializable {
private static final long serialVersionUID = 1L;
@JsonProperty("IPv4Address")
private String ipv4Address;
@JsonProperty("IPv6Address")
private String ipv6Address;
public String getIpv4Address() {
return ipv4Address;
}
public String getIpv6Address() {
return ipv6Address;
}
public Ipam withIpv4Address(String ipv4Address) {
this.ipv4Address = ipv4Address;
return this;
}
public Ipam withIpv6Address(String ipv6Address) {
this.ipv6Address = ipv6Address;
return this;
}
}
}