com.fitbur.github.dockerjava.jaxrs.CreateImageCmdExec Maven / Gradle / Ivy
package com.fitbur.github.dockerjava.jaxrs;
import com.fitbur.github.dockerjava.api.com.fitburmand.CreateImageCmd;
import com.fitbur.github.dockerjava.api.com.fitburmand.CreateImageResponse;
import com.fitbur.github.dockerjava.core.DockerClientConfig;
import com.fitbur.slf4j.Logger;
import com.fitbur.slf4j.LoggerFactory;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import static javax.ws.rs.client.Entity.entity;
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 com.fitburmand) {
WebTarget webResource = getBaseResource().path("/images/create").queryParam("repo", com.fitburmand.getRepository())
.queryParam("tag", com.fitburmand.getTag()).queryParam("fromSrc", "-");
LOGGER.trace("POST: {}", webResource);
return webResource.request().accept(MediaType.APPLICATION_OCTET_STREAM_TYPE)
.post(entity(com.fitburmand.getImageStream(), MediaType.APPLICATION_OCTET_STREAM), CreateImageResponse.class);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy