use of com.spotify.docker.client.exceptions.NodeNotFoundException in project docker-client by spotify.
the class DefaultDockerClient method inspectNode.
@Override
public NodeInfo inspectNode(final String nodeId) throws DockerException, InterruptedException {
assertApiVersionIsAbove("1.24");
WebTarget resource = resource().path("nodes").path(nodeId);
try {
return request(GET, NodeInfo.class, resource, resource.request(APPLICATION_JSON_TYPE));
} catch (DockerRequestException e) {
switch(e.status()) {
case 404:
throw new NodeNotFoundException(nodeId);
case 503:
throw new NonSwarmNodeException("Node " + nodeId + " is not in a swarm", e);
default:
throw e;
}
}
}
use of com.spotify.docker.client.exceptions.NodeNotFoundException in project docker-client by spotify.
the class DefaultDockerClient method deleteNode.
@Override
public void deleteNode(final String nodeId, final boolean force) throws DockerException, InterruptedException {
assertApiVersionIsAbove("1.24");
final WebTarget resource = resource().path("nodes").path(nodeId).queryParam("force", String.valueOf(force));
try {
request(DELETE, resource, resource.request(APPLICATION_JSON_TYPE));
} catch (DockerRequestException e) {
switch(e.status()) {
case 404:
throw new NodeNotFoundException(nodeId);
case 503:
throw new NonSwarmNodeException("Node " + nodeId + " is not a swarm node", e);
default:
throw e;
}
}
}
use of com.spotify.docker.client.exceptions.NodeNotFoundException in project docker-client by spotify.
the class DefaultDockerClient method updateNode.
@Override
public void updateNode(final String nodeId, final Long version, final NodeSpec nodeSpec) throws DockerException, InterruptedException {
assertApiVersionIsAbove("1.24");
WebTarget resource = resource().path("nodes").path(nodeId).path("update").queryParam("version", version);
try {
request(POST, String.class, resource, resource.request(APPLICATION_JSON_TYPE), Entity.json(nodeSpec));
} catch (DockerRequestException e) {
switch(e.status()) {
case 404:
throw new NodeNotFoundException(nodeId);
case 503:
throw new NonSwarmNodeException("Node " + nodeId + " is not a swarm node", e);
default:
throw e;
}
}
}
Aggregations