use of com.spotify.docker.client.exceptions.NotFoundException in project docker-client by spotify.
the class DefaultDockerClient method disconnectFromNetwork.
@Override
public void disconnectFromNetwork(String containerId, String networkId, boolean force) throws DockerException, InterruptedException {
final WebTarget resource = resource().path("networks").path(networkId).path("disconnect");
final Map<String, Object> request = new HashMap<>();
request.put("Container", containerId);
request.put("Force", force);
try {
request(POST, String.class, resource, resource.request(APPLICATION_JSON_TYPE), Entity.json(request));
} catch (DockerRequestException e) {
switch(e.status()) {
case 404:
final String message = String.format("Container %s or network %s not found.", containerId, networkId);
throw new NotFoundException(message, e);
default:
throw e;
}
}
}
use of com.spotify.docker.client.exceptions.NotFoundException in project docker-client by spotify.
the class DefaultDockerClient method deleteSecret.
@Override
public void deleteSecret(final String secretId) throws DockerException, InterruptedException {
assertApiVersionIsAbove("1.25");
final WebTarget resource = resource().path("secrets").path(secretId);
try {
request(DELETE, resource, resource.request(APPLICATION_JSON_TYPE));
} catch (final DockerRequestException ex) {
switch(ex.status()) {
case 404:
throw new NotFoundException("Secret " + secretId + " not found.", ex);
default:
throw ex;
}
}
}
Aggregations