libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vd...@apache.org
Subject [1/8] libcloud git commit: feat: add support about region of '''cn-northwest-1'
Date Tue, 25 Sep 2018 08:48:20 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk bad71c41e -> f54cd847d


feat: add support about region of '''cn-northwest-1'


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/358b9fa8
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/358b9fa8
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/358b9fa8

Branch: refs/heads/trunk
Commit: 358b9fa8ad124a088bb1f8a0a97012c78aeac3b7
Parents: 8a84929
Author: yangkang <yangkang@gagogroup.com>
Authored: Thu Sep 13 23:34:08 2018 +0800
Committer: yangkang <yangkang@gagogroup.com>
Committed: Thu Sep 13 23:34:08 2018 +0800

----------------------------------------------------------------------
 libcloud/storage/drivers/s3.py | 18 ++++++++--
 libcloud/storage/providers.py  | 72 +++++++++++++++++++------------------
 libcloud/storage/types.py      |  1 +
 3 files changed, 53 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/358b9fa8/libcloud/storage/drivers/s3.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py
index 6b94157..792be11 100644
--- a/libcloud/storage/drivers/s3.py
+++ b/libcloud/storage/drivers/s3.py
@@ -16,10 +16,10 @@
 import base64
 import hmac
 import time
-
 from hashlib import sha1
 
 import libcloud.utils.py3
+
 try:
     if libcloud.utils.py3.DEFAULT_LXML:
         from lxml.etree import Element, SubElement
@@ -48,7 +48,6 @@ from libcloud.storage.types import ContainerDoesNotExistError
 from libcloud.storage.types import ObjectDoesNotExistError
 from libcloud.storage.types import ObjectHashMismatchError
 
-
 # How long before the token expires
 EXPIRATION_SECONDS = 15 * 60
 
@@ -58,6 +57,7 @@ S3_US_WEST_HOST = 's3-us-west-1.amazonaws.com'
 S3_US_WEST_OREGON_HOST = 's3-us-west-2.amazonaws.com'
 S3_US_GOV_WEST_HOST = 's3-us-gov-west-1.amazonaws.com'
 S3_CN_NORTH_HOST = 's3.cn-north-1.amazonaws.com.cn'
+S3_CN_NORTHWEST_HOST = 's3.cn-northwest-1.amazonaws.com.cn'
 S3_EU_WEST_HOST = 's3-eu-west-1.amazonaws.com'
 S3_EU_WEST2_HOST = 's3-eu-west-2.amazonaws.com'
 S3_EU_CENTRAL_HOST = 's3-eu-central-1.amazonaws.com'
@@ -727,7 +727,6 @@ class BaseS3StorageDriver(StorageDriver):
             # pylint: disable=maybe-no-member
             for node in body.findall(fixxpath(xpath='Upload',
                                               namespace=self.namespace)):
