Skip to content

Commit 5368057

Browse files
authored
Upd apis (docker-java#1135)
* WIP * Update part of apis to 1.37 * Fix test * Fix test
1 parent 0eab8a7 commit 5368057

19 files changed

+942
-516
lines changed

src/main/java/com/github/dockerjava/api/command/CreateContainerCmd.java

Lines changed: 103 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.github.dockerjava.api.exception.NotFoundException;
55
import com.github.dockerjava.api.model.AuthConfig;
66
import com.github.dockerjava.api.model.ExposedPort;
7+
import com.github.dockerjava.api.model.HealthCheck;
78
import com.github.dockerjava.api.model.HostConfig;
89
import com.github.dockerjava.api.model.Volume;
910

@@ -16,171 +17,192 @@ public interface CreateContainerCmd extends SyncDockerCmd<CreateContainerRespons
1617
@CheckForNull
1718
AuthConfig getAuthConfig();
1819

20+
/**
21+
* While using swarm classic, you can provide an optional auth config which will be used to pull images from a private registry,
22+
* if the swarm node does not already have the docker image.
23+
* Note: This option does not have any effect in normal docker
24+
*
25+
* @param authConfig The optional auth config
26+
*/
27+
CreateContainerCmd withAuthConfig(AuthConfig authConfig);
28+
1929
@CheckForNull
2030
List<String> getAliases();
2131

32+
/**
33+
* Add network-scoped alias for the container
34+
*
35+
* @param aliases on ore more aliases
36+
*/
37+
CreateContainerCmd withAliases(List<String> aliases);
38+
39+
/**
40+
* Add network-scoped alias for the container
41+
*
42+
* @param aliases on ore more aliases
43+
*/
44+
CreateContainerCmd withAliases(String... aliases);
45+
2246
@CheckForNull
2347
String[] getCmd();
2448

49+
CreateContainerCmd withCmd(String... cmd);
50+
51+
CreateContainerCmd withCmd(List<String> cmd);
52+
53+
@CheckForNull
54+
HealthCheck getHealthcheck();
55+
56+
CreateContainerCmd withHealthcheck(HealthCheck healthCheck);
57+
58+
@CheckForNull
59+
Boolean getArgsEscaped();
60+
61+
CreateContainerCmd withArgsEscaped(Boolean argsEscaped);
62+
2563
@CheckForNull
2664
String getDomainName();
2765

66+
CreateContainerCmd withDomainName(String domainName);
67+
2868
@CheckForNull
2969
String[] getEntrypoint();
3070

71+
CreateContainerCmd withEntrypoint(String... entrypoint);
72+
73+
CreateContainerCmd withEntrypoint(List<String> entrypoint);
74+
3175
@CheckForNull
3276
String[] getEnv();
3377

78+
CreateContainerCmd withEnv(String... env);
79+
80+
CreateContainerCmd withEnv(List<String> env);
81+
3482
@CheckForNull
3583
ExposedPort[] getExposedPorts();
3684

85+
CreateContainerCmd withExposedPorts(List<ExposedPort> exposedPorts);
86+
87+
CreateContainerCmd withExposedPorts(ExposedPort... exposedPorts);
88+
3789
@CheckForNull
3890
String getStopSignal();
3991

92+
CreateContainerCmd withStopSignal(String stopSignal);
93+
94+
@CheckForNull
95+
Integer getStopTimeout();
96+
97+
CreateContainerCmd withStopTimeout(Integer stopTimeout);
98+
4099
@CheckForNull
41100
String getHostName();
42101

102+
CreateContainerCmd withHostName(String hostName);
103+
43104
@CheckForNull
44105
String getImage();
45106

107+
CreateContainerCmd withImage(String image);
108+
46109
@CheckForNull
47110
String getIpv4Address();
48111

112+
CreateContainerCmd withIpv4Address(String ipv4Address);
113+
49114
@CheckForNull
50115
String getIpv6Address();
51116

117+
CreateContainerCmd withIpv6Address(String ipv6Address);
118+
52119
@CheckForNull
53120
Map<String, String> getLabels();
54121

122+
CreateContainerCmd withLabels(Map<String, String> labels);
123+
55124
@CheckForNull
56125
String getMacAddress();
57126

127+
CreateContainerCmd withMacAddress(String macAddress);
128+
58129
@CheckForNull
59130
String getName();
60131

132+
CreateContainerCmd withName(String name);
133+
61134
@CheckForNull
62135
String[] getPortSpecs();
63136

137+
CreateContainerCmd withPortSpecs(String... portSpecs);
138+
139+
CreateContainerCmd withPortSpecs(List<String> portSpecs);
140+
64141
@CheckForNull
65142
String getUser();
66143

144+
CreateContainerCmd withUser(String user);
145+
67146
@CheckForNull
68147
Volume[] getVolumes();
69148

149+
CreateContainerCmd withVolumes(Volume... volumes);
150+
151+
CreateContainerCmd withVolumes(List<Volume> volumes);
152+
70153
@CheckForNull
71154
String getWorkingDir();
72155

156+
CreateContainerCmd withWorkingDir(String workingDir);
157+
73158
@CheckForNull
74159
Boolean isAttachStderr();
75160

161+
CreateContainerCmd withAttachStderr(Boolean attachStderr);
162+
76163
@CheckForNull
77164
Boolean isAttachStdin();
78165

166+
CreateContainerCmd withAttachStdin(Boolean attachStdin);
167+
79168
@CheckForNull
80169
Boolean isAttachStdout();
81170

171+
CreateContainerCmd withAttachStdout(Boolean attachStdout);
172+
82173
@CheckForNull
83174
Boolean isNetworkDisabled();
84175

176+
CreateContainerCmd withNetworkDisabled(Boolean disableNetwork);
177+
85178
@CheckForNull
86179
Boolean isStdInOnce();
87180

181+
CreateContainerCmd withStdInOnce(Boolean stdInOnce);
182+
88183
@CheckForNull
89184
Boolean isStdinOpen();
90185

91-
@CheckForNull
92-
HostConfig getHostConfig();
186+
CreateContainerCmd withStdinOpen(Boolean stdinOpen);
93187

94188
@CheckForNull
95189
Boolean isTty();
96190

97-
/**
98-
* While using swarm classic, you can provide an optional auth config which will be used to pull images from a private registry,
99-
* if the swarm node does not already have the docker image.
100-
* Note: This option does not have any effect in normal docker
101-
* @param authConfig The optional auth config
102-
*/
103-
CreateContainerCmd withAuthConfig(AuthConfig authConfig);
104-
105-
/**
106-
* Add network-scoped alias for the container
107-
* @param aliases on ore more aliases
108-
*/
109-
CreateContainerCmd withAliases(String... aliases);
110-
111-
/**
112-
* Add network-scoped alias for the container
113-
* @param aliases on ore more aliases
114-
*/
115-
CreateContainerCmd withAliases(List<String> aliases);
116-
117-
CreateContainerCmd withAttachStderr(Boolean attachStderr);
118-
119-
CreateContainerCmd withAttachStdin(Boolean attachStdin);
120-
121-
CreateContainerCmd withAttachStdout(Boolean attachStdout);
122-
123-
CreateContainerCmd withCmd(String... cmd);
124-
125-
CreateContainerCmd withCmd(List<String> cmd);
126-
127-
CreateContainerCmd withDomainName(String domainName);
128-
129-
CreateContainerCmd withEntrypoint(String... entrypoint);
130-
131-
CreateContainerCmd withEntrypoint(List<String> entrypoint);
132-
133-
CreateContainerCmd withEnv(String... env);
134-
135-
CreateContainerCmd withEnv(List<String> env);
136-
137-
CreateContainerCmd withExposedPorts(ExposedPort... exposedPorts);
138-
139-
CreateContainerCmd withStopSignal(String stopSignal);
140-
141-
CreateContainerCmd withExposedPorts(List<ExposedPort> exposedPorts);
142-
143-
CreateContainerCmd withHostName(String hostName);
144-
145-
CreateContainerCmd withImage(String image);
146-
147-
CreateContainerCmd withIpv4Address(String ipv4Address);
148-
149-
CreateContainerCmd withIpv6Address(String ipv6Address);
150-
151-
CreateContainerCmd withLabels(Map<String, String> labels);
152-
153-
CreateContainerCmd withMacAddress(String macAddress);
154-
155-
CreateContainerCmd withName(String name);
156-
157-
CreateContainerCmd withNetworkDisabled(Boolean disableNetwork);
158-
159-
CreateContainerCmd withPortSpecs(String... portSpecs);
160-
161-
CreateContainerCmd withPortSpecs(List<String> portSpecs);
162-
163-
CreateContainerCmd withStdInOnce(Boolean stdInOnce);
164-
165-
CreateContainerCmd withStdinOpen(Boolean stdinOpen);
166-
167191
CreateContainerCmd withTty(Boolean tty);
168192

169-
CreateContainerCmd withUser(String user);
170-
171-
CreateContainerCmd withVolumes(Volume... volumes);
193+
@CheckForNull
194+
List<String> getOnBuild();
172195

173-
CreateContainerCmd withVolumes(List<Volume> volumes);
196+
CreateContainerCmd withOnBuild(List<String> onBuild);
174197

175-
CreateContainerCmd withWorkingDir(String workingDir);
198+
@CheckForNull
199+
HostConfig getHostConfig();
176200

177201
CreateContainerCmd withHostConfig(HostConfig hostConfig);
178202

179203
/**
180-
* @throws NotFoundException
181-
* No such container
182-
* @throws ConflictException
183-
* Named container already exists
204+
* @throws NotFoundException No such container
205+
* @throws ConflictException Named container already exists
184206
*/
185207
@Override
186208
CreateContainerResponse exec() throws NotFoundException, ConflictException;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ public class AuthConfig implements Serializable {
2121
*/
2222
public static final String DEFAULT_SERVER_ADDRESS = "https://index.docker.io/v1/";
2323

24-
@JsonProperty
24+
@JsonProperty("username")
2525
private String username;
2626

27-
@JsonProperty
27+
@JsonProperty("password")
2828
private String password;
2929

30-
@JsonProperty
30+
@JsonProperty("email")
3131
private String email;
3232

3333
@JsonProperty("serveraddress")
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import org.apache.commons.lang.builder.EqualsBuilder;
5+
import org.apache.commons.lang.builder.HashCodeBuilder;
6+
import org.apache.commons.lang.builder.ToStringBuilder;
7+
8+
import java.io.Serializable;
9+
10+
import static org.apache.commons.lang.builder.ToStringStyle.SHORT_PREFIX_STYLE;
11+
12+
public class BlkioRateDevice implements Serializable {
13+
public static final long serialVersionUID = 1L;
14+
15+
@JsonProperty("Path")
16+
private String path;
17+
18+
@JsonProperty("Rate")
19+
private Long rate;
20+
21+
public String getPath() {
22+
return path;
23+
}
24+
25+
public BlkioRateDevice withPath(String path) {
26+
this.path = path;
27+
return this;
28+
}
29+
30+
public Long getRate() {
31+
return rate;
32+
}
33+
34+
public BlkioRateDevice withRate(Long rate) {
35+
this.rate = rate;
36+
return this;
37+
}
38+
39+
@Override
40+
public String toString() {
41+
return ToStringBuilder.reflectionToString(this, SHORT_PREFIX_STYLE);
42+
}
43+
44+
@Override
45+
public boolean equals(Object o) {
46+
return EqualsBuilder.reflectionEquals(this, o);
47+
}
48+
49+
@Override
50+
public int hashCode() {
51+
return HashCodeBuilder.reflectionHashCode(this);
52+
}
53+
54+
}

0 commit comments

Comments
 (0)