> +
> +               @Override
> +               public boolean apply(Image input) {
> +                  String toParse = input.getUserMetadata().get("size");
> +                  return toParse != null && new Float(toParse) <= size;
> +               }
> +
> +               @Override
> +               public String toString() {
> +                  return "sizeLessThanOrEqual(" + size + ")";
> +               }
> +
> +            }).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, 
> cpu))).hypervisor("kvm")
> +                  .volumes(ImmutableList.<Volume>of(new VolumeImpl(size, 
> true, true))).build());
> +         }
> +      return hardware.build();

Sure. For example, hardware profiles are defined in the 
[EC2HardwareBuilder](https://github.com/jclouds/jclouds/blob/master/apis/ec2/src/main/java/org/jclouds/ec2/compute/domain/EC2HardwareBuilder.java),
 and then the 
[EC2HardwareSupplier](https://github.com/jclouds/jclouds/blob/master/apis/ec2/src/main/java/org/jclouds/ec2/compute/suppliers/EC2HardwareSupplier.java)
 is bound to the context and injected to the computeservice, so it can be used 
to list the existing hardware profiles.

This provides users a clean way to select a hardware profile. Something like:

```java
Template template = compute.templateBuilder()
    .fromHardware(EC2HardwareBuilder.t1_micro().build())
    .build();
```

It was just a suggestion, though. Having an object for each existing hardware 
profile (if they are fixed) is a good idea and can help.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12/files#r5289204

Reply via email to