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/boto/boto/route53/record.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month 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/boto/boto/route53/healthcheck.py ('k') | third_party/boto/boto/route53/zone.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/boto/boto/route53/record.py
===================================================================
--- third_party/boto/boto/route53/record.py (revision 33376)
+++ third_party/boto/boto/route53/record.py (working copy)
@@ -35,7 +35,7 @@
"""
ChangeResourceRecordSetsBody = """<?xml version="1.0" encoding="UTF-8"?>
- <ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2012-02-29/">
+ <ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
<ChangeBatch>
<Comment>%(comment)s</Comment>
<Changes>%(changes)s</Changes>
@@ -66,12 +66,13 @@
def add_change(self, action, name, type, ttl=600,
alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,
- weight=None, region=None):
+ weight=None, region=None, alias_evaluate_target_health=None,
+ health_check=None, failover=None):
"""
Add a change request to the set.
:type action: str
- :param action: The action to perform ('CREATE'|'DELETE')
+ :param action: The action to perform ('CREATE'|'DELETE'|'UPSERT')
:type name: str
:param name: The name of the domain you want to perform the action on.
@@ -118,11 +119,26 @@
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
+
+ :type alias_evaluate_target_health: Boolean
+ :param alias_evaluate_target_health: *Required for alias resource record sets* Indicates
+ whether this Resource Record Set should respect the health status of
+ any health checks associated with the ALIAS target record which it is
+ linked to.
+
+ :type health_check: str
+ :param health_check: Health check to associate with this record
+
+ :type failover: str
+ :param failover: *Failover resource record sets only* Whether this is the
+ primary or secondary resource record set.
"""
change = Record(name, type, ttl,
alias_hosted_zone_id=alias_hosted_zone_id,
alias_dns_name=alias_dns_name, identifier=identifier,
- weight=weight, region=region)
+ weight=weight, region=region,
+ alias_evaluate_target_health=alias_evaluate_target_health,
+ health_check=health_check, failover=failover)
self.changes.append([action, change])
return change
@@ -178,11 +194,14 @@
class Record(object):
"""An individual ResourceRecordSet"""
+ HealthCheckBody = """<HealthCheckId>%s</HealthCheckId>"""
+
XMLBody = """<ResourceRecordSet>
<Name>%(name)s</Name>
<Type>%(type)s</Type>
%(weight)s
%(body)s
+ %(health_check)s
</ResourceRecordSet>"""
WRRBody = """
@@ -195,6 +214,11 @@
<Region>%(region)s</Region>
"""
+ FailoverBody = """
+ <SetIdentifier>%(identifier)s</SetIdentifier>
+ <Failover>%(failover)s</Failover>
+ """
+
ResourceRecordsBody = """
<TTL>%(ttl)s</TTL>
<ResourceRecords>
@@ -206,15 +230,18 @@
</ResourceRecord>"""
AliasBody = """<AliasTarget>
- <HostedZoneId>%s</HostedZoneId>
- <DNSName>%s</DNSName>
+ <HostedZoneId>%(hosted_zone_id)s</HostedZoneId>
+ <DNSName>%(dns_name)s</DNSName>
+ %(eval_target_health)s
</AliasTarget>"""
+ EvaluateTargetHealth = """<EvaluateTargetHealth>%s</EvaluateTargetHealth>"""
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, region=None):
+ weight=None, region=None, alias_evaluate_target_health=None,
+ health_check=None, failover=None):
self.name = name
self.type = type
self.ttl = ttl
@@ -226,6 +253,9 @@
self.identifier = identifier
self.weight = weight
self.region = region
+ self.alias_evaluate_target_health = alias_evaluate_target_health
+ self.health_check = health_check
+ self.failover = failover
def __repr__(self):
return '<Record:%s:%s:%s>' % (self.name, self.type, self.to_print())
@@ -234,16 +264,25 @@
"""Add a resource record value"""
self.resource_records.append(value)
- def set_alias(self, alias_hosted_zone_id, alias_dns_name):
+ def set_alias(self, alias_hosted_zone_id, alias_dns_name,
+ alias_evaluate_target_health=False):
"""Make this an alias resource record set"""
self.alias_hosted_zone_id = alias_hosted_zone_id
self.alias_dns_name = alias_dns_name
+ self.alias_evaluate_target_health = alias_evaluate_target_health
def to_xml(self):
"""Spit this resource record set out as XML"""
if self.alias_hosted_zone_id is not None and self.alias_dns_name is not None:
# Use alias
- body = self.AliasBody % (self.alias_hosted_zone_id, self.alias_dns_name)
+ if self.alias_evaluate_target_health is not None:
+ eval_target_health = self.EvaluateTargetHealth % ('true' if self.alias_evaluate_target_health else 'false')
+ else:
+ eval_target_health = ""
+
+ body = self.AliasBody % { "hosted_zone_id": self.alias_hosted_zone_id,
+ "dns_name": self.alias_dns_name,
+ "eval_target_health": eval_target_health }
else:
# Use resource record(s)
records = ""
@@ -264,12 +303,20 @@
elif self.identifier is not None and self.region is not None:
weight = self.RRRBody % {"identifier": self.identifier, "region":
self.region}
+ elif self.identifier is not None and self.failover is not None:
+ weight = self.FailoverBody % {"identifier": self.identifier, "failover":
+ self.failover}
+ health_check = ""
+ if self.health_check is not None:
+ health_check = self.HealthCheckBody % (self.health_check)
+
params = {
"name": self.name,
"type": self.type,
"weight": weight,
"body": body,
+ "health_check": health_check
}
return self.XMLBody % params
@@ -278,6 +325,8 @@
if self.alias_hosted_zone_id is not None and self.alias_dns_name is not None:
# Show alias
rr = 'ALIAS ' + self.alias_hosted_zone_id + ' ' + self.alias_dns_name
+ if self.alias_evaluate_target_health is not None:
+ rr += ' (EvalTarget %s)' % self.alias_evaluate_target_health
else:
# Show resource record(s)
rr = ",".join(self.resource_records)
@@ -286,6 +335,8 @@
rr += ' (WRR id=%s, w=%s)' % (self.identifier, self.weight)
elif self.identifier is not None and self.region is not None:
rr += ' (LBR id=%s, region=%s)' % (self.identifier, self.region)
+ elif self.identifier is not None and self.failover is not None:
+ rr += ' (FAILOVER id=%s, failover=%s)' % (self.identifier, self.failover)
return rr
@@ -304,10 +355,16 @@
self.alias_dns_name = value
elif name == 'SetIdentifier':
self.identifier = value
+ elif name == 'EvaluateTargetHealth':
+ self.alias_evaluate_target_health = value.lower() == 'true'
elif name == 'Weight':
self.weight = value
elif name == 'Region':
self.region = value
+ elif name == 'Failover':
+ self.failover = value
+ elif name == 'HealthCheckId':
+ self.health_check = value
def startElement(self, name, attrs, connection):
return None
« no previous file with comments | « third_party/boto/boto/route53/healthcheck.py ('k') | third_party/boto/boto/route53/zone.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698