southeast region for s3

This commit is contained in:
Adrian Cole 2010-05-05 10:02:45 -07:00
parent b40dc14a14
commit 4a52ee950b
5 changed files with 19 additions and 8 deletions

View File

@ -23,10 +23,11 @@ import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME;
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AWS_ACCESSKEYID;
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AWS_SECRETACCESSKEY;
import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_ENDPOINT;
import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_SESSIONINTERVAL;
import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_ENDPOINT_AP_SOUTHEAST_1;
import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_ENDPOINT_EU_WEST_1;
import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_ENDPOINT_US_STANDARD;
import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_ENDPOINT_US_WEST_1;
import static org.jclouds.aws.s3.reference.S3Constants.PROPERTY_S3_SESSIONINTERVAL;
import static org.jclouds.blobstore.reference.BlobStoreConstants.DIRECTORY_SUFFIX_FOLDER;
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX;
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
@ -51,7 +52,8 @@ public class S3PropertiesBuilder extends PropertiesBuilder {
properties.setProperty(PROPERTY_S3_ENDPOINT_US_STANDARD, "https://s3.amazonaws.com");
properties.setProperty(PROPERTY_S3_ENDPOINT_US_WEST_1, "https://s3-us-west-1.amazonaws.com");
properties.setProperty(PROPERTY_S3_ENDPOINT_EU_WEST_1, "https://s3-eu-west-1.amazonaws.com");
properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "x-amz-meta-");
properties.setProperty(PROPERTY_S3_ENDPOINT_AP_SOUTHEAST_1,
"https://s3-ap-southeast-1.amazonaws.com");
properties.setProperty(PROPERTY_S3_SESSIONINTERVAL, "60");
properties.setProperty(PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX, DIRECTORY_SUFFIX_FOLDER);
return properties;

View File

@ -105,9 +105,11 @@ public class S3RestClientModule extends AbstractModule {
Map<String, URI> provideRegions(
@Named(S3Constants.PROPERTY_S3_ENDPOINT_US_STANDARD) String usstandard,
@Named(S3Constants.PROPERTY_S3_ENDPOINT_US_WEST_1) String uswest,
@Named(S3Constants.PROPERTY_S3_ENDPOINT_AP_SOUTHEAST_1) String southeast,
@Named(S3Constants.PROPERTY_S3_ENDPOINT_EU_WEST_1) String euwest) {
return ImmutableMap.<String, URI> of(Region.US_STANDARD, URI.create(usstandard),
Region.US_WEST_1, URI.create(uswest), Region.EU_WEST_1, URI.create(euwest));
Region.AP_SOUTHEAST_1, URI.create(southeast), Region.US_WEST_1, URI.create(uswest),
Region.EU_WEST_1, URI.create(euwest));
}
@Provides

View File

@ -53,11 +53,15 @@ public class BindRegionToXmlPayload extends BindToStringPayload {
checkArgument(input instanceof String, "this binder is only valid for Region!");
String constraint = (String) input;
String value = null;
if(Region.US_STANDARD.equals(constraint) || Region.US_EAST_1.equals(constraint)) {
if (Region.US_STANDARD.equals(constraint) || Region.US_EAST_1.equals(constraint)) {
// nothing to bind as this is default.
return;
} else if(Region.EU_WEST_1.equals(constraint)) value = "EU";
else if(Region.US_WEST_1.equals(constraint)) value = "us-west-1";
} else if (Region.EU_WEST_1.equals(constraint))
value = "EU";
else if (Region.US_WEST_1.equals(constraint))
value = "us-west-1";
else if (Region.AP_SOUTHEAST_1.equals(constraint))
value = "ap-southeast-1";
else {
throw new IllegalStateException("unimplemented location: " + this);
}

View File

@ -44,5 +44,6 @@ public interface S3Constants extends AWSConstants, S3Headers {
public static final String PROPERTY_S3_ENDPOINT_EU_WEST_1 = "jclouds.s3.endpoint.eu_west_1";
public static final String PROPERTY_S3_ENDPOINT_US_STANDARD = "jclouds.s3.endpoint.us_standard";
public static final String PROPERTY_S3_ENDPOINT_US_WEST_1 = "jclouds.s3.endpoint.us_west_1";
public static final String PROPERTY_S3_ENDPOINT_AP_SOUTHEAST_1 = "jclouds.s3.endpoint.ap_southeast_1";
}

View File

@ -51,8 +51,10 @@ public class LocationConstraintHandler extends ParseSax.HandlerWithResult<String
return Region.US_STANDARD;
if (v.equals("EU"))
return Region.EU_WEST_1;
else if (v.equals("us-west-1"))
else if (v.equals(Region.US_WEST_1))
return Region.US_WEST_1;
else if (v.equals(Region.AP_SOUTHEAST_1))
return Region.AP_SOUTHEAST_1;
throw new IllegalStateException("unimplemented location: " + v);
}