> -   public Iterable<MachineType> listHardwareProfiles() {
> -      return 
> api.getMachineTypeApiForProject(userProject.get()).list().concat();
> +   public Iterable<MachineTypeInZone> listHardwareProfiles() {
> +      return FluentIterable.from(zones.get().values())
> +              .transformAndConcat(new Function<Location, 
> ImmutableSet<MachineType>>() {
> +         @Override
> +         public ImmutableSet<MachineType> apply(Location input) {
> +            return 
> api.getMachineTypeApiForProject(userProject.get()).listInZone(input.getId()).concat().toSet();
> +         }
> +      }).transform(new Function<MachineType, MachineTypeInZone>() {
> +
> +         @Override
> +         public MachineTypeInZone apply(MachineType arg0) {
> +            return new MachineTypeInZone(arg0, arg0.getZone());
> +         }
> +      }).toSet();

Good question. In earlier iterations, pre-MachineTypeInZone (not that that 
particular change made a difference - just meant adding the second transform), 
I had:
```java
public Iterable<MachineType> listHardwareProfiles() {
      ImmutableSet.Builder<MachineType> builder = ImmutableSet.builder();
      for (final Location zone : zones.get().values()) {
         
builder.addAll(api.getMachineTypeApiForProject(userProject.get()).listInZone(zone.getId()).concat());
      }
      return builder.build();
}
```

...and for some reason, I kept getting just the machineTypes from the *first* 
zone. But now I think that was due to another problem that I caught later 
(equality check on MachineType didn't take zone into equation). Once I deal 
with the various and sundry sure things that need to be cleaned up, I'll 
revisit this and see how it works with the imperative approach.

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

Reply via email to