S3 provider / driver / connection for AWS Seoul region
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4e1176e7 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4e1176e7 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4e1176e7 Branch: refs/heads/trunk Commit: 4e1176e792f1ab9689ef14589f9e16b1b28dea9d Parents: 27074aa Author: Geunwoo Shin <[email protected]> Authored: Thu Jan 28 00:08:49 2016 +0900 Committer: anthony-shaw <[email protected]> Committed: Tue Feb 9 15:12:48 2016 +1100 ---------------------------------------------------------------------- libcloud/storage/drivers/s3.py | 38 ++++++++++++++++++++++++++++++++----- libcloud/storage/providers.py | 6 +++++- libcloud/storage/types.py | 2 ++ 3 files changed, 40 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/4e1176e7/libcloud/storage/drivers/s3.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py index d774f42..079f357 100644 --- a/libcloud/storage/drivers/s3.py +++ b/libcloud/storage/drivers/s3.py @@ -35,7 +35,8 @@ from libcloud.utils.xml import fixxpath, findtext from libcloud.utils.files import read_in_chunks from libcloud.common.types import InvalidCredsError, LibcloudError from libcloud.common.base import ConnectionUserAndKey, RawResponse -from libcloud.common.aws import AWSBaseResponse, AWSDriver, AWSTokenConnection +from libcloud.common.aws import AWSBaseResponse, AWSDriver, AWSTokenConnection, \ + SignedAWSConnection from libcloud.storage.base import Object, Container, StorageDriver from libcloud.storage.types import ContainerError @@ -54,7 +55,9 @@ S3_US_WEST_HOST = 's3-us-west-1.amazonaws.com' S3_US_WEST_OREGON_HOST = 's3-us-west-2.amazonaws.com' S3_EU_WEST_HOST = 's3-eu-west-1.amazonaws.com' S3_AP_SOUTHEAST_HOST = 's3-ap-southeast-1.amazonaws.com' -S3_AP_NORTHEAST_HOST = 's3-ap-northeast-1.amazonaws.com' +S3_AP_NORTHEAST1_HOST = 's3-ap-northeast-1.amazonaws.com' +S3_AP_NORTHEAST2_HOST = 's3-ap-northeast-2.amazonaws.com' +S3_AP_NORTHEAST_HOST = S3_AP_NORTHEAST1_HOST S3_SA_EAST_HOST = 's3-sa-east-1.amazonaws.com' API_VERSION = '2006-03-01' @@ -958,15 +961,40 @@ class S3APSEStorageDriver(S3StorageDriver): ex_location_name = 'ap-southeast-1' -class S3APNEConnection(S3Connection): - host = S3_AP_NORTHEAST_HOST +class S3APNE1Connection(S3Connection): + host = S3_AP_NORTHEAST1_HOST +S3APNEConnection = S3APNE1Connection -class S3APNEStorageDriver(S3StorageDriver): + +class S3APNE1StorageDriver(S3StorageDriver): name = 'Amazon S3 (ap-northeast-1)' connectionCls = S3APNEConnection ex_location_name = 'ap-northeast-1' +S3APNEStorageDriver = S3APNE1StorageDriver + + +class S3APNE2Connection(SignedAWSConnection, BaseS3Connection): + host = S3_AP_NORTHEAST2_HOST + service_name = 's3' + version = API_VERSION + + def __init__(self, user_id, key, secure=True, host=None, port=None, + url=None, timeout=None, proxy_url=None, token=None, + retry_delay=None, backoff=None): + super(S3APNE2Connection, self).__init__(user_id, key, secure, host, + port, url, timeout, proxy_url, + token, retry_delay, backoff, + 4) # force version 4 + + +class S3APNE2StorageDriver(S3StorageDriver): + name = 'Amazon S3 (ap-northeast-2)' + connectionCls = S3APNE2Connection + ex_location_name = 'ap-northeast-2' + region_name = 'ap-northeast-2' + class S3SAEastConnection(S3Connection): host = S3_SA_EAST_HOST http://git-wip-us.apache.org/repos/asf/libcloud/blob/4e1176e7/libcloud/storage/providers.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/providers.py b/libcloud/storage/providers.py index 1e79acf..f02588c 100644 --- a/libcloud/storage/providers.py +++ b/libcloud/storage/providers.py @@ -35,7 +35,11 @@ DRIVERS = { Provider.S3_AP_SOUTHEAST: ('libcloud.storage.drivers.s3', 'S3APSEStorageDriver'), Provider.S3_AP_NORTHEAST: - ('libcloud.storage.drivers.s3', 'S3APNEStorageDriver'), + ('libcloud.storage.drivers.s3', 'S3APNE1StorageDriver'), + Provider.S3_AP_NORTHEAST1: + ('libcloud.storage.drivers.s3', 'S3APNE1StorageDriver'), + Provider.S3_AP_NORTHEAST2: + ('libcloud.storage.drivers.s3', 'S3APNE2StorageDriver'), Provider.S3_SA_EAST: ('libcloud.storage.drivers.s3', 'S3SAEastStorageDriver'), Provider.NINEFOLD: http://git-wip-us.apache.org/repos/asf/libcloud/blob/4e1176e7/libcloud/storage/types.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/types.py b/libcloud/storage/types.py index 0ac45f1..837897f 100644 --- a/libcloud/storage/types.py +++ b/libcloud/storage/types.py @@ -50,6 +50,8 @@ class Provider(object): S3_EU_WEST = 's3_eu_west' S3_AP_SOUTHEAST = 's3_ap_southeast' S3_AP_NORTHEAST = 's3_ap_northeast' + S3_AP_NORTHEAST1 = 's3_ap_northeast_1' + S3_AP_NORTHEAST2 = 's3_ap_northeast_2' S3_SA_EAST = 's3_sa_east' NINEFOLD = 'ninefold' GOOGLE_STORAGE = 'google_storage'
