You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Ryan Shoemaker <ry...@enterprisedb.com> on 2016/06/07 19:33:07 UTC

Flavor filter helper

Hi,

Is there a built-in helper method that returns only those flavors 
meeting the minimum requirements specified by a given image?

Thanks,

--Ryan

Re: Flavor filter helper

Posted by Ryan Shoemaker <ry...@enterprisedb.com>.
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 
> <ma...@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 
>

Re: Flavor filter helper

Posted by Ignasi Barrera <na...@apache.org>.
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" <ry...@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