jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Shoemaker <ryan.shoema...@enterprisedb.com>
Subject Re: Flavor filter helper
Date Wed, 15 Jun 2016 18:29:43 GMT
Thanks, not a problem.  Here's what I came up with:

ComputeServiceContext computeServiceContext = ...;
NovaApi api = computeServiceContext.unwrapApi(NovaApi.class);
FlavorApi flavorApi = api.getFlavorApiForZone(...);
ImageApi imageApi = api.getImageApi(...);
Image i = imageApi.get(...);

FluentIterable<?extends Resource> flavors = flavorApi.listInDetail().concat().filter(
     new Predicate<Flavor>() {
     @Override public boolean apply(Flavor input) {
         return input.getDisk() >=i.getMinDisk() && input.getRam() >=i.getMinRam();
         }
     });

--Ryan On Jun15 1:57 PM, Ignasi Barrera wrote:
>
> Hi Ryan,
>
> Apologies for the late reply.
>
> Unfortunately there is no such helper. The current jclouds portable 
> model does not have those minimum requirements represented in the 
> Image entity (which would be a nice to have, btw) so there is no 
> portable filter yet.
>
> I.
>
> El 7 jun. 2016 9:33 p. m., "Ryan Shoemaker" 
> <ryan.shoemaker@enterprisedb.com 
> <mailto:ryan.shoemaker@enterprisedb.com>> escribió:
>
>     Hi, Is there a built-in helper method that returns only those
>     flavors meeting the minimum requirements specified by a given
>     image? Thanks, --Ryan 
>

Mime
View raw message