-
                 initiator = node.find(fixxpath(xpath='Initiator',
                                                namespace=self.namespace))
                 owner = node.find(fixxpath(xpath='Owner',
@@ -1050,6 +1049,17 @@ class S3USGovWestStorageDriver(S3StorageDriver):
     region_name = 'us-gov-west-1'
 
 
+class S3CNNorthWestConnection(S3SignatureV4Connection):
+    host = S3_CN_NORTHWEST_HOST
+
+
+class S3CNNorthWestStorageDriver(S3StorageDriver):
+    name = 'Amazon S3 (cn-northwest-1)'
+    connectionCls = S3CNNorthWestConnection
+    ex_location_name = 'cn-northwest-1'
+    region_name = 'cn-northwest-1'
+
+
 class S3CNNorthConnection(S3SignatureV4Connection):
     host = S3_CN_NORTH_HOST
 
@@ -1119,6 +1129,7 @@ class S3APSE2StorageDriver(S3StorageDriver):
 class S3APNE1Connection(S3SignatureV4Connection):
     host = S3_AP_NORTHEAST1_HOST
 
+
 S3APNEConnection = S3APNE1Connection
 
 
@@ -1128,6 +1139,7 @@ class S3APNE1StorageDriver(S3StorageDriver):
     ex_location_name = 'ap-northeast-1'
     region_name = 'ap-northeast-1'
 
+
 S3APNEStorageDriver = S3APNE1StorageDriver
 
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/358b9fa8/libcloud/storage/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/providers.py b/libcloud/storage/providers.py
index 183189e..c0bfbb6 100644
--- a/libcloud/storage/providers.py
+++ b/libcloud/storage/providers.py
@@ -13,77 +13,79 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from libcloud.storage.types import Provider
-from libcloud.storage.types import OLD_CONSTANT_TO_NEW_MAPPING
 from libcloud.common.providers import get_driver as _get_provider_driver
 from libcloud.common.providers import set_driver as _set_provider_driver
+from libcloud.storage.types import OLD_CONSTANT_TO_NEW_MAPPING
+from libcloud.storage.types import Provider
 
 DRIVERS = {
     Provider.DUMMY:
-    ('libcloud.storage.drivers.dummy', 'DummyStorageDriver'),
+        ('libcloud.storage.drivers.dummy', 'DummyStorageDriver'),
     Provider.CLOUDFILES:
-    ('libcloud.storage.drivers.cloudfiles', 'CloudFilesStorageDriver'),
+        ('libcloud.storage.drivers.cloudfiles', 'CloudFilesStorageDriver'),
     Provider.OPENSTACK_SWIFT:
-    ('libcloud.storage.drivers.cloudfiles', 'OpenStackSwiftStorageDriver'),
+        ('libcloud.storage.drivers.cloudfiles', 'OpenStackSwiftStorageDriver'),
     Provider.S3:
-    ('libcloud.storage.drivers.s3', 'S3StorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3StorageDriver'),
     Provider.S3_US_EAST2:
-    ('libcloud.storage.drivers.s3', 'S3USEast2StorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3USEast2StorageDriver'),
     Provider.S3_US_WEST:
-    ('libcloud.storage.drivers.s3', 'S3USWestStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3USWestStorageDriver'),
     Provider.S3_US_WEST_OREGON:
-    ('libcloud.storage.drivers.s3', 'S3USWestOregonStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3USWestOregonStorageDriver'),
     Provider.S3_US_GOV_WEST:
-    ('libcloud.storage.drivers.s3', 'S3USGovWestStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3USGovWestStorageDriver'),
     Provider.S3_CN_NORTH:
-    ('libcloud.storage.drivers.s3', 'S3CNNorthStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3CNNorthStorageDriver'),
+    Provider.S3_CN_NORTHQWEST:
+        ('libcloud.storage.drivers.s3', 'S3CNNorthWestStorageDriver'),
     Provider.S3_EU_WEST:
-    ('libcloud.storage.drivers.s3', 'S3EUWestStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3EUWestStorageDriver'),
     Provider.S3_EU_WEST2:
-    ('libcloud.storage.drivers.s3', 'S3EUWest2StorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3EUWest2StorageDriver'),
     Provider.S3_EU_CENTRAL:
-    ('libcloud.storage.drivers.s3', 'S3EUCentralStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3EUCentralStorageDriver'),
     Provider.S3_AP_SOUTH:
-    ('libcloud.storage.drivers.s3', 'S3APSouthStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3APSouthStorageDriver'),
     Provider.S3_AP_SOUTHEAST:
-    ('libcloud.storage.drivers.s3', 'S3APSEStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3APSEStorageDriver'),
     Provider.S3_AP_SOUTHEAST2:
-    ('libcloud.storage.drivers.s3', 'S3APSE2StorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3APSE2StorageDriver'),
     Provider.S3_AP_NORTHEAST:
-    ('libcloud.storage.drivers.s3', 'S3APNE1StorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3APNE1StorageDriver'),
     Provider.S3_AP_NORTHEAST1:
-    ('libcloud.storage.drivers.s3', 'S3APNE1StorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3APNE1StorageDriver'),
     Provider.S3_AP_NORTHEAST2:
-    ('libcloud.storage.drivers.s3', 'S3APNE2StorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3APNE2StorageDriver'),
     Provider.S3_SA_EAST:
-    ('libcloud.storage.drivers.s3', 'S3SAEastStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3SAEastStorageDriver'),
     Provider.S3_CA_CENTRAL:
-    ('libcloud.storage.drivers.s3', 'S3CACentralStorageDriver'),
+        ('libcloud.storage.drivers.s3', 'S3CACentralStorageDriver'),
     Provider.S3_RGW:
-    ('libcloud.storage.drivers.rgw', 'S3RGWStorageDriver'),
+        ('libcloud.storage.drivers.rgw', 'S3RGWStorageDriver'),
     Provider.S3_RGW_OUTSCALE:
-    ('libcloud.storage.drivers.rgw', 'S3RGWOutscaleStorageDriver'),
+        ('libcloud.storage.drivers.rgw', 'S3RGWOutscaleStorageDriver'),
     Provider.NINEFOLD:
-    ('libcloud.storage.drivers.ninefold', 'NinefoldStorageDriver'),
+        ('libcloud.storage.drivers.ninefold', 'NinefoldStorageDriver'),
     Provider.GOOGLE_STORAGE:
-    ('libcloud.storage.drivers.google_storage', 'GoogleStorageDriver'),
+        ('libcloud.storage.drivers.google_storage', 'GoogleStorageDriver'),
     Provider.NIMBUS:
-    ('libcloud.storage.drivers.nimbus', 'NimbusStorageDriver'),
+        ('libcloud.storage.drivers.nimbus', 'NimbusStorageDriver'),
     Provider.LOCAL:
-    ('libcloud.storage.drivers.local', 'LocalStorageDriver'),
+        ('libcloud.storage.drivers.local', 'LocalStorageDriver'),
     Provider.AZURE_BLOBS:
-    ('libcloud.storage.drivers.azure_blobs', 'AzureBlobsStorageDriver'),
+        ('libcloud.storage.drivers.azure_blobs', 'AzureBlobsStorageDriver'),
     Provider.KTUCLOUD:
-    ('libcloud.storage.drivers.ktucloud', 'KTUCloudStorageDriver'),
+        ('libcloud.storage.drivers.ktucloud', 'KTUCloudStorageDriver'),
     Provider.AURORAOBJECTS:
-    ('libcloud.storage.drivers.auroraobjects', 'AuroraObjectsStorageDriver'),
+        ('libcloud.storage.drivers.auroraobjects', 'AuroraObjectsStorageDriver'),
     Provider.BACKBLAZE_B2:
-    ('libcloud.storage.drivers.backblaze_b2', 'BackblazeB2StorageDriver'),
+        ('libcloud.storage.drivers.backblaze_b2', 'BackblazeB2StorageDriver'),
     Provider.ALIYUN_OSS:
-    ('libcloud.storage.drivers.oss', 'OSSStorageDriver'),
+        ('libcloud.storage.drivers.oss', 'OSSStorageDriver'),
     Provider.DIGITALOCEAN_SPACES:
-    ('libcloud.storage.drivers.digitalocean_spaces',
-     'DigitalOceanSpacesStorageDriver'),
+        ('libcloud.storage.drivers.digitalocean_spaces',
+         'DigitalOceanSpacesStorageDriver'),
 }
 
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/358b9fa8/libcloud/storage/types.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/types.py b/libcloud/storage/types.py
index 97c0477..39e6aed 100644
--- a/libcloud/storage/types.py
+++ b/libcloud/storage/types.py
@@ -92,6 +92,7 @@ class Provider(object):
     S3_AP_SOUTHEAST2 = 's3_ap_southeast2'
     S3_CA_CENTRAL = 's3_ca_central'
     S3_CN_NORTH = 's3_cn_north'
+    S3_CN_NORTHQWEST='s3_cn_northwest'
     S3_EU_WEST = 's3_eu_west'
     S3_EU_WEST2 = 's3_eu_west_2'
     S3_EU_CENTRAL = 's3_eu_central'


Mime
View raw message