use of org.opentosca.toscana.plugins.kubernetes.docker.mapper.model.DockerImage 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));
}
use of org.opentosca.toscana.plugins.kubernetes.docker.mapper.model.DockerImage in project TOSCAna by StuPro-TOSCAna.
the class MapperEngine method performMapping.
/**
* Perfoms the mapping to the base image
*/
private String performMapping(OsCapability capability, String tag, String distro) {
DockerImage img = tagStorage.get(distro);
String architecture = getCapabilityArchitecture(capability).orElseThrow(() -> new UnsupportedOperationException("Architecture not supported!"));
DockerImageTag imgTag = img.findTagByName(tag).get();
if (imgTag.isSupported(architecture)) {
return img.getUsername() + "/" + img.getRepository() + ":" + imgTag.getName();
} else {
throw new UnsupportedOperationException("Could not map to base image. " + "The image '" + img.getUsername() + "/" + img.getRepository() + ":" + tag + "' " + "does not support the architecture " + architecture);
}
}
use of org.opentosca.toscana.plugins.kubernetes.docker.mapper.model.DockerImage in project TOSCAna by StuPro-TOSCAna.
the class MapperEngine method hasKnownDistributionName.
private boolean hasKnownDistributionName(OsCapability capability) {
if (capability.getDistribution().isPresent()) {
String distroName = convertDistributionName(capability);
DockerImage image = tagStorage.get(distroName);
return image != null;
}
return false;
}
Aggregations