Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,37 @@ public interface DockerCmdExecFactory extends Closeable {

DisconnectFromNetworkCmd.Exec createDisconnectFromNetworkCmdExec();

/**
* List all nodes. Node operations require the engine to be part of a swarm
*
* @since {@link RemoteApiVersion#VERSION_1_24}
*/
ListSwarmNodesCmd.Exec listSwarmNodeCmdExec();

/**
* Return low-level information on the node. Node operations require the engine to be part of a swarm
*
* @since {@link RemoteApiVersion#VERSION_1_24}
*/
InspectSwarmNodeCmd.Exec inspectSwarmNodeCmdExec();

/**
* Remove a node from the swarm. Node operations require the engine to be part of a swarm
*
* @since {@link RemoteApiVersion#VERSION_1_24}
*/
RemoveSwarmNodeCmd.Exec removeSwarmNodeCmdExec();

/**
* Update a node. Node operations require the engine to be part of a swarm
*
* @since {@link RemoteApiVersion#VERSION_1_24}
*/
UpdateSwarmNodeCmd.Exec updateSwarmNodeCmdExec();




@Override
void close() throws IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.github.dockerjava.api.command;


import com.github.dockerjava.api.exception.NotFoundException;
import com.github.dockerjava.api.model.SwarmNode;
import com.github.dockerjava.core.RemoteApiVersion;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

/**
* Inspect a swarmNode.
*
* @since {@link RemoteApiVersion#VERSION_1_24}
*/
public interface InspectSwarmNodeCmd extends SyncDockerCmd<SwarmNode> {

@CheckForNull
String getSwarmNodeId();

InspectSwarmNodeCmd withSwarmNodeId(@Nonnull String swarmNodeId);

/**
* @throws NotFoundException No such swarmNode
*/
@Override
SwarmNode exec() throws NotFoundException;

interface Exec extends DockerCmdSyncExec<InspectSwarmNodeCmd, SwarmNode> {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.github.dockerjava.api.command;

import com.github.dockerjava.api.model.SwarmNode;
import com.github.dockerjava.core.RemoteApiVersion;

import javax.annotation.CheckForNull;
import java.util.List;
import java.util.Map;

/**
* List SwarmNodes
*
* @since {@link RemoteApiVersion#VERSION_1_24}
*/
public interface ListSwarmNodesCmd extends SyncDockerCmd<List<SwarmNode>> {

@CheckForNull
Map<String, List<String>> getFilters();

/**
* @param ids - Show only swarmNodes with the given ids
*/
ListSwarmNodesCmd withIdFilter(List<String> ids);

/**
* @param names - Show only swarmNodes with the given names
*/
ListSwarmNodesCmd withNameFilter(List<String> names);

/**
* @param memberships - Show only swarmNodes with the given memberships
*/
ListSwarmNodesCmd withMembershipFilter(List<String> memberships);

/**
* @param roles - Show only swarmNodes with the given roles
*/
ListSwarmNodesCmd withRoleFilter(List<String> roles);

interface Exec extends DockerCmdSyncExec<ListSwarmNodesCmd, List<SwarmNode>> {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.github.dockerjava.api.command;

import com.github.dockerjava.api.exception.NotFoundException;
import com.github.dockerjava.core.RemoteApiVersion;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

/**
* Remove a swarmNode.
*
* @since {@link RemoteApiVersion#VERSION_1_24}
*/
public interface RemoveSwarmNodeCmd extends SyncDockerCmd<Void> {

@CheckForNull
String getSwarmNodeId();

@CheckForNull
Boolean hasForceEnabled();

RemoveSwarmNodeCmd withContainerId(@Nonnull String containerId);

RemoveSwarmNodeCmd withForce(Boolean force);

/**
* @throws NotFoundException No such swarmNode
*/
@Override
Void exec() throws NotFoundException;

interface Exec extends DockerCmdSyncExec<RemoveSwarmNodeCmd, Void> {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.github.dockerjava.api.command;

import com.github.dockerjava.api.model.SwarmNodeSpec;
import com.github.dockerjava.core.RemoteApiVersion;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

/**
* Update swarmNode spec
*
* @since {@link RemoteApiVersion#VERSION_1_24}
*/
public interface UpdateSwarmNodeCmd extends SyncDockerCmd<Void> {

@CheckForNull
String getSwarmNodeId();

UpdateSwarmNodeCmd withSwarmNodeId(@Nonnull String swarmNodeId);

@CheckForNull
SwarmNodeSpec getSwarmNodeSpec();

UpdateSwarmNodeCmd withSwarmNodeSpec(SwarmNodeSpec swarmNodeSpec);

interface Exec extends DockerCmdSyncExec<UpdateSwarmNodeCmd, Void> {
}
}
34 changes: 34 additions & 0 deletions src/main/java/com/github/dockerjava/api/model/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
* A node as returned by the /events API, for instance, when Swarm is used.
Expand All @@ -26,15 +29,46 @@ public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getAddr() {
return addr;
}

public void setAddr(String addr) {
this.addr = addr;
}

public String getIp() {
return ip;
}

public void setIp(String ip) {
this.ip = ip;
}

@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);
}
}
19 changes: 19 additions & 0 deletions src/main/java/com/github/dockerjava/api/model/Reachability.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.github.dockerjava.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.dockerjava.core.RemoteApiVersion;

/**
* @since {@link RemoteApiVersion#VERSION_1_24}
*/
public enum Reachability {

@JsonProperty("unknown")
UNKNOWN,

@JsonProperty("unreachable")
UNREACHABLE,

@JsonProperty("reachable")
REACHABLE
}
Loading