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

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

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

import com.fitbur.github.dockerjava.api.com.fitburmand.ListImagesCmd;
import com.fitbur.github.dockerjava.api.model.Image;
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.GenericType;
import javax.ws.rs.core.MediaType;
import java.util.List;

import static com.fitbur.google.com.fitburmon.net.UrlEscapers.urlPathSegmentEscaper;

public class ListImagesCmdExec extends AbstrSyncDockerCmdExec> implements ListImagesCmd.Exec {

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

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

    @Override
    protected List execute(ListImagesCmd com.fitburmand) {
        WebTarget webResource = getBaseResource().path("/images/json").queryParam("all",
                com.fitburmand.hasShowAllEnabled() ? "1" : "0");

        if (com.fitburmand.getFilters() != null)
            webResource = webResource.queryParam("filters", urlPathSegmentEscaper().escape(com.fitburmand.getFilters()));

        LOGGER.trace("GET: {}", webResource);

        List images = webResource.request().accept(MediaType.APPLICATION_JSON)
                .get(new GenericType>() {
                });
        LOGGER.trace("Response: {}", images);

        return images;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy