summaryrefslogtreecommitdiff
path: root/bin/route53
diff options
context:
space:
mode:
authorFrancisco J Martin <martin@bigml.com>2011-10-16 23:11:28 -0700
committerJim Browne <jbrowne@jbrowne.com>2012-01-26 00:14:18 -0800
commita636d0a92e7e97013f1ae8dace451c5cd45d0fb8 (patch)
tree4864e9091b827085534ac59559b7d27b50fb2108 /bin/route53
parent4719049cfba9ecee4e491ebcc1e547108903eade (diff)
downloadboto-a636d0a92e7e97013f1ae8dace451c5cd45d0fb8.tar.gz
Add WRR support for Route53
Diffstat (limited to 'bin/route53')
-rwxr-xr-xbin/route5346
1 files changed, 43 insertions, 3 deletions
diff --git a/bin/route53 b/bin/route53
index c2f2cb4c..d325f665 100755
--- a/bin/route53
+++ b/bin/route53
@@ -12,7 +12,7 @@ def _print_zone_info(zoneinfo):
print "="*80
print zoneinfo['Config']
print
-
+
def create(conn, hostname, caller_reference=None, comment=''):
"""Create a hosted zone, returning the nameservers"""
@@ -63,6 +63,28 @@ def del_record(conn, hosted_zone_id, name, type, values, ttl=600, comment=""):
change.add_value(value)
print changes.commit()
+def add_weighted_record(conn, hosted_zone_id, name, type, values,
+ identifier, weight, ttl=600, comment=""):
+ """Add a new weighted record"""
+ from boto.route53.record import ResourceRecordSets
+ changes = ResourceRecordSets(conn, hosted_zone_id, comment)
+ change = changes.add_change("CREATE", name, type, ttl,
+ identifier=identifier, weight=weight)
+ for value in values.split(','):
+ change.add_value(value)
+ print changes.commit()
+
+def del_weighted_record(conn, hosted_zone_id, name, type, values, ttl=600,
+ identifier=None, weight=None, comment=""):
+ """Delete a weighted record from a zone"""
+ from boto.route53.record import ResourceRecordSets
+ changes = ResourceRecordSets(conn, hosted_zone_id, comment)
+ change = changes.add_change("DELETE", name, type, ttl,
+ identifier=identifier, weight=weight)
+ for value in values.split(','):
+ change.add_value(value)
+ print changes.commit()
+
def add_alias(conn, hosted_zone_id, name, type, alias_hosted_zone_id, alias_dns_name, comment=""):
"""Add a new alias to a zone"""
from boto.route53.record import ResourceRecordSets
@@ -84,10 +106,12 @@ def change_record(conn, hosted_zone_id, name, type, values, ttl=600, comment="")
from boto.route53.record import ResourceRecordSets
changes = ResourceRecordSets(conn, hosted_zone_id, comment)
response = conn.get_all_rrsets(hosted_zone_id, type, name, maxitems=1)[0]
- change1 = changes.add_change("DELETE", name, type, response.ttl)
+ change1 = changes.add_change("DELETE", name, type, response.ttl,
+ identifier=identifier, weight=weight)
for old_value in response.resource_records:
change1.add_value(old_value)
- change2 = changes.add_change("CREATE", name, type, ttl)
+ change2 = changes.add_change("CREATE", name, type, ttl,
+ identifier=identifier, weight=weight)
for new_value in values.split(','):
change2.add_value(new_value)
print changes.commit()
@@ -103,6 +127,22 @@ def change_alias(conn, hosted_zone_id, name, type, alias_hosted_zone_id, alias_d
change2.set_alias(alias_hosted_zone_id, alias_dns_name)
print changes.commit()
+def change_weighted_record(conn, hosted_zone_id, name, type, values, ttl=600,
+ identifier=None, weight=None, comment=""):
+ """Delete and then add a weighted record to a zone"""
+ from boto.route53.record import ResourceRecordSets
+ changes = ResourceRecordSets(conn, hosted_zone_id, comment)
+ response = conn.get_all_rrsets(hosted_zone_id, type, name, maxitems=1)[0]
+ change1 = changes.add_change("DELETE", name, type, response.ttl,
+ identifier=identifier, weight=weight)
+ for old_value in response.resource_records:
+ change1.add_value(old_value)
+ change2 = changes.add_change("CREATE", name, type, ttl,
+ identifier=identifier, weight=weight)
+ for new_value in values.split(','):
+ change2.add_value(new_value)
+ print changes.commit()
+
def help(conn, fnc=None):
"""Prints this help message"""
import inspect