Skip to content
Closed
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions libcloud/storage/drivers/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@
S3_AP_NORTHEAST_HOST = S3_AP_NORTHEAST1_HOST
S3_SA_EAST_HOST = 's3-sa-east-1.amazonaws.com'

S3_RGW_OUTSCALE_HOSTS_BY_REGION =\
{'eu-west-1': 'osu.eu-west-1.outscale.com',
'eu-west-2': 'osu.eu-west-2.outscale.com',
'us-west-1': 'osu.us-west-1.outscale.com',
'us-east-2': 'osu.us-east-2.outscale.com',
'cn-southeast-1': 'osu.cn-southeast-1.outscale.hk'}

S3_RGW_OUTSCALE_DEFAULT_REGION = 'eu-west-2'

API_VERSION = '2006-03-01'
NAMESPACE = 'http://s3.amazonaws.com/doc/%s/' % (API_VERSION)

Expand Down Expand Up @@ -1004,3 +1013,25 @@ class S3SAEastStorageDriver(S3StorageDriver):
name = 'Amazon S3 (sa-east-1)'
connectionCls = S3SAEastConnection
ex_location_name = 'sa-east-1'


class S3RGWOutscaleConnection(S3Connection):
pass


class S3RGWOutscaleStorageDriver(S3StorageDriver):

def __init__(self, key, secret=None, secure=True, host=None, port=None,
api_version=None, region=S3_RGW_OUTSCALE_DEFAULT_REGION,
**kwargs):
if region not in S3_RGW_OUTSCALE_HOSTS_BY_REGION:
raise LibcloudError('Unknown region (%s)' % (region), driver=self)
self.name = 'OUTSCALE Ceph RGW S3 (%s)' % (region)
self.ex_location_name = region
self.region_name = region
self.connectionCls = S3RGWOutscaleConnection
self.connectionCls.host = S3_RGW_OUTSCALE_HOSTS_BY_REGION[region]
super(S3RGWOutscaleStorageDriver, self).__init__(key, secret,
secure, host, port,
api_version, region,
**kwargs)
2 changes: 2 additions & 0 deletions libcloud/storage/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
('libcloud.storage.drivers.s3', 'S3APNE2StorageDriver'),
Provider.S3_SA_EAST:
('libcloud.storage.drivers.s3', 'S3SAEastStorageDriver'),
Provider.S3_RGW_OUTSCALE:
('libcloud.storage.drivers.s3', 'S3RGWOutscaleStorageDriver'),
Provider.NINEFOLD:
('libcloud.storage.drivers.ninefold', 'NinefoldStorageDriver'),
Provider.GOOGLE_STORAGE:
Expand Down
2 changes: 2 additions & 0 deletions libcloud/storage/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Provider(object):
:cvar S3_EU_WEST: Amazon S3 EU West (Ireland)
:cvar S3_AP_SOUTHEAST_HOST: Amazon S3 Asia South East (Singapore)
:cvar S3_AP_NORTHEAST_HOST: Amazon S3 Asia South East (Tokyo)
:cvar S3_RGW_OUTSCALE: OUTSCALE RGW S3
:cvar NINEFOLD: Ninefold
:cvar GOOGLE_STORAGE Google Storage
:cvar S3_US_WEST_OREGON: Amazon S3 US West 2 (Oregon)
Expand All @@ -54,6 +55,7 @@ class Provider(object):
S3_AP_NORTHEAST1 = 's3_ap_northeast_1'
S3_AP_NORTHEAST2 = 's3_ap_northeast_2'
S3_SA_EAST = 's3_sa_east'
S3_RGW_OUTSCALE = 's3_rgw_outscale'
NINEFOLD = 'ninefold'
GOOGLE_STORAGE = 'google_storage'
S3_US_WEST_OREGON = 's3_us_west_oregon'
Expand Down