@Override public boolean apply(Image input) { return input.getProviderId().equals(instance.getTemplateName()); } }
@Override public boolean apply(Image input) { return input.getProviderId().equals(instance.getImageId() + ""); } }
@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 Server addServer(String name, Template template, Ip availableIp) { Server addedServer = client.getServerServices().addServer(name, checkNotNull(template.getImage().getProviderId()), sizeToRam.apply(template.getHardware()), availableIp.getIp()); return addedServer; }
@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 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() + "")); } }
public void testListImages() throws Exception { for (Image image : client.listImages()) { assert image.getProviderId() != null : image; // image.getLocationId() can be null, if it is a location-free image assertEquals(image.getType(), ComputeType.IMAGE); } }
public void testListImages() throws Exception { for (Image image : client.listImages()) { assert image.getProviderId() != null : image; // image.getLocationId() can be null, if it is a location-free image assertEquals(image.getType(), ComputeType.IMAGE); } }
@Override public NodeAndInitialCredentials<Server> createNodeWithGroupEncodedIntoName(String tag, String name, Template template) { // create the backend object using parameters from the template. Server from = client.createServerInDC(template.getLocation().getId(), name, Integer.parseInt(template.getImage().getProviderId()), Integer.parseInt(template.getHardware().getProviderId())); return new NodeAndInitialCredentials<Server>(from, from.id + "", LoginCredentials.builder().user(from.loginUser) .password(from.password).build()); }
@Override public AtomicReference<NodeMetadata> call() throws Exception { NodeMetadata node = null; logger.debug(">> adding node location(%s) name(%s) image(%s) hardware(%s)", template.getLocation().getId(), name, MoreObjects.firstNonNull(template.getImage().getProviderId(), template.getImage().getId()), MoreObjects.firstNonNull(template.getHardware().getProviderId(), template.getHardware().getId())); node = addNodeWithGroupStrategy.createNodeWithGroupEncodedIntoName(group, name, template); logger.debug("<< %s node(%s)", formatStatus(node), node.getId()); return new AtomicReference<NodeMetadata>(node); }
private ImageReference createImageReference(Image image) { return isCustom(image.getId()) ? ImageReference.builder().customImageId(image.getProviderId()).build() : ImageReference .builder().publisher(image.getProviderId()).offer(image.getName()).sku(image.getVersion()) .version("latest").build(); }
private ImageReference createImageReference(Image image) { return isCustom(image.getId()) ? ImageReference.builder().customImageId(image.getProviderId()).build() : ImageReference .builder().publisher(image.getProviderId()).offer(image.getName()).sku(image.getVersion()) .version("latest").build(); }
@Override public NodeAndInitialCredentials<Server> createNodeWithGroupEncodedIntoName(String group, String name, Template template) { Server server = client .createServer(name, Integer.parseInt(template.getImage().getProviderId()), Integer.parseInt(template .getHardware().getProviderId()), withMetadata(metadataAndTagsAsCommaDelimitedValue(template.getOptions()))); return new NodeAndInitialCredentials<Server>(server, server.getId() + "", LoginCredentials.builder().password( server.getAdminPass()).build()); }
@Override public AtomicReference<NodeMetadata> call() throws Exception { NodeMetadata node = null; logger.debug(">> adding node location(%s) name(%s) image(%s) hardware(%s)", template.getLocation().getId(), name, template.getImage().getProviderId(), template.getHardware().getProviderId()); node = addNodeWithGroupStrategy.createNodeWithGroupEncodedIntoName(group, name, template); logger.debug("<< %s node(%s)", formatStatus(node), node.getId()); return new AtomicReference<NodeMetadata>(node); }
@Override public AtomicReference<NodeMetadata> call() throws Exception { NodeMetadata node = null; logger.debug(">> adding node location(%s) name(%s) image(%s) hardware(%s)", template.getLocation().getId(), name, template.getImage().getProviderId(), template.getHardware().getProviderId()); node = addNodeWithGroupStrategy.createNodeWithGroupEncodedIntoName(group, name, template); logger.debug("<< %s node(%s)", formatStatus(node), node.getId()); return new AtomicReference<NodeMetadata>(node); }
private void checkTemplate(Template defaultTemplate) { assertEquals(defaultTemplate.getImage().getId(), "RegionOne/15"); assertEquals(defaultTemplate.getImage().getProviderId(), "15"); assertEquals(defaultTemplate.getHardware().getId(), "RegionOne/1"); assertEquals(defaultTemplate.getHardware().getProviderId(), "1"); assertEquals(defaultTemplate.getLocation().getId(), "RegionOne"); assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); }
@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()); }