Issue 238 asia/pac ec2

This commit is contained in:
Adrian Cole 2010-04-28 17:13:02 -07:00
parent 8d2ab81aec
commit bb681a8101
3 changed files with 16 additions and 19 deletions

View File

@ -78,7 +78,9 @@ public enum Region {
* for PUTS of new objects in your Amazon S3 bucket and eventual consistency for overwrite PUTS
* and DELETES.
*/
US_WEST_1;
US_WEST_1,
AP_SOUTHEAST_1;
public String value() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());

View File

@ -34,8 +34,6 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2;
import org.jclouds.aws.ec2.EC2AsyncClient;
@ -81,6 +79,7 @@ import org.jclouds.logging.Logger;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.RestContext;
import org.jclouds.ssh.SshClient;
import org.jclouds.util.Jsr330;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
@ -91,7 +90,8 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.inject.Provides;
import org.jclouds.util.Jsr330;
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;
/**
* Configures the {@link ComputeServiceContext}; requires {@link EC2ComputeService} bound.
@ -109,9 +109,9 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
bind(GetNodeMetadataStrategy.class).to(EC2GetNodeMetadataStrategy.class);
bind(RebootNodeStrategy.class).to(EC2RebootNodeStrategy.class);
bind(DestroyNodeStrategy.class).to(EC2DestroyNodeStrategy.class);
bind(new TypeLiteral<Function<RunningInstance, Map<String, String>>>(){}).
annotatedWith(Jsr330.named("volumeMapping")).
to(RunningInstanceToStorageMappingUnix.class).in(Scopes.SINGLETON);
bind(new TypeLiteral<Function<RunningInstance, Map<String, String>>>() {
}).annotatedWith(Jsr330.named("volumeMapping")).to(RunningInstanceToStorageMappingUnix.class)
.in(Scopes.SINGLETON);
}
@Provides
@ -258,21 +258,16 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
@Provides
@Singleton
Map<String, ? extends Location> provideLocations(Map<AvailabilityZone, Region> map) {
Set<Location> locations = Sets.newHashSet();
Map<String, Location> locations = Maps.newLinkedHashMap();
for (AvailabilityZone zone : map.keySet()) {
locations.add(new LocationImpl(LocationScope.ZONE, zone.toString(), zone.toString(), map
.get(zone).toString()));
locations.put(zone.toString(), new LocationImpl(LocationScope.ZONE, zone.toString(), zone
.toString(), map.get(zone).toString()));
}
for (Region region : map.values()) {
locations.add(new LocationImpl(LocationScope.REGION, region.toString(), region.toString(),
null));
locations.put(region.toString(), new LocationImpl(LocationScope.REGION, region.toString(),
region.toString(), null));
}
return Maps.uniqueIndex(locations, new Function<Location, String>() {
@Override
public String apply(Location from) {
return from.getId();
}
});
return locations;
}
@Provides

View File

@ -30,7 +30,7 @@ import com.google.common.base.CaseFormat;
*/
public enum AvailabilityZone {
UNKNOWN, EU_WEST_1A, EU_WEST_1B, US_EAST_1A, US_EAST_1B, US_EAST_1C, US_EAST_1D, US_WEST_1A, US_WEST_1B;
UNKNOWN, EU_WEST_1A, EU_WEST_1B, US_EAST_1A, US_EAST_1B, US_EAST_1C, US_EAST_1D, US_WEST_1A, US_WEST_1B, AP_SOUTHEAST_1A, AP_SOUTHEAST_1B;
public String value() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());