Duncan McGreggor has proposed merging 
lp:~dreamhosters/txaws/925050-update-regions into lp:txaws.

Requested reviews:
  txAWS Technical List (txaws-tech)
Related bugs:
  Bug #925050 in txAWS: "EC2 and S3: Update Region and Endpoint strings"
  https://bugs.launchpad.net/txaws/+bug/925050

For more details, see:
https://code.launchpad.net/~dreamhosters/txaws/925050-update-regions/+merge/91181

This code isn't used by anything internally yet, but the newest regions for 
supported services will provide folks with an easy reference.

New code that will use this will be done in bug #925052.
-- 
https://code.launchpad.net/~dreamhosters/txaws/925050-update-regions/+merge/91181
Your team txAWS Technical List is requested to review the proposed merge of 
lp:~dreamhosters/txaws/925050-update-regions into lp:txaws.
=== modified file 'Makefile'
--- Makefile	2012-01-27 07:22:34 +0000
+++ Makefile	2012-02-01 23:01:22 +0000
@@ -121,7 +121,7 @@
 
 check: MOD ?= txaws
 check: build
-	trial ./txaws
+	trial $(MOD)
 
 
 register:

=== modified file 'txaws/ec2/tests/test_client.py'
--- txaws/ec2/tests/test_client.py	2012-01-29 07:46:54 +0000
+++ txaws/ec2/tests/test_client.py	2012-02-01 23:01:22 +0000
@@ -2006,14 +2006,16 @@
         d.addCallback(self.assertTrue)
         return d
 
+
 class EC2ParserTestCase(TXAWSTestCase):
 
     def setUp(self):
         self.parser = client.Parser()
 
     def test_ec2_terminate_instances(self):
-        """ Given a well formed response from EC2, will we parse the correct thing. """
-
+        """
+        Given a well formed response from EC2, parse the correct thing.
+        """
         ec2_xml = """<?xml version="1.0" encoding="UTF-8"?>
 <TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/";>
     <requestId>d0adc305-7f97-4652-b7c2-6993b2bb8260</requestId>
@@ -2032,13 +2034,20 @@
     </instancesSet>
 </TerminateInstancesResponse>"""
         ec2_response = self.parser.terminate_instances(ec2_xml)
-        self.assertEquals([('i-cab0c1aa','running','shutting-down')], ec2_response)
+        self.assertEquals(
+            [('i-cab0c1aa', 'running', 'shutting-down')], ec2_response)
 
     def test_nova_terminate_instances(self):
-        """ Ensure parser can handle the somewhat non-standard response from nova
-        Note that the bug has been reported in nova here: 
-        https://launchpad.net/bugs/862680 """
+        """
+        Ensure parser can handle the somewhat non-standard response from nova
+        Note that the bug has been reported in nova here:
+          https://launchpad.net/bugs/862680
+        """
 
-        nova_xml = """<?xml version="1.0" ?><TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/";><requestId>4fe6643d-2346-4add-adb7-a1f61f37c043</requestId><return>true</return></TerminateInstancesResponse>"""
+        nova_xml = (
+            '<?xml version="1.0" ?><TerminateInstancesResponse '
+            'xmlns="http://ec2.amazonaws.com/doc/2008-12-01/";><requestId>'
+            '4fe6643d-2346-4add-adb7-a1f61f37c043</requestId>'
+            '<return>true</return></TerminateInstancesResponse>')
         nova_response = self.parser.terminate_instances(nova_xml)
         self.assertEquals([], nova_response)

=== added file 'txaws/regions.py'
--- txaws/regions.py	1970-01-01 00:00:00 +0000
+++ txaws/regions.py	2012-02-01 23:01:22 +0000
@@ -0,0 +1,67 @@
+# Copyright (C) 2009 Duncan McGreggor <dun...@canonical.com>
+# Copyright (C) 2009 Robert Collins <robe...@robertcollins.net>
+# Copyright (C) 2012 New Dream Network, LLC (DreamHost)
+# Licenced under the txaws licence available at /LICENSE in the txaws source.
+
+__all__ = ["REGION_US", "REGION_EU", "EC2_US_EAST", "EC2_US_WEST",
+"EC2_ASIA_PACIFIC", "EC2_EU_WEST", "EC2_SOUTH_AMERICA_EAST", "EC2_ALL_REGIONS"]
+
+
+# These old EC2 variable names are maintained for backwards compatibility.
+REGION_US = "US"
+REGION_EU = "EU"
+EC2_ENDPOINT_US = "https://us-east-1.ec2.amazonaws.com/";
+EC2_ENDPOINT_EU = "https://eu-west-1.ec2.amazonaws.com/";
+
+# These are the new EC2 variables.
+EC2_US_EAST = [
+    {"region": "US East (Northern Virginia) Region",
+     "endpoint": "https://ec2.us-east-1.amazonaws.com"}]
+EC2_US_WEST = [
+    {"region": "US West (Oregon) Region",
+     "endpoint": "https://ec2.us-west-2.amazonaws.com"},
+    {"region": "US West (Northern California) Region",
+     "endpoint": "https://ec2.us-west-1.amazonaws.com"}]
+EC2_US = EC2_US_EAST + EC2_US_WEST
+EC2_ASIA_PACIFIC = [
+    {"region": "Asia Pacific (Singapore) Region",
+     "endpoint": "https://ec2.ap-southeast-1.amazonaws.com"},
+    {"region": "Asia Pacific (Tokyo) Region",
+     "endpoint": "https://ec2.ap-northeast-1.amazonaws.com"}]
+EC2_EU_WEST = [
+    {"region": "EU (Ireland) Region",
+     "endpoint": "https://ec2.eu-west-1.amazonaws.com"}]
+EC2_EU = EC2_EU_WEST
+EC2_SOUTH_AMERICA_EAST = [
+    {"region": "South America (Sao Paulo) Region",
+     "endpoint": "https://ec2.sa-east-1.amazonaws.com"}]
+EC2_SOUTH_AMERICA = EC2_SOUTH_AMERICA_EAST
+EC2_ALL_REGIONS = EC2_US + EC2_ASIA_PACIFIC + EC2_EU + EC2_SOUTH_AMERICA
+
+# This old S3 variable is maintained for backwards compatibility.
+S3_ENDPOINT = "https://s3.amazonaws.com/";
+
+# These are the new S3 variables.
+S3_US_DEFAULT = [
+    {"region": "US Standard *",
+     "endpoint": "https://s3.amazonaws.com"}]
+S3_US_WEST = [
+    {"region": "US West (Oregon) Region",
+     "endpoint": "https://s3-us-west-2.amazonaws.com"},
+    {"region": "US West (Northern California) Region",
+     "endpoint": "https://s3-us-west-1.amazonaws.com"}]
+S3_ASIA_PACIFIC = [
+    {"region": "Asia Pacific (Singapore) Region",
+     "endpoint": "https://s3-ap-southeast-1.amazonaws.com"},
+    {"region": "Asia Pacific (Tokyo) Region",
+     "endpoint": "https://s3-ap-northeast-1.amazonaws.com"}]
+S3_US = S3_US_DEFAULT + S3_US_WEST
+S3_EU_WEST = [
+    {"region": "EU (Ireland) Region",
+     "endpoint": "https://s3-eu-west-1.amazonaws.com"}]
+S3_EU = S3_EU_WEST
+S3_SOUTH_AMERICA_EAST = [
+    {"region": "South America (Sao Paulo) Region",
+     "endpoint": "s3-sa-east-1.amazonaws.com"}]
+S3_SOUTH_AMERICA = S3_SOUTH_AMERICA_EAST
+S3_ALL_REGIONS = S3_US + S3_ASIA_PACIFIC + S3_EU + S3_SOUTH_AMERICA

=== modified file 'txaws/service.py'
--- txaws/service.py	2011-11-29 08:17:54 +0000
+++ txaws/service.py	2012-02-01 23:01:22 +0000
@@ -3,16 +3,19 @@
 # Licenced under the txaws licence available at /LICENSE in the txaws source.
 
 from txaws.credentials import AWSCredentials
+from txaws import regions
 from txaws.util import parse
 
+
 __all__ = ["AWSServiceEndpoint", "AWSServiceRegion", "REGION_US", "REGION_EU"]
 
 
-REGION_US = "US"
-REGION_EU = "EU"
-EC2_ENDPOINT_US = "https://us-east-1.ec2.amazonaws.com/";
-EC2_ENDPOINT_EU = "https://eu-west-1.ec2.amazonaws.com/";
-S3_ENDPOINT = "https://s3.amazonaws.com/";
+# These old variable names are maintained for backwards compatibility.
+REGION_US = regions.REGION_US
+REGION_EU = regions.REGION_EU
+EC2_ENDPOINT_US = regions.EC2_ENDPOINT_US
+EC2_ENDPOINT_EU = regions.EC2_ENDPOINT_EU
+S3_ENDPOINT = regions.S3_ENDPOINT
 
 
 class AWSServiceEndpoint(object):

_______________________________________________
Mailing list: https://launchpad.net/~txaws-dev
Post to     : txaws-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~txaws-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to