Search in sources :

Example 1 with IDockerImageSearchResult

use of org.eclipse.linuxtools.docker.core.IDockerImageSearchResult in project jbosstools-openshift by jbosstools.

the class DeployImageWizard method getPushImageToRegistryJob.

private static PushImageToRegistryJob getPushImageToRegistryJob(final IDeployImageParameters model) {
    final IDockerConnection dockerConnection = model.getDockerConnection();
    final String imageName = model.getImageName();
    final String deployProjectName = model.getProject().getName();
    final IRegistryAccount registryAccount = new IRegistryAccount() {

        @Override
        public String getServerAddress() {
            return model.getTargetRegistryLocation();
        }

        @Override
        public String getUsername() {
            return model.getTargetRegistryUsername();
        }

        @Override
        public char[] getPassword() {
            return model.getTargetRegistryPassword().toCharArray();
        }

        @Override
        public String getEmail() {
            return null;
        }

        @Override
        public List<IRepositoryTag> getTags(String arg0) throws DockerException {
            return null;
        }

        @Override
        public boolean isVersion2() {
            return false;
        }

        @Override
        public List<IDockerImageSearchResult> getImages(String arg0) throws DockerException {
            return null;
        }
    };
    return new PushImageToRegistryJob(dockerConnection, registryAccount, deployProjectName, imageName);
}
Also used : IRepositoryTag(org.eclipse.linuxtools.docker.core.IRepositoryTag) IDockerImageSearchResult(org.eclipse.linuxtools.docker.core.IDockerImageSearchResult) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) IRegistryAccount(org.eclipse.linuxtools.docker.core.IRegistryAccount) PushImageToRegistryJob(org.jboss.tools.openshift.internal.core.docker.PushImageToRegistryJob)

Example 2 with IDockerImageSearchResult

use of org.eclipse.linuxtools.docker.core.IDockerImageSearchResult in project linuxtools by eclipse.

the class DockerConnection method searchImages.

@Override
public List<IDockerImageSearchResult> searchImages(final String term) throws DockerException {
    try {
        final List<ImageSearchResult> searchResults = client.searchImages(term);
        final List<IDockerImageSearchResult> results = new ArrayList<>();
        for (ImageSearchResult r : searchResults) {
            if (r.name().contains(term)) {
                results.add(new DockerImageSearchResult(r.description(), r.official(), r.automated(), r.name(), r.starCount()));
            }
        }
        return results;
    } catch (com.spotify.docker.client.exceptions.DockerException | InterruptedException e) {
        throw new DockerException(e);
    }
}
Also used : DockerException(org.eclipse.linuxtools.docker.core.DockerException) IDockerImageSearchResult(org.eclipse.linuxtools.docker.core.IDockerImageSearchResult) ArrayList(java.util.ArrayList) IDockerImageSearchResult(org.eclipse.linuxtools.docker.core.IDockerImageSearchResult) ImageSearchResult(com.spotify.docker.client.messages.ImageSearchResult) IDockerImageSearchResult(org.eclipse.linuxtools.docker.core.IDockerImageSearchResult)

Aggregations

IDockerImageSearchResult (org.eclipse.linuxtools.docker.core.IDockerImageSearchResult)2 ImageSearchResult (com.spotify.docker.client.messages.ImageSearchResult)1 ArrayList (java.util.ArrayList)1 DockerException (org.eclipse.linuxtools.docker.core.DockerException)1 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)1 IRegistryAccount (org.eclipse.linuxtools.docker.core.IRegistryAccount)1 IRepositoryTag (org.eclipse.linuxtools.docker.core.IRepositoryTag)1 PushImageToRegistryJob (org.jboss.tools.openshift.internal.core.docker.PushImageToRegistryJob)1