> @@ -113,4 +111,43 @@ public boolean apply(Location location) {
>
> return builder.build();
> }
> +
> + private Optional<? extends Image> findImage(Integer id) {
> + // Try to find the image by ID in the cache. The cache is indexed by
> slug (for public images) and by id (for
> + // private ones).
> + final String imageId = String.valueOf(id);
> + Optional<? extends Image> image =
> Optional.fromNullable(images.get().get(imageId));
> + if (!image.isPresent()) {
> + // If it is a public image (indexed by slug) but the "int" form of
> the id was provided, try to find it in the
> + // whole list of cached images
> + image = tryFind(images.get().values(), new Predicate<Image>() {
> + @Override
> + public boolean apply(Image input) {
> + return input.getProviderId().equals(imageId);
Right.
* jclouds Image ID = DigitalOcean Image slug (or image ID if the image is
private or does not have a slug associated).
* jclouds image Provider ID = DigitalOcean Image ID.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/63/files#r12831460