@Override public boolean apply(Droplet droplet) { return contains(ids, String.valueOf(droplet.id())); } });
@Override public boolean apply(Integer input) { checkNotNull(input, "droplet id"); Droplet droplet = api.dropletApi().get(input); return droplet != null && status == droplet.status(); } }
@Override public NodeMetadata apply(Droplet input) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(String.valueOf(input.id())); builder.name(input.name()); builder.hostname(input.name()); builder.group(groupNamingConvention.extractGroup(input.name())); builder.hardware(getHardware(input.sizeSlug())); builder.location(getLocation(input.region())); Optional<? extends Image> image = findImage(input.image(), input.region().slug()); if (image.isPresent()) { builder.imageId(image.get().getId()); logger.info(">> image with id %s for droplet %s was not found. " + "This might be because the image that was used to create the droplet has a new id.", input.image().id(), input.id()); builder.status(toPortableStatus.apply(input.status())); builder.backendStatus(input.status().name()); if (!input.getPublicAddresses().isEmpty()) { builder.publicAddresses(FluentIterable .from(input.getPublicAddresses()) .transform(new Function<Networks.Address, String>() { @Override if (!input.getPrivateAddresses().isEmpty()) { builder.privateAddresses(FluentIterable
@Override public Image call() throws Exception { if (imageAvailablePredicate.apply(snapshotEvent.id())) { org.jclouds.digitalocean2.domain.Image snapshot = api.imageApi().list().concat() .firstMatch(new Predicate<org.jclouds.digitalocean2.domain.Image>() { @Override public boolean apply(org.jclouds.digitalocean2.domain.Image input) { return input.name().equals(cloneTemplate.getName()); } }).get(); return imageTransformer.apply(ImageInRegion.create(snapshot, droplet.region().slug())); } throw new UncheckedTimeoutException("Image was not created within the time limit: " + cloneTemplate.getName()); } });
@Override public NodeMetadata apply(Droplet input) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(String.valueOf(input.id())); builder.name(input.name()); builder.hostname(input.name()); builder.group(groupNamingConvention.extractGroup(input.name())); builder.hardware(getHardware(input.sizeSlug())); builder.location(getLocation(input.region())); Optional<? extends Image> image = findImage(input.image(), input.region().slug()); if (image.isPresent()) { builder.imageId(image.get().getId()); logger.info(">> image with id %s for droplet %s was not found. " + "This might be because the image that was used to create the droplet has a new id.", input.image().id(), input.id()); builder.status(toPortableStatus.apply(input.status())); builder.backendStatus(input.status().name()); if (!input.getPublicAddresses().isEmpty()) { builder.publicAddresses(FluentIterable .from(input.getPublicAddresses()) .transform(new Function<Networks.Address, String>() { @Override if (!input.getPrivateAddresses().isEmpty()) { builder.privateAddresses(FluentIterable
@Override public Image call() throws Exception { if (imageAvailablePredicate.apply(snapshotEvent.id())) { org.jclouds.digitalocean2.domain.Image snapshot = api.imageApi().list().concat() .firstMatch(new Predicate<org.jclouds.digitalocean2.domain.Image>() { @Override public boolean apply(org.jclouds.digitalocean2.domain.Image input) { return input.name().equals(cloneTemplate.getName()); } }).get(); return imageTransformer.apply(ImageInRegion.create(snapshot, droplet.region().slug())); } throw new UncheckedTimeoutException("Image was not created within the time limit: " + cloneTemplate.getName()); } });
@Override public NodeMetadata apply(Droplet input) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(String.valueOf(input.id())); builder.name(input.name()); builder.hostname(input.name()); builder.group(groupNamingConvention.extractGroup(input.name())); builder.hardware(getHardware(input.sizeSlug())); builder.location(getLocation(input.region())); Optional<? extends Image> image = findImage(input.image(), input.region().slug()); if (image.isPresent()) { builder.imageId(image.get().getId()); logger.info(">> image with id %s for droplet %s was not found. " + "This might be because the image that was used to create the droplet has a new id.", input.image().id(), input.id()); builder.status(toPortableStatus.apply(input.status())); builder.backendStatus(input.status().name()); if (!input.getPublicAddresses().isEmpty()) { builder.publicAddresses(FluentIterable .from(input.getPublicAddresses()) .transform(new Function<Networks.Address, String>() { @Override if (!input.getPrivateAddresses().isEmpty()) { builder.privateAddresses(FluentIterable
@Override public boolean apply(Droplet droplet) { return contains(ids, String.valueOf(droplet.id())); } });
@Override public boolean apply(Integer input) { checkNotNull(input, "droplet id"); Droplet droplet = api.dropletApi().get(input); return droplet != null && status == droplet.status(); } }
@Override public Image call() throws Exception { if (imageAvailablePredicate.apply(snapshotEvent.id())) { org.jclouds.digitalocean2.domain.Image snapshot = api.imageApi().list().concat() .firstMatch(new Predicate<org.jclouds.digitalocean2.domain.Image>() { @Override public boolean apply(org.jclouds.digitalocean2.domain.Image input) { return input.name().equals(cloneTemplate.getName()); } }).get(); return imageTransformer.apply(ImageInRegion.create(snapshot, droplet.region().slug())); } throw new UncheckedTimeoutException("Image was not created within the time limit: " + cloneTemplate.getName()); } });
@Override public boolean apply(Droplet droplet) { return contains(ids, String.valueOf(droplet.id())); } });
@Override public boolean apply(Integer input) { checkNotNull(input, "droplet id"); Droplet droplet = api.dropletApi().get(input); return droplet != null && status == droplet.status(); } }
@Override public boolean apply(Droplet input) { return input.id() == dropletId; } }), "The created droplet must be in the list");
if (droplet.status() != Status.ACTIVE) { api.dropletApi().powerOn(dropletId); checkState(nodeRunningPredicate.apply(dropletId), "node was not powered on in the configured timeout");
if (droplet.status() != Status.ACTIVE) { api.dropletApi().powerOn(dropletId); checkState(nodeRunningPredicate.apply(dropletId), "node was not powered on in the configured timeout");