Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added HostedZone.record_sets generator.

  • Loading branch information...
commit 45bcc75ffb19285e86f3e5eb77c15ee959874237 1 parent 58f3bb5
Greg Taylor authored

Showing 1 changed file with 20 additions and 3 deletions. Show diff stats Hide diff stats

  1. +20 3 route53/hosted_zone.py
23 route53/hosted_zone.py
@@ -34,12 +34,16 @@ def __init__(self, connection, id, name, caller_reference,
34 34 # Don't access this directly, we use it for lazy loading.
35 35 self._nameservers = []
36 36
  37 + def __str__(self):
  38 + return '<HostedZone: %s -- %s>' % (self.name, self.id)
  39 +
37 40 @property
38 41 def nameservers(self):
39 42 """
40 43 If this HostedZone was instantiated by ListHostedZones, the nameservers
41 44 attribute didn't get populated. If the user requests it, we'll
42   - lazy load it in.
  45 + lazy load by querying it in after the fact. It's safe to cache like
  46 + this since these nameserver values won't change.
43 47
44 48 :rtype: list
45 49 :returns: A list of nameserver strings for this hosted zone.
@@ -53,5 +57,18 @@ def nameservers(self):
53 57
54 58 return self._nameservers
55 59
56   - def __str__(self):
57   - return '<HostedZone: %s -- %s>' % (self.name, self.id)
  60 + @property
  61 + def record_sets(self):
  62 + """
  63 + Queries for the Resource Record Sets that are under this HostedZone.
  64 +
  65 + .. warning:: This result set can get pretty large if you have a ton
  66 + of records.
  67 +
  68 + :rtype: generator
  69 + :returns: A generator of ResourceRecordSet sub-classes.
  70 + """
  71 +
  72 + for rrset in self.connection.list_resource_record_sets_by_zone_id(self.id):
  73 + yield rrset
  74 +

0 comments on commit 45bcc75

Please sign in to comment.
Something went wrong with that request. Please try again.