org.testifyproject.github.dockerjava.jaxrs.CreateImageCmdExec Maven / Gradle / Ivy
package org.testifyproject.testifyproject.github.dockerjava.jaxrs;
import static javax.ws.rs.client.Entity.entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import org.testifyproject.slf4j.Logger;
import org.testifyproject.slf4j.LoggerFactory;
import org.testifyproject.testifyproject.github.dockerjava.api.org.testifyproject.testifyprojectmand.CreateImageCmd;
import org.testifyproject.testifyproject.github.dockerjava.api.org.testifyproject.testifyprojectmand.CreateImageResponse;
import org.testifyproject.testifyproject.github.dockerjava.core.DockerClientConfig;
public class CreateImageCmdExec extends AbstrSyncDockerCmdExec implements
CreateImageCmd.Exec {
private static final Logger LOGGER = LoggerFactory.getLogger(CreateImageCmdExec.class);
public CreateImageCmdExec(WebTarget baseResource, DockerClientConfig dockerClientConfig) {
super(baseResource, dockerClientConfig);
}
@Override
protected CreateImageResponse execute(CreateImageCmd org.testifyproject.testifyprojectmand) {
WebTarget webResource = getBaseResource().path("/images/create").queryParam("repo", org.testifyproject.testifyprojectmand.getRepository())
.queryParam("tag", org.testifyproject.testifyprojectmand.getTag()).queryParam("fromSrc", "-");
LOGGER.trace("POST: {}", webResource);
return webResource.request().accept(MediaType.APPLICATION_OCTET_STREAM_TYPE)
.post(entity(org.testifyproject.testifyprojectmand.getImageStream(), MediaType.APPLICATION_OCTET_STREAM), CreateImageResponse.class);
}
}