diff options
author | Mitch Garnaat <mitch@garnaat.com> | 2012-03-21 17:30:26 -0700 |
---|---|---|
committer | Mitch Garnaat <mitch@garnaat.com> | 2012-03-21 17:30:26 -0700 |
commit | d21fc68da99c7aecfd7b13d16e50bb1ba540c5ea (patch) | |
tree | 478cf29006979a15de313f38d742cd6d229d30d3 | |
parent | b29fb9a75c3aaafa31252869e520af740d87d8aa (diff) | |
download | boto-d21fc68da99c7aecfd7b13d16e50bb1ba540c5ea.tar.gz |
Patches from Barnaby Gray to support new latency-based routing for Route53.
-rw-r--r-- | boto/route53/connection.py | 4 | ||||
-rw-r--r-- | boto/route53/record.py | 28 |
2 files changed, 25 insertions, 7 deletions
diff --git a/boto/route53/connection.py b/boto/route53/connection.py index 7c3f1b88..0ae63c14 100644 --- a/boto/route53/connection.py +++ b/boto/route53/connection.py @@ -48,10 +48,10 @@ class Route53Connection(AWSAuthConnection): DefaultHost = 'route53.amazonaws.com' """The default Route53 API endpoint to connect to.""" - Version = '2011-05-05' + Version = '2012-02-29' """Route53 API version.""" - XMLNameSpace = 'https://route53.amazonaws.com/doc/2011-05-05/' + XMLNameSpace = 'https://route53.amazonaws.com/doc/2012-02-29/' """XML schema for this Route53 API version.""" def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, diff --git a/boto/route53/record.py b/boto/route53/record.py index 629258a4..d4fca362 100644 --- a/boto/route53/record.py +++ b/boto/route53/record.py @@ -59,7 +59,7 @@ class ResourceRecordSets(ResultSet): def add_change(self, action, name, type, ttl=600, alias_hosted_zone_id=None, alias_dns_name=None, identifier=None, - weight=None): + weight=None, region=None): """ Add a change request to the set. @@ -96,8 +96,8 @@ class ResourceRecordSets(ResultSet): Information about the domain to which you are redirecting traffic. :type identifier: str - :param identifier: *Weighted resource record sets only* An - identifier that differentiates among multiple resource + :param identifier: *Weighted and latency-based resource record sets + only* An identifier that differentiates among multiple resource record sets that have the same combination of DNS name and type. :type weight: int @@ -105,11 +105,17 @@ class ResourceRecordSets(ResultSet): record sets that have the same combination of DNS name and type, a value that determines what portion of traffic for the current resource record set is routed to the associated location + + :type region: str + :param region: *Latency-based resource record sets only* Among resource + record sets that have the same combination of DNS name and type, + a value that determines which region this should be associated with + for the latency-based routing """ change = Record(name, type, ttl, alias_hosted_zone_id=alias_hosted_zone_id, alias_dns_name=alias_dns_name, identifier=identifier, - weight=weight) + weight=weight, region=None) self.changes.append([action, change]) return change @@ -169,6 +175,11 @@ class Record(object): <Weight>%(weight)s</Weight> """ + RRRBody = """ + <SetIdentifier>%(identifier)s</SetIdentifier> + <Region>%(region)s</Region> + """ + ResourceRecordsBody = """ <TTL>%(ttl)s</TTL> <ResourceRecords> @@ -188,7 +199,7 @@ class Record(object): def __init__(self, name=None, type=None, ttl=600, resource_records=None, alias_hosted_zone_id=None, alias_dns_name=None, identifier=None, - weight=None): + weight=None, region=None): self.name = name self.type = type self.ttl = ttl @@ -199,6 +210,7 @@ class Record(object): self.alias_dns_name = alias_dns_name self.identifier = identifier self.weight = weight + self.region = region def add_value(self, value): """Add a resource record value""" @@ -227,6 +239,10 @@ class Record(object): if self.identifier != None and self.weight != None: weight = self.WRRBody % {"identifier": self.identifier, "weight": self.weight} + elif self.identifier != None and self.region != None: + weight = self.RRRBody % {"identifier": self.identifier, "region": + self.region} + params = { "name": self.name, "type": self.type, @@ -266,6 +282,8 @@ class Record(object): self.identifier = value elif name == 'Weight': self.weight = value + elif name == 'Region': + self.region = value def startElement(self, name, attrs, connection): return None |