Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: third_party/gsutil/boto/boto/route53/connection.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/gsutil/boto/boto/route53/__init__.py ('k') | third_party/gsutil/boto/boto/route53/exception.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/gsutil/boto/boto/route53/connection.py
diff --git a/third_party/gsutil/20110627/boto/boto/route53/connection.py b/third_party/gsutil/boto/boto/route53/connection.py
similarity index 74%
rename from third_party/gsutil/20110627/boto/boto/route53/connection.py
rename to third_party/gsutil/boto/boto/route53/connection.py
index d2b6ec7177667331b1ae1a157ed9c5c911b56ea3..a0054d2bcafb8dcb7763022016644d589dcca3a5 100644
--- a/third_party/gsutil/20110627/boto/boto/route53/connection.py
+++ b/third_party/gsutil/boto/boto/route53/connection.py
@@ -45,10 +45,14 @@ HZXML = """<?xml version="1.0" encoding="UTF-8"?>
#boto.set_stream_logger('dns')
class Route53Connection(AWSAuthConnection):
-
DefaultHost = 'route53.amazonaws.com'
- Version = '2011-05-05'
- XMLNameSpace = 'https://route53.amazonaws.com/doc/2011-05-05/'
+ """The default Route53 API endpoint to connect to."""
+
+ Version = '2012-02-29'
+ """Route53 API version."""
+
+ 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,
port=None, proxy=None, proxy_port=None,
@@ -71,12 +75,20 @@ class Route53Connection(AWSAuthConnection):
# Hosted Zones
- def get_all_hosted_zones(self):
+ def get_all_hosted_zones(self, start_marker=None, zone_list=None):
"""
Returns a Python data structure with information about all
Hosted Zones defined for the AWS account.
+
+ :param int start_marker: start marker to pass when fetching additional
+ results after a truncated list
+ :param list zone_list: a HostedZones list to prepend to results
"""
- response = self.make_request('GET', '/%s/hostedzone' % self.Version)
+ params = {}
+ if start_marker:
+ params = {'marker': start_marker}
+ response = self.make_request('GET', '/%s/hostedzone' % self.Version,
+ params=params)
body = response.read()
boto.log.debug(body)
if response.status >= 300:
@@ -87,8 +99,14 @@ class Route53Connection(AWSAuthConnection):
item_marker=('HostedZone',))
h = boto.jsonresponse.XmlHandler(e, None)
h.parse(body)
+ if zone_list:
+ e['ListHostedZonesResponse']['HostedZones'].extend(zone_list)
+ while e['ListHostedZonesResponse'].has_key('NextMarker'):
+ next_marker = e['ListHostedZonesResponse']['NextMarker']
+ zone_list = e['ListHostedZonesResponse']['HostedZones']
+ e = self.get_all_hosted_zones(next_marker, zone_list)
return e
-
+
def get_hosted_zone(self, hosted_zone_id):
"""
Get detailed information about a particular Hosted Zone.
@@ -111,6 +129,23 @@ class Route53Connection(AWSAuthConnection):
h.parse(body)
return e
+ def get_hosted_zone_by_name(self, hosted_zone_name):
+ """
+ Get detailed information about a particular Hosted Zone.
+
+ :type hosted_zone_name: str
+ :param hosted_zone_name: The fully qualified domain name for the Hosted
+ Zone
+
+ """
+ if hosted_zone_name[-1] != '.':
+ hosted_zone_name += '.'
+ all_hosted_zones = self.get_all_hosted_zones()
+ for zone in all_hosted_zones['ListHostedZonesResponse']['HostedZones']:
+ #check that they gave us the FQDN for their zone
+ if zone['Name'] == hosted_zone_name:
+ return self.get_hosted_zone(zone['Id'].split('/')[-1])
+
def create_hosted_zone(self, domain_name, caller_ref=None, comment=''):
"""
Create a new Hosted Zone. Returns a Python data structure with
@@ -118,28 +153,25 @@ class Route53Connection(AWSAuthConnection):
:type domain_name: str
:param domain_name: The name of the domain. This should be a
- fully-specified domain, and should end with
- a final period as the last label indication.
- If you omit the final period, Amazon Route 53
- assumes the domain is relative to the root.
- This is the name you have registered with your
- DNS registrar. It is also the name you will
- delegate from your registrar to the Amazon
- Route 53 delegation servers returned in
- response to this request.A list of strings
- with the image IDs wanted
+ fully-specified domain, and should end with a final period
+ as the last label indication. If you omit the final period,
+ Amazon Route 53 assumes the domain is relative to the root.
+ This is the name you have registered with your DNS registrar.
+ It is also the name you will delegate from your registrar to
+ the Amazon Route 53 delegation servers returned in
+ response to this request.A list of strings with the image
+ IDs wanted.
:type caller_ref: str
:param caller_ref: A unique string that identifies the request
- and that allows failed CreateHostedZone requests
- to be retried without the risk of executing the
- operation twice.
- If you don't provide a value for this, boto will
- generate a Type 4 UUID and use that.
+ and that allows failed CreateHostedZone requests to be retried
+ without the risk of executing the operation twice. If you don't
+ provide a value for this, boto will generate a Type 4 UUID and
+ use that.
:type comment: str
- :param comment: Any comments you want to include about the hosted
- zone.
+ :param comment: Any comments you want to include about the hosted
+ zone.
"""
if caller_ref is None:
@@ -192,42 +224,42 @@ class Route53Connection(AWSAuthConnection):
:type type: str
:param type: The type of resource record set to begin the record
- listing from. Valid choices are:
+ listing from. Valid choices are:
- * A
- * AAAA
- * CNAME
- * MX
- * NS
- * PTR
- * SOA
- * SPF
- * SRV
- * TXT
+ * A
+ * AAAA
+ * CNAME
+ * MX
+ * NS
+ * PTR
+ * SOA
+ * SPF
+ * SRV
+ * TXT
- Valid values for weighted resource record sets:
+ Valid values for weighted resource record sets:
- * A
- * AAAA
- * CNAME
- * TXT
+ * A
+ * AAAA
+ * CNAME
+ * TXT
- Valid values for Zone Apex Aliases:
+ Valid values for Zone Apex Aliases:
- * A
- * AAAA
+ * A
+ * AAAA
:type name: str
:param name: The first name in the lexicographic ordering of domain
names to be retrieved
:type identifier: str
- :param identifier: In a hosted zone that includes weighted resource record
- sets (multiple resource record sets with the same DNS
- name and type that are differentiated only by SetIdentifier),
- if results were truncated for a given DNS name and type,
- the value of SetIdentifier for the next resource record
- set that has the current DNS name and type
+ :param identifier: In a hosted zone that includes weighted resource
+ record sets (multiple resource record sets with the same DNS
+ name and type that are differentiated only by SetIdentifier),
+ if results were truncated for a given DNS name and type,
+ the value of SetIdentifier for the next resource record
+ set that has the current DNS name and type
:type maxitems: int
:param maxitems: The maximum number of records
@@ -261,7 +293,7 @@ class Route53Connection(AWSAuthConnection):
:type xml_body: str
:param xml_body: The list of changes to be made, defined in the
- XML schema defined by the Route53 service.
+ XML schema defined by the Route53 service.
"""
uri = '/%s/hostedzone/%s/rrset' % (self.Version, hosted_zone_id)
@@ -288,8 +320,7 @@ class Route53Connection(AWSAuthConnection):
:type change_id: str
:param change_id: The unique identifier for the set of changes.
- This ID is returned in the response to the
- change_rrsets method.
+ This ID is returned in the response to the change_rrsets method.
"""
uri = '/%s/change/%s' % (self.Version, change_id)
« no previous file with comments | « third_party/gsutil/boto/boto/route53/__init__.py ('k') | third_party/gsutil/boto/boto/route53/exception.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698