Skip to content

Commit a5dcc64

Browse files
committed
update service mode for api version 1.30
1 parent 2582dce commit a5dcc64

18 files changed

+938
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonInclude;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import com.github.dockerjava.core.RemoteApiVersion;
7+
import org.apache.commons.lang.builder.EqualsBuilder;
8+
import org.apache.commons.lang.builder.HashCodeBuilder;
9+
import org.apache.commons.lang.builder.ToStringBuilder;
10+
import org.apache.commons.lang.builder.ToStringStyle;
11+
12+
import java.io.Serializable;
13+
import java.util.List;
14+
15+
/**
16+
* Specification for DNS related configurations in resolver configuration file (`resolv.conf`).
17+
*
18+
* @since {@link RemoteApiVersion#VERSION_1_25}
19+
*/
20+
@JsonIgnoreProperties(ignoreUnknown = true)
21+
@JsonInclude(JsonInclude.Include.NON_NULL)
22+
public class ContainerDNSConfig implements Serializable {
23+
private static final long serialVersionUID = 1L;
24+
25+
@JsonProperty("Nameservers")
26+
private List<String> nameservers;
27+
@JsonProperty("Search")
28+
private List<String> search;
29+
@JsonProperty("Options")
30+
private List<String> options;
31+
32+
public List<String> getNameservers() {
33+
return nameservers;
34+
}
35+
36+
public ContainerDNSConfig withNameservers(List<String> nameservers) {
37+
this.nameservers = nameservers;
38+
return this;
39+
}
40+
41+
public List<String> getSearch() {
42+
return search;
43+
}
44+
45+
public ContainerDNSConfig withSearch(List<String> search) {
46+
this.search = search;
47+
return this;
48+
}
49+
50+
public List<String> getOptions() {
51+
return options;
52+
}
53+
54+
public ContainerDNSConfig withOptions(List<String> options) {
55+
this.options = options;
56+
return this;
57+
}
58+
59+
@Override
60+
public String toString() {
61+
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
62+
}
63+
64+
65+
@Override
66+
public boolean equals(Object o) {
67+
return EqualsBuilder.reflectionEquals(this, o);
68+
}
69+
70+
@Override
71+
public int hashCode() {
72+
return HashCodeBuilder.reflectionHashCode(this);
73+
}
74+
}

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

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,82 @@ public class ContainerSpec implements Serializable {
9090
@JsonProperty("Duration")
9191
private Long duration;
9292

93+
/**
94+
* @since 1.24
95+
*/
96+
@JsonProperty("StopGracePeriod")
97+
private Long stopGracePeriod;
98+
99+
/**
100+
* @since 1.25
101+
* Specification for DNS related configurations in resolver configuration file
102+
*/
103+
@JsonProperty("DNSConfig")
104+
private ContainerDNSConfig dnsConfig;
105+
106+
/**
107+
* @since 1.26
108+
* Open stdin
109+
*/
110+
@JsonProperty("OpenStdin")
111+
private Boolean openStdin;
112+
113+
/**
114+
* @since 1.26
115+
* Mount the container's root filesystem as read only.
116+
*/
117+
@JsonProperty("ReadOnly")
118+
private Boolean readOnly;
119+
120+
/**
121+
* @since 1.26
122+
* A list of hostnames/IP mappings to add to the container's /etc/hosts file.
123+
*/
124+
@JsonProperty("Hosts")
125+
private List<String> hosts;
126+
127+
/**
128+
* @since 1.26
129+
* The hostname to use for the container, as a valid RFC 1123 hostname
130+
*/
131+
@JsonProperty("Hostname")
132+
private String hostname;
133+
134+
/**
135+
* @since 1.26
136+
* Secrets contains references to zero or more secrets that will be exposed to the service.
137+
*/
138+
@JsonProperty("Secrets")
139+
private List<ContainerSpecSecret> secrets;
140+
141+
/**
142+
* @since 1.26
143+
* A test to perform to check that the container is healthy.
144+
*/
145+
@JsonProperty("HealthCheck")
146+
private HealthCheck healthCheck;
147+
148+
/**
149+
* @since 1.28
150+
* Signal to stop the container.
151+
*/
152+
@JsonProperty("StopSignal")
153+
private String stopSignal;
154+
155+
/**
156+
* @since 1.29
157+
* Security options for the container
158+
*/
159+
@JsonProperty("Privileges")
160+
private ContainerSpecPrivileges privileges;
161+
162+
/**
163+
* @since 1.29
164+
* Configs contains references to zero or more configs that will be exposed to the service.
165+
*/
166+
@JsonProperty("Configs")
167+
private List<ContainerSpecConfig> configs;
168+
93169
/**
94170
* @see #image
95171
*/
@@ -266,6 +342,105 @@ public ContainerSpec withDuration(Long duration) {
266342
return this;
267343
}
268344

345+
public ContainerDNSConfig getDnsConfig() {
346+
return dnsConfig;
347+
}
348+
349+
public ContainerSpec withDnsConfig(ContainerDNSConfig dnsConfig) {
350+
this.dnsConfig = dnsConfig;
351+
return this;
352+
}
353+
354+
public Boolean getOpenStdin() {
355+
return openStdin;
356+
}
357+
358+
public ContainerSpec withOpenStdin(Boolean openStdin) {
359+
this.openStdin = openStdin;
360+
return this;
361+
}
362+
363+
public Boolean getReadOnly() {
364+
return readOnly;
365+
}
366+
367+
public ContainerSpec withReadOnly(Boolean readOnly) {
368+
this.readOnly = readOnly;
369+
return this;
370+
}
371+
372+
public List<String> getHosts() {
373+
return hosts;
374+
}
375+
376+
public ContainerSpec withHosts(List<String> hosts) {
377+
this.hosts = hosts;
378+
return this;
379+
}
380+
381+
public String getHostname() {
382+
return hostname;
383+
}
384+
385+
public ContainerSpec withHostname(String hostname) {
386+
this.hostname = hostname;
387+
return this;
388+
}
389+
390+
public List<ContainerSpecSecret> getSecrets() {
391+
return secrets;
392+
}
393+
394+
public ContainerSpec withSecrets(List<ContainerSpecSecret> secrets) {
395+
this.secrets = secrets;
396+
return this;
397+
}
398+
399+
public HealthCheck getHealthCheck() {
400+
return healthCheck;
401+
}
402+
403+
public ContainerSpec withHealthCheck(HealthCheck healthCheck) {
404+
this.healthCheck = healthCheck;
405+
return this;
406+
}
407+
408+
public String getStopSignal() {
409+
return stopSignal;
410+
}
411+
412+
public ContainerSpec withStopSignal(String stopSignal) {
413+
this.stopSignal = stopSignal;
414+
return this;
415+
}
416+
417+
public Long getStopGracePeriod() {
418+
return stopGracePeriod;
419+
}
420+
421+
public ContainerSpec withStopGracePeriod(Long stopGracePeriod) {
422+
this.stopGracePeriod = stopGracePeriod;
423+
return this;
424+
}
425+
426+
public ContainerSpecPrivileges getPrivileges() {
427+
return privileges;
428+
}
429+
430+
public ContainerSpec withPrivileges(ContainerSpecPrivileges privileges) {
431+
this.privileges = privileges;
432+
return this;
433+
}
434+
435+
public List<ContainerSpecConfig> getConfigs() {
436+
return configs;
437+
}
438+
439+
public ContainerSpec withConfigs(List<ContainerSpecConfig> configs) {
440+
this.configs = configs;
441+
return this;
442+
}
443+
269444
@Override
270445
public String toString() {
271446
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonInclude;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import com.github.dockerjava.core.RemoteApiVersion;
7+
import org.apache.commons.lang.builder.EqualsBuilder;
8+
import org.apache.commons.lang.builder.HashCodeBuilder;
9+
import org.apache.commons.lang.builder.ToStringBuilder;
10+
import org.apache.commons.lang.builder.ToStringStyle;
11+
12+
import java.io.Serializable;
13+
14+
/**
15+
* docker configs that will be exposed to the service
16+
*
17+
* @since {@link RemoteApiVersion#VERSION_1_29}
18+
*/
19+
@JsonIgnoreProperties(ignoreUnknown = true)
20+
@JsonInclude(JsonInclude.Include.NON_NULL)
21+
public class ContainerSpecConfig implements Serializable {
22+
private static final long serialVersionUID = 1L;
23+
@JsonProperty("File")
24+
private ContainerSpecFile file;
25+
26+
@JsonProperty("ConfigID")
27+
private String configID;
28+
29+
@JsonProperty("ConfigName")
30+
private String configName;
31+
32+
public ContainerSpecFile getFile() {
33+
return file;
34+
}
35+
36+
public ContainerSpecConfig withFile(ContainerSpecFile file) {
37+
this.file = file;
38+
return this;
39+
}
40+
41+
public String getConfigID() {
42+
return configID;
43+
}
44+
45+
public ContainerSpecConfig withConfigID(String configID) {
46+
this.configID = configID;
47+
return this;
48+
}
49+
50+
public String getConfigName() {
51+
return configName;
52+
}
53+
54+
public ContainerSpecConfig withConfigName(String configName) {
55+
this.configName = configName;
56+
return this;
57+
}
58+
59+
@Override
60+
public String toString() {
61+
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
62+
}
63+
64+
@Override
65+
public boolean equals(Object o) {
66+
return EqualsBuilder.reflectionEquals(this, o);
67+
}
68+
69+
@Override
70+
public int hashCode() {
71+
return HashCodeBuilder.reflectionHashCode(this);
72+
}
73+
}

0 commit comments

Comments
 (0)