use of org.eclipse.che.plugin.docker.client.exception.NetworkNotFoundException in project che by eclipse.
the class DockerConnector method removeNetwork.
/**
* Removes network matching provided params
*
* @throws NetworkNotFoundException
* if network is not found
* @throws IOException
* when a problem occurs with docker api calls
*/
public void removeNetwork(RemoveNetworkParams params) throws IOException {
try (DockerConnection connection = connectionFactory.openConnection(dockerDaemonUri).method("DELETE").path(apiVersionPathPrefix + "/networks/" + params.getNetworkId())) {
final DockerResponse response = connection.request();
int status = response.getStatus();
if (status == 404) {
throw new NetworkNotFoundException(readAndCloseQuietly(response.getInputStream()));
}
if (status / 100 != 2) {
throw getDockerException(response);
}
}
}
Aggregations