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

com.fitbur.github.dockerjava.jaxrs.WaitContainerCmdExec 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.WaitContainerCmd;
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;

public class WaitContainerCmdExec extends AbstrSyncDockerCmdExec implements
        WaitContainerCmd.Exec {

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

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

    @Override
    protected Integer execute(WaitContainerCmd com.fitburmand) {
        WebTarget webResource = getBaseResource().path("/containers/{id}/wait").resolveTemplate("id",
                com.fitburmand.getContainerId());

        LOGGER.trace("POST: {}", webResource);
        ObjectNode ObjectNode = webResource.request().accept(MediaType.APPLICATION_JSON).post(null, ObjectNode.class);

        return ObjectNode.get("StatusCode").asInt();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy