@Override public boolean apply(Image input) { return input.getProviderId().equals(instance.getImageId()) && (input.getLocation() == null || input.getLocation().equals(location) || input.getLocation().equals( location.getParent())); } }
@Override public RegionAndName apply(Image from) { checkState(from.getLocation() != null, "in ec2, image locations cannot be null; typically, they are Region-scoped"); return new RegionAndName(from.getLocation().getId(), from.getProviderId()); }
@Override public RegionAndName apply(Image from) { checkState(from.getLocation() != null, "in ec2, image locations cannot be null; typically, they are Region-scoped"); String[] segments = from.getId().split("/"); Preconditions.checkArgument(segments.length == 2, "Wrong form for AWS image ID: " + from); return new RegionAndName(segments[0], segments[1]); }
@Override public RegionAndName apply(Image from) { checkState(from.getLocation() != null, "in ec2, image locations cannot be null; typically, they are Region-scoped"); return new RegionAndName(from.getLocation().getId(), from.getProviderId()); }
@Override public RegionAndName apply(Image from) { checkState(from.getLocation() != null, "in ec2, image locations cannot be null; typically, they are Region-scoped"); String[] segments = from.getId().split("/"); Preconditions.checkArgument(segments.length == 2, "Wrong form for AWS image ID: " + from); return new RegionAndName(segments[0], segments[1]); }
@Override public RegionAndName apply(Image from) { checkState(from.getLocation() != null, "in ec2, image locations cannot be null; typically, they are Region-scoped"); String[] segments = from.getId().split("/"); Preconditions.checkArgument(segments.length == 2, "Wrong form for AWS image ID: " + from); return new RegionAndName(segments[0], segments[1]); }
@Override public boolean apply(Image input) { return input.getProviderId().equals(instance.getImage().getId() + "") && (input.getLocation() == null || input.getLocation().getId().equals( instance.getDatacenter().getId() + "")); } }
@Override public boolean apply(Image input) { return input.getProviderId().equals(instance.getImage().getId() + "") && (input.getLocation() == null || input.getLocation().getId().equals( instance.getDatacenter().getId() + "")); } }
@Override public boolean apply(Image input) { return input.getProviderId().equals(instance.getImage().getId() + "") && (input.getLocation() == null || input.getLocation().getId().equals( instance.getDatacenter().getId() + "")); } }
@Override public boolean apply(Image input) { return input.getProviderId().equals(instance.getImage().getId() + "") && (input.getLocation() == null || input.getLocation().getId().equals( instance.getDatacenter().getId() + "")); } }
@Override public boolean apply(Image input) { return input.getProviderId().equals(from.getTemplateId() + "") // either location free image (location is null) or in the same zone as the VM && (input.getLocation() == null || input.getId().equals(from.getZoneId() + "")); } }).orNull();
@Override public boolean apply(Image input) { return input.getProviderId().equals(from.getTemplateId() + "") // either location free image (location is null) or in the same zone as the VM && (input.getLocation() == null || input.getId().equals(from.getZoneId() + "")); } }).orNull();
@Override public boolean apply(Image input) { return input.getProviderId().equals(instance.getImage().getId() + "") && (input.getLocation() == null || input.getLocation().getId().equals( instance.getDatacenter().getId() + "")); } }
@Override public boolean apply(Image input) { return input.getProviderId().equals(from.getTemplateId() + "") // either location free image (location is null) or in the same zone as the VM && (input.getLocation() == null || input.getId().equals(from.getZoneId() + "")); } }).orNull();
private void listImages(ComputeService computeService) { log("list images"); for (Image image : computeService.listImages()) {// TODO log(String.format(" image location=%s, id=%s, name=%s, version=%s, osArch=%s, osfam=%s, osdesc=%s, desc=%s", image.getLocation(), image.getProviderId(), image.getName(), image.getVersion(), image .getOperatingSystem().getArch(), image.getOperatingSystem().getFamily(), image .getOperatingSystem().getDescription(), image.getDescription())); } }
@Test(enabled = true, dependsOnMethods = "testCorrectAuthException") public void testImagesResolveCorrectly() { Template defaultTemplate = client.templateBuilder().build(); assertEquals(defaultTemplate.getImage().getId(), defaultTemplate.getImage().getLocation().getId() + "/" + defaultTemplate.getImage().getProviderId()); Template byId = client.templateBuilder().imageId(defaultTemplate.getImage().getId()).build(); assertEquals(byId.getImage(), defaultTemplate.getImage()); }
@Test(enabled = true, dependsOnMethods = "testCorrectAuthException") public void testImagesResolveCorrectly() { Template defaultTemplate = client.templateBuilder().build(); assertEquals(defaultTemplate.getImage().getId(), defaultTemplate.getImage().getLocation().getId() + "/" + defaultTemplate.getImage().getProviderId()); Template byId = client.templateBuilder().imageId(defaultTemplate.getImage().getId()).build(); assertEquals(byId.getImage(), defaultTemplate.getImage()); }
public static ImageBuilder fromImage(Image image) { return new ImageBuilder().providerId(image.getProviderId()).name(image.getName()).id(image.getId()).location( image.getLocation()).uri(image.getUri()).userMetadata(image.getUserMetadata()).tags(image.getTags()) .version(image.getVersion()).description(image.getDescription()).operatingSystem( image.getOperatingSystem()).status(image.getStatus()).backendStatus(image.getBackendStatus()) .defaultCredentials(image.getDefaultCredentials()); }
public static ImageBuilder fromImage(Image image) { return new ImageBuilder().providerId(image.getProviderId()).name(image.getName()).id(image.getId()).location( image.getLocation()).uri(image.getUri()).userMetadata(image.getUserMetadata()).tags(image.getTags()) .version(image.getVersion()).description(image.getDescription()).operatingSystem( image.getOperatingSystem()).status(image.getStatus()).backendStatus(image.getBackendStatus()) .defaultCredentials(image.getDefaultCredentials()); }
public static ImageBuilder fromImage(Image image) { return new ImageBuilder().providerId(image.getProviderId()).name(image.getName()).id(image.getId()).location( image.getLocation()).uri(image.getUri()).userMetadata(image.getUserMetadata()).tags(image.getTags()) .version(image.getVersion()).description(image.getDescription()).operatingSystem( image.getOperatingSystem()).status(image.getStatus()).backendStatus(image.getBackendStatus()) .defaultCredentials(image.getDefaultCredentials()); }