Skip to content
Open
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 @@ -31,6 +31,7 @@
import com.github.dockerjava.api.command.InspectNetworkCmd;
import com.github.dockerjava.api.command.InspectServiceCmd;
import com.github.dockerjava.api.command.InspectSwarmCmd;
import com.github.dockerjava.api.command.InspectSwarmNodeCmd;
import com.github.dockerjava.api.command.InspectVolumeCmd;
import com.github.dockerjava.api.command.JoinSwarmCmd;
import com.github.dockerjava.api.command.KillContainerCmd;
Expand Down Expand Up @@ -359,6 +360,15 @@ public interface DockerClient extends Closeable {
*/
UpdateSwarmNodeCmd updateSwarmNodeCmd();

/**
* Inspect the swarm node
*
* @param swarmNodeId swarmNodeId
* @return the command
* @since 1.24
*/
InspectSwarmNodeCmd inspectSwarmNodeCmd(String swarmNodeId);

/**
* Remove the swarm node
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.github.dockerjava.api.command.InspectNetworkCmd;
import com.github.dockerjava.api.command.InspectServiceCmd;
import com.github.dockerjava.api.command.InspectSwarmCmd;
import com.github.dockerjava.api.command.InspectSwarmNodeCmd;
import com.github.dockerjava.api.command.InspectVolumeCmd;
import com.github.dockerjava.api.command.JoinSwarmCmd;
import com.github.dockerjava.api.command.KillContainerCmd;
Expand Down Expand Up @@ -442,6 +443,11 @@ public UpdateSwarmNodeCmd updateSwarmNodeCmd() {
return getDockerClient().updateSwarmNodeCmd();
}

@Override
public InspectSwarmNodeCmd inspectSwarmNodeCmd(String swarmNodeId) {
return getDockerClient().inspectSwarmNodeCmd(swarmNodeId);
}

@Override
public RemoveSwarmNodeCmd removeSwarmNodeCmd(String swarmNodeId) {
return getDockerClient().removeSwarmNodeCmd(swarmNodeId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.github.dockerjava.api.command.InspectNetworkCmd;
import com.github.dockerjava.api.command.InspectServiceCmd;
import com.github.dockerjava.api.command.InspectSwarmCmd;
import com.github.dockerjava.api.command.InspectSwarmNodeCmd;
import com.github.dockerjava.api.command.InspectVolumeCmd;
import com.github.dockerjava.api.command.JoinSwarmCmd;
import com.github.dockerjava.api.command.KillContainerCmd;
Expand Down Expand Up @@ -119,6 +120,7 @@
import com.github.dockerjava.core.command.ImageHistoryCmdImpl;
import com.github.dockerjava.core.command.InspectServiceCmdImpl;
import com.github.dockerjava.core.command.InspectSwarmCmdImpl;
import com.github.dockerjava.core.command.InspectSwarmNodeCmdImpl;
import com.github.dockerjava.core.command.InspectVolumeCmdImpl;
import com.github.dockerjava.core.command.JoinSwarmCmdImpl;
import com.github.dockerjava.core.command.KillContainerCmdImpl;
Expand Down Expand Up @@ -637,6 +639,11 @@ public UpdateSwarmNodeCmd updateSwarmNodeCmd() {
return new UpdateSwarmNodeCmdImpl(getDockerCmdExecFactory().updateSwarmNodeCmdExec());
}

@Override
public InspectSwarmNodeCmd inspectSwarmNodeCmd(String swarmNodeId) {
return new InspectSwarmNodeCmdImpl(getDockerCmdExecFactory().inspectSwarmNodeCmdExec(), swarmNodeId);
}

@Override
public RemoveSwarmNodeCmd removeSwarmNodeCmd(String swarmNodeId) {
return new RemoveSwarmNodeCmdImpl(getDockerCmdExecFactory().removeSwarmNodeCmdExec(), swarmNodeId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.github.dockerjava.cmd.swarm;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.model.SwarmNode;
import org.junit.Test;

import java.util.List;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class InspectSwarmNodeCmdExecIT extends SwarmCmdIT {

@Test
public void testInspectSwarmNode() {
DockerClient dockerClient = startSwarm();

List<SwarmNode> nodes = dockerClient.listSwarmNodesCmd().exec();
assertThat(nodes.size(), is(1));

String nodeId = nodes.get(0).getId();
SwarmNode node = dockerClient.inspectSwarmNodeCmd(nodeId).exec();

assertThat(node.getId(), is(nodeId));
}
}