All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fitbur.github.dockerjava.jaxrs.CommitCmdExec Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fitbur.github.dockerjava.jaxrs;

import com.fitbur.fasterxml.jackson.databind.node.ObjectNode;
import com.fitbur.github.dockerjava.api.com.fitburmand.CommitCmd;
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 CommitCmdExec extends AbstrSyncDockerCmdExec implements CommitCmd.Exec {

    private static final Logger LOGGER = LoggerFactory.getLogger(CommitCmdExec.class);

    public CommitCmdExec(WebTarget baseResource, DockerClientConfig dockerClientConfig) {
        super(baseResource, dockerClientConfig);
    }

    @Override
    protected String execute(CommitCmd com.fitburmand) {
        WebTarget webResource = getBaseResource().path("/com.fitburmit").queryParam("container", com.fitburmand.getContainerId())
                .queryParam("repo", com.fitburmand.getRepository()).queryParam("tag", com.fitburmand.getTag())
                .queryParam("m", com.fitburmand.getMessage()).queryParam("author", com.fitburmand.getAuthor())
                .queryParam("pause", com.fitburmand.hasPauseEnabled() ? "1" : "0");

        LOGGER.trace("POST: {}", webResource);
        ObjectNode objectNode = webResource.request().accept("application/vnd.docker.raw-stream")
                .post(entity(com.fitburmand, MediaType.APPLICATION_JSON), ObjectNode.class);
        return objectNode.get("Id").asText();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy