mirror of https://github.com/apache/jclouds.git
Issue 238 asia/pac ec2
This commit is contained in:
parent
8d2ab81aec
commit
bb681a8101
|
@ -78,7 +78,9 @@ public enum Region {
|
||||||
* for PUTS of new objects in your Amazon S3 bucket and eventual consistency for overwrite PUTS
|
* for PUTS of new objects in your Amazon S3 bucket and eventual consistency for overwrite PUTS
|
||||||
* and DELETES.
|
* and DELETES.
|
||||||
*/
|
*/
|
||||||
US_WEST_1;
|
US_WEST_1,
|
||||||
|
|
||||||
|
AP_SOUTHEAST_1;
|
||||||
|
|
||||||
public String value() {
|
public String value() {
|
||||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||||
|
|
|
@ -34,8 +34,6 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import com.google.inject.Scopes;
|
|
||||||
import com.google.inject.TypeLiteral;
|
|
||||||
import org.jclouds.aws.domain.Region;
|
import org.jclouds.aws.domain.Region;
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.EC2AsyncClient;
|
import org.jclouds.aws.ec2.EC2AsyncClient;
|
||||||
|
@ -81,6 +79,7 @@ import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
|
import org.jclouds.util.Jsr330;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicate;
|
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.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.inject.Provides;
|
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.
|
* Configures the {@link ComputeServiceContext}; requires {@link EC2ComputeService} bound.
|
||||||
|
@ -109,9 +109,9 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
|
||||||
bind(GetNodeMetadataStrategy.class).to(EC2GetNodeMetadataStrategy.class);
|
bind(GetNodeMetadataStrategy.class).to(EC2GetNodeMetadataStrategy.class);
|
||||||
bind(RebootNodeStrategy.class).to(EC2RebootNodeStrategy.class);
|
bind(RebootNodeStrategy.class).to(EC2RebootNodeStrategy.class);
|
||||||
bind(DestroyNodeStrategy.class).to(EC2DestroyNodeStrategy.class);
|
bind(DestroyNodeStrategy.class).to(EC2DestroyNodeStrategy.class);
|
||||||
bind(new TypeLiteral<Function<RunningInstance, Map<String, String>>>(){}).
|
bind(new TypeLiteral<Function<RunningInstance, Map<String, String>>>() {
|
||||||
annotatedWith(Jsr330.named("volumeMapping")).
|
}).annotatedWith(Jsr330.named("volumeMapping")).to(RunningInstanceToStorageMappingUnix.class)
|
||||||
to(RunningInstanceToStorageMappingUnix.class).in(Scopes.SINGLETON);
|
.in(Scopes.SINGLETON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
@ -258,21 +258,16 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
Map<String, ? extends Location> provideLocations(Map<AvailabilityZone, Region> map) {
|
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()) {
|
for (AvailabilityZone zone : map.keySet()) {
|
||||||
locations.add(new LocationImpl(LocationScope.ZONE, zone.toString(), zone.toString(), map
|
locations.put(zone.toString(), new LocationImpl(LocationScope.ZONE, zone.toString(), zone
|
||||||
.get(zone).toString()));
|
.toString(), map.get(zone).toString()));
|
||||||
}
|
}
|
||||||
for (Region region : map.values()) {
|
for (Region region : map.values()) {
|
||||||
locations.add(new LocationImpl(LocationScope.REGION, region.toString(), region.toString(),
|
locations.put(region.toString(), new LocationImpl(LocationScope.REGION, region.toString(),
|
||||||
null));
|
region.toString(), null));
|
||||||
}
|
}
|
||||||
return Maps.uniqueIndex(locations, new Function<Location, String>() {
|
return locations;
|
||||||
@Override
|
|
||||||
public String apply(Location from) {
|
|
||||||
return from.getId();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -30,7 +30,7 @@ import com.google.common.base.CaseFormat;
|
||||||
*/
|
*/
|
||||||
public enum AvailabilityZone {
|
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() {
|
public String value() {
|
||||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||||
|
|
Loading…
Reference in New Issue