use of com.spotify.docker.client.exceptions.NonSwarmNodeException 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