Search in sources :

Example 1 with Image

use of org.opentosca.toscana.plugins.kubernetes.docker.mapper.api.model.Image in project TOSCAna by StuPro-TOSCAna.

the class BaseImageMapper method addImagesForType.

/**
 *     Internal method used for converting the Data received from docker to the data model described
 *     in the <code>model</code> package
 */
private void addImagesForType(DockerBaseImages baseImage, List<ImageTags> pages) {
    List<DockerImageTag> tagList = new ArrayList<>();
    for (ImageTags page : pages) {
        for (ImageTag imageTag : page.getImageTags()) {
            Set<String> architectures = new HashSet<>();
            for (Image image : imageTag.getImages()) {
                // is amd64 in that case.
                if (image.getArchitecture() == null) {
                    architectures.add("amd64");
                } else {
                    architectures.add(image.getArchitecture());
                }
            }
            DockerImageTag tag = new DockerImageTag(imageTag.getName(), architectures);
            tagList.add(tag);
        }
    }
    tagStorage.put(baseImage.name().toLowerCase(), new DockerImage(baseImage, tagList));
}
Also used : ImageTag(org.opentosca.toscana.plugins.kubernetes.docker.mapper.api.model.ImageTag) DockerImageTag(org.opentosca.toscana.plugins.kubernetes.docker.mapper.model.DockerImageTag) ArrayList(java.util.ArrayList) DockerImage(org.opentosca.toscana.plugins.kubernetes.docker.mapper.model.DockerImage) DockerImageTag(org.opentosca.toscana.plugins.kubernetes.docker.mapper.model.DockerImageTag) DockerImage(org.opentosca.toscana.plugins.kubernetes.docker.mapper.model.DockerImage) Image(org.opentosca.toscana.plugins.kubernetes.docker.mapper.api.model.Image) ImageTags(org.opentosca.toscana.plugins.kubernetes.docker.mapper.api.model.ImageTags) HashSet(java.util.HashSet)

Aggregations

ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Image (org.opentosca.toscana.plugins.kubernetes.docker.mapper.api.model.Image)1 ImageTag (org.opentosca.toscana.plugins.kubernetes.docker.mapper.api.model.ImageTag)1 ImageTags (org.opentosca.toscana.plugins.kubernetes.docker.mapper.api.model.ImageTags)1 DockerImage (org.opentosca.toscana.plugins.kubernetes.docker.mapper.model.DockerImage)1 DockerImageTag (org.opentosca.toscana.plugins.kubernetes.docker.mapper.model.DockerImageTag)1