trevorflanagan commented on this pull request.


> +@Singleton
+public class DatacenterToLocation implements Function<Datacenter, Location> {
+
+   private final JustProvider justProvider;
+
+   @Inject
+   public DatacenterToLocation(JustProvider justProvider) {
+      this.justProvider = checkNotNull(justProvider, "justProvider");
+   }
+
+   @Override
+   public Location apply(final Datacenter datacenter) {
+      return new 
LocationBuilder().id(datacenter.id()).description(datacenter.displayName())
+            
.parent(getOnlyElement(justProvider.get())).scope(LocationScope.ZONE)
+            .iso3166Codes(ImmutableSet.<String>of()).metadata(
+                  ImmutableMap.<String, Object>of("name", 
datacenter.displayName(), "city", datacenter.city(), "state",

@btrishkin - I found an issue yesterday for the state attribute  
`org.jclouds.dimensiondata.cloudcontrol.domain.Datacenter#state`. In DD model 
this value is nullable. ImmutableMap will not allow null values. We should only 
add this value if it is not null. Would you mind annotating 
`org.jclouds.dimensiondata.cloudcontrol.domain.Datacenter#state` with 
`@Nullable`?

> +import static com.google.inject.internal.util.$Preconditions.checkNotNull;
+
+@Singleton
+public class DatacenterToLocation implements Function<Datacenter, Location> {
+
+   private final JustProvider justProvider;
+
+   @Inject
+   public DatacenterToLocation(JustProvider justProvider) {
+      this.justProvider = checkNotNull(justProvider, "justProvider");
+   }
+
+   @Override
+   public Location apply(final Datacenter datacenter) {
+      return new 
LocationBuilder().id(datacenter.id()).description(datacenter.displayName())
+            
.parent(getOnlyElement(justProvider.get())).scope(LocationScope.ZONE)

In DD we do have the concept of regions, but for each of the regions we will 
have a different API endpoint. When we use DD from within jclouds we will 
operate on a single region only. Within each region we will have multiple 
zones. So in my view a Datacenter is equivalent to a Zone.  

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/423#pullrequestreview-85262906

Reply via email to