use of com.spotify.docker.client.exceptions.ExecNotFoundException in project docker-client by spotify.
the class DefaultDockerClient method execResizeTty.
@Override
public void execResizeTty(final String execId, final Integer height, final Integer width) throws DockerException, InterruptedException {
checkTtyParams(height, width);
WebTarget resource = resource().path("exec").path(execId).path("resize");
if (height != null && height > 0) {
resource = resource.queryParam("h", height);
}
if (width != null && width > 0) {
resource = resource.queryParam("w", width);
}
try {
request(POST, resource, resource.request(TEXT_PLAIN_TYPE));
} catch (DockerRequestException e) {
switch(e.status()) {
case 404:
throw new ExecNotFoundException(execId, e);
default:
throw e;
}
}
}
use of com.spotify.docker.client.exceptions.ExecNotFoundException in project docker-client by spotify.
the class DefaultDockerClient method execStart.
@Override
public LogStream execStart(final String execId, final ExecStartParameter... params) throws DockerException, InterruptedException {
final WebTarget resource = noTimeoutResource().path("exec").path(execId).path("start");
final StringWriter writer = new StringWriter();
try {
final JsonGenerator generator = objectMapper().getFactory().createGenerator(writer);
generator.writeStartObject();
for (final ExecStartParameter param : params) {
generator.writeBooleanField(param.getName(), true);
}
generator.writeEndObject();
generator.close();
} catch (IOException e) {
throw new DockerException(e);
}
try {
return request(POST, LogStream.class, resource, resource.request("application/vnd.docker.raw-stream"), Entity.json(writer.toString()));
} catch (DockerRequestException e) {
switch(e.status()) {
case 404:
throw new ExecNotFoundException(execId, e);
case 409:
throw new ExecStartConflictException(execId, e);
default:
throw e;
}
}
}
Aggregations