forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdateContainerCmdImpl.java
More file actions
529 lines (440 loc) · 11.9 KB
/
Copy pathUpdateContainerCmdImpl.java
File metadata and controls
529 lines (440 loc) · 11.9 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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
package com.github.dockerjava.core.command;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.dockerjava.api.command.UpdateContainerCmd;
import com.github.dockerjava.api.exception.NotFoundException;
import com.github.dockerjava.api.model.BlkioRateDevice;
import com.github.dockerjava.api.model.BlkioWeightDevice;
import com.github.dockerjava.api.model.Device;
import com.github.dockerjava.api.model.DeviceRequest;
import com.github.dockerjava.api.model.RestartPolicy;
import com.github.dockerjava.api.model.Ulimit;
import com.github.dockerjava.api.model.UpdateContainerResponse;
import com.github.dockerjava.core.RemoteApiVersion;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import java.util.List;
/**
* @author Kanstantsin Shautsou
* @see <a href="https://docs.docker.com/engine/reference/api/docker_remote_api_v1.22/">
* https://docs.docker.com/engine/reference/api/docker_remote_api_v1.22/</a>
* @since {@link RemoteApiVersion#VERSION_1_22}
*/
public class UpdateContainerCmdImpl extends AbstrDockerCmd<UpdateContainerCmd, UpdateContainerResponse>
implements UpdateContainerCmd {
@JsonIgnore
private String containerId;
@JsonProperty("BlkioWeight")
private Integer blkioWeight;
@JsonProperty("BlkioWeightDevice")
private List<BlkioWeightDevice> blkioWeightDevice;
@JsonProperty("BlkioDeviceReadBps")
private List<BlkioRateDevice> blkioDeviceReadBps;
@JsonProperty("BlkioDeviceWriteBps")
private List<BlkioRateDevice> blkioDeviceWriteBps;
@JsonProperty("BlkioDeviceReadIOps")
private List<BlkioRateDevice> blkioDeviceReadIOps;
@JsonProperty("BlkioDeviceWriteIOps")
private List<BlkioRateDevice> blkioDeviceWriteIOps;
@JsonProperty("CpuShares")
private Integer cpuShares;
@JsonProperty("CpuPeriod")
private Long cpuPeriod;
@JsonProperty("CpuQuota")
private Long cpuQuota;
@JsonProperty("CpuRealtimePeriod")
private Long cpuRealtimePeriod;
@JsonProperty("CpuRealtimeRuntime")
private Long cpuRealtimeRuntime;
@JsonProperty("NanoCpus")
private Long nanoCPUs;
@JsonProperty("CpusetCpus")
private String cpusetCpus;
@JsonProperty("CpusetMems")
private String cpusetMems;
@JsonProperty("Devices")
private List<Device> devices;
@JsonProperty("DeviceCgroupRules")
private List<String> deviceCgroupRules;
/**
* @since {@link com.github.dockerjava.core.RemoteApiVersion#VERSION_1_40}
*/
@JsonProperty("DeviceRequests")
private List<DeviceRequest> deviceRequests;
@JsonProperty("Memory")
private Long memory;
@JsonProperty("MemorySwap")
private Long memorySwap;
@JsonProperty("MemoryReservation")
private Long memoryReservation;
@JsonProperty("KernelMemory")
private Long kernelMemory;
@JsonProperty("OomKillDisable")
private Boolean oomKillDisable;
@JsonProperty("Init")
private Boolean init;
@JsonProperty("PidsLimit")
private Long pidsLimit;
@JsonProperty("Ulimits")
private List<Ulimit> ulimits;
@JsonProperty("RestartPolicy")
private RestartPolicy restartPolicy;
public UpdateContainerCmdImpl(UpdateContainerCmd.Exec exec, String containerId) {
super(exec);
withContainerId(containerId);
}
/**
* @see #containerId
*/
@CheckForNull
@JsonIgnore
public String getContainerId() {
return containerId;
}
/**
* @see #containerId
*/
public UpdateContainerCmd withContainerId(@Nonnull String containerId) {
this.containerId = containerId;
return this;
}
/**
* @see #blkioWeight
*/
@CheckForNull
public Integer getBlkioWeight() {
return blkioWeight;
}
/**
* @see #blkioWeight
*/
public UpdateContainerCmd withBlkioWeight(Integer blkioWeight) {
this.blkioWeight = blkioWeight;
return this;
}
/**
* @see #blkioWeightDevice
*/
@CheckForNull
public List<BlkioWeightDevice> getBlkioWeightDevice() {
return blkioWeightDevice;
}
public UpdateContainerCmd withBlkioWeightDevice(List<BlkioWeightDevice> blkioWeightDevice) {
this.blkioWeightDevice = blkioWeightDevice;
return this;
}
/**
* @see #blkioDeviceReadBps
*/
@CheckForNull
public List<BlkioRateDevice> getBlkioDeviceReadBps() {
return blkioDeviceReadBps;
}
public UpdateContainerCmd withBlkioDeviceReadBps(List<BlkioRateDevice> blkioDeviceReadBps) {
this.blkioDeviceReadBps = blkioDeviceReadBps;
return this;
}
/**
* @see #blkioDeviceWriteBps
*/
@CheckForNull
public List<BlkioRateDevice> getBlkioDeviceWriteBps() {
return blkioDeviceWriteBps;
}
public UpdateContainerCmd withBlkioDeviceWriteBps(List<BlkioRateDevice> blkioDeviceWriteBps) {
this.blkioDeviceWriteBps = blkioDeviceWriteBps;
return this;
}
/**
* @see #blkioDeviceReadIOps
*/
@CheckForNull
public List<BlkioRateDevice> getBlkioDeviceReadIOps() {
return blkioDeviceReadIOps;
}
public UpdateContainerCmd withBlkioDeviceReadIOps(List<BlkioRateDevice> blkioDeviceReadIOps) {
this.blkioDeviceReadIOps = blkioDeviceReadIOps;
return this;
}
/**
* @see #blkioDeviceWriteIOps
*/
@CheckForNull
public List<BlkioRateDevice> getBlkioDeviceWriteIOps() {
return blkioDeviceWriteIOps;
}
@Override
public UpdateContainerCmd withBlkioDeviceWriteIOps(List<BlkioRateDevice> blkioDeviceWriteIOps) {
this.blkioDeviceWriteIOps = blkioDeviceWriteIOps;
return this;
}
/**
* @see #cpuPeriod
*/
@CheckForNull
public Long getCpuPeriod() {
return cpuPeriod;
}
/**
* @see #cpuPeriod
*/
public UpdateContainerCmd withCpuPeriod(Long cpuPeriod) {
this.cpuPeriod = cpuPeriod;
return this;
}
/**
* @see #cpuQuota
*/
@CheckForNull
public Long getCpuQuota() {
return cpuQuota;
}
/**
* @see #cpuQuota
*/
public UpdateContainerCmd withCpuQuota(Long cpuQuota) {
this.cpuQuota = cpuQuota;
return this;
}
/**
* @see #cpusetCpus
*/
@CheckForNull
public String getCpusetCpus() {
return cpusetCpus;
}
/**
* @see #cpusetCpus
*/
public UpdateContainerCmd withCpusetCpus(String cpusetCpus) {
this.cpusetCpus = cpusetCpus;
return this;
}
/**
* @see #cpusetMems
*/
@CheckForNull
public String getCpusetMems() {
return cpusetMems;
}
/**
* @see #cpusetMems
*/
public UpdateContainerCmd withCpusetMems(String cpusetMems) {
this.cpusetMems = cpusetMems;
return this;
}
/**
* @see #cpuShares
*/
@CheckForNull
public Integer getCpuShares() {
return cpuShares;
}
/**
* @see #cpuShares
*/
public UpdateContainerCmd withCpuShares(Integer cpuShares) {
this.cpuShares = cpuShares;
return this;
}
/**
* @see #cpuRealtimePeriod
*/
@CheckForNull
public Long getCpuRealtimePeriod() {
return cpuRealtimePeriod;
}
public UpdateContainerCmd withCpuRealtimePeriod(Long cpuRealtimePeriod) {
this.cpuRealtimePeriod = cpuRealtimePeriod;
return this;
}
/**
* @see #cpuRealtimeRuntime
*/
@CheckForNull
public Long getCpuRealtimeRuntime() {
return cpuRealtimeRuntime;
}
public UpdateContainerCmd withCpuRealtimeRuntime(Long cpuRealtimeRuntime) {
this.cpuRealtimeRuntime = cpuRealtimeRuntime;
return this;
}
/**
* @see #devices
*/
@CheckForNull
public List<Device> getDevices() {
return devices;
}
public UpdateContainerCmd withDevices(List<Device> devices) {
this.devices = devices;
return this;
}
/**
* @see #deviceCgroupRules
*/
@CheckForNull
public List<String> getDeviceCgroupRules() {
return deviceCgroupRules;
}
public UpdateContainerCmd withDeviceCgroupRules(List<String> deviceCgroupRules) {
this.deviceCgroupRules = deviceCgroupRules;
return this;
}
/**
* @see #deviceRequests
*/
@CheckForNull
public List<DeviceRequest> getDeviceRequests() {
return deviceRequests;
}
public UpdateContainerCmd withDeviceRequests(List<DeviceRequest> deviceRequests) {
this.deviceRequests = deviceRequests;
return this;
}
/**
* @see #kernelMemory
*/
@CheckForNull
public Long getKernelMemory() {
return kernelMemory;
}
/**
* @see #kernelMemory
*/
public UpdateContainerCmd withKernelMemory(Long kernelMemory) {
this.kernelMemory = kernelMemory;
return this;
}
/**
* @see #memory
*/
@CheckForNull
public Long getMemory() {
return memory;
}
/**
* @see #memory
*/
public UpdateContainerCmd withMemory(Long memory) {
this.memory = memory;
return this;
}
/**
* @see #memoryReservation
*/
@CheckForNull
public Long getMemoryReservation() {
return memoryReservation;
}
/**
* @see #memoryReservation
*/
public UpdateContainerCmd withMemoryReservation(Long memoryReservation) {
this.memoryReservation = memoryReservation;
return this;
}
/**
* @see #memorySwap
*/
@CheckForNull
public Long getMemorySwap() {
return memorySwap;
}
/**
* @see #memorySwap
*/
public UpdateContainerCmd withMemorySwap(Long memorySwap) {
this.memorySwap = memorySwap;
return this;
}
/**
* @see #nanoCPUs
*/
@CheckForNull
public Long getNanoCPUs() {
return nanoCPUs;
}
public UpdateContainerCmd withNanoCPUs(Long nanoCPUs) {
this.nanoCPUs = nanoCPUs;
return this;
}
/**
* @see #oomKillDisable
*/
@CheckForNull
public Boolean getOomKillDisable() {
return oomKillDisable;
}
public UpdateContainerCmd withOomKillDisable(Boolean oomKillDisable) {
this.oomKillDisable = oomKillDisable;
return this;
}
/**
* @see #init
*/
@CheckForNull
public Boolean getInit() {
return init;
}
public UpdateContainerCmd withInit(Boolean init) {
this.init = init;
return this;
}
/**
* @see #pidsLimit
*/
@CheckForNull
public Long getPidsLimit() {
return pidsLimit;
}
public UpdateContainerCmd withPidsLimit(Long pidsLimit) {
this.pidsLimit = pidsLimit;
return this;
}
/**
* @see #ulimits
*/
@CheckForNull
public List<Ulimit> getUlimits() {
return ulimits;
}
public UpdateContainerCmd withUlimits(List<Ulimit> ulimits) {
this.ulimits = ulimits;
return this;
}
/**
* @see #restartPolicy
*/
@CheckForNull
public RestartPolicy getRestartPolicy() {
return restartPolicy;
}
public UpdateContainerCmd withRestartPolicy(RestartPolicy restartPolicy) {
this.restartPolicy = restartPolicy;
return this;
}
/**
* @throws NotFoundException No such container
*/
@Override
public UpdateContainerResponse exec() throws NotFoundException {
return super.exec();
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
}