Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions libcloud/storage/drivers/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def list_container_objects(self, container, ex_prefix=None):
:rtype: ``list`` of :class:`Object`
"""
return list(self.iterate_container_objects(container,
ex_prefix=ex_prefix))
ex_prefix=ex_prefix))

def iterate_container_objects(self, container, ex_prefix=None):
"""
Expand Down Expand Up @@ -846,7 +846,7 @@ def _put_object(self, container, object_name, upload_func,

def _to_containers(self, obj, xpath):
for element in obj.findall(fixxpath(xpath=xpath,
namespace=self.namespace)):
namespace=self.namespace)):
yield self._to_container(element)

def _to_objs(self, obj, xpath, container):
Expand Down Expand Up @@ -942,14 +942,28 @@ class S3USWestOregonStorageDriver(S3StorageDriver):
ex_location_name = 'us-west-2'


class S3CNNorthConnection(S3Connection):
class S3CNNorthConnection(SignedAWSConnection, BaseS3Connection):
host = S3_CN_NORTH_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(S3CNNorthConnection, self).__init__(
user_id, key, secure, host,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing - please use keyword arguments when calling a method (user_id=user_id, key=key, etc.). It makes code less error prone (now it's easy to accidentally break it if the argument order changes or similar).

port, url, timeout, proxy_url,
token, retry_delay, backoff,
4) # force version 4


class S3CNNorthStorageDriver(S3StorageDriver):
name = 'Amazon S3 (cn-north-1)'
connectionCls = S3CNNorthConnection
ex_location_name = 'CN'
ex_location_name = 'cn-north-1'
region_name = 'cn-north-1'
# v4 auth and multipart_upload currently do not work.
supports_s3_multipart_upload = False


class S3EUWestConnection(S3Connection):
Expand Down Expand Up @@ -1005,6 +1019,8 @@ class S3APNE2StorageDriver(S3StorageDriver):
connectionCls = S3APNE2Connection
ex_location_name = 'ap-northeast-2'
region_name = 'ap-northeast-2'
# v4 auth and multipart_upload currently do not work.
supports_s3_multipart_upload = False


class S3SAEastConnection(S3Connection):
Expand Down