Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/main/java/com/github/dockerjava/api/model/AuthConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public class AuthConfig implements Serializable {
@JsonProperty("identitytoken")
private String identitytoken;

/**
* @since {@link com.github.dockerjava.core.RemoteApiVersion#VERSION_1_25}
*/
@JsonProperty("stackOrchestrator")
private String stackOrchestrator;

public String getUsername() {
return username;
}
Expand Down Expand Up @@ -123,6 +129,20 @@ public AuthConfig withRegistrytoken(String registrytoken) {
return this;
}

/**
* @see #stackOrchestrator
*/
public String getStackOrchestrator() {
return stackOrchestrator;
}

/**
* @see #stackOrchestrator
*/
public void setStackOrchestrator(String stackOrchestrator) {
this.stackOrchestrator = stackOrchestrator;
}

@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
Expand Down
15 changes: 15 additions & 0 deletions src/test/java/com/github/dockerjava/api/model/AuthConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static com.github.dockerjava.test.serdes.JSONSamples.testRoundTrip;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -78,4 +79,18 @@ public void compatibleWithIdentitytoken() throws IOException {
final AuthConfig authConfig1 = new AuthConfig().withAuth(auth).withIdentityToken(identitytoken);
assertThat(authConfig1, equalTo(authConfig));
}

@Test
public void shouldNotFailWithStackOrchestratorInConfig() throws IOException {
final ObjectMapper mapper = new ObjectMapper();
final JavaType type = mapper.getTypeFactory().uncheckedSimpleType(AuthConfig.class);
final AuthConfig authConfig = testRoundTrip(RemoteApiVersion.VERSION_1_25,
"/other/AuthConfig/orchestrators.json",
type
);
assertThat(authConfig, notNullValue());
assertThat(authConfig.getAuth(), is(nullValue()));
assertThat(authConfig.getStackOrchestrator(), is("kubernetes"));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"stackOrchestrator" : "kubernetes"
}