Route 53 GET request honors the Name parameter.

Now record sets can be retrieved by name via get_all_rrsets.
This commit is contained in:
Marco Rucci 2014-07-13 19:48:20 +02:00
commit 9f092e6192
2 changed files with 26 additions and 2 deletions

View file

@ -66,8 +66,11 @@ def rrset_response(request, full_url, headers):
template = Template(LIST_RRSET_REPONSE)
rrset_list = []
for key, value in the_zone.rrsets.items():
if 'type' not in querystring or querystring["type"][0] == value["Type"]:
rrset_list.append(dicttoxml.dicttoxml({"ResourceRecordSet": value}, root=False))
if 'type' in querystring and querystring["type"][0] != value["Type"]:
continue
if 'name' in querystring and querystring["name"][0] != value["Name"]:
continue
rrset_list.append(dicttoxml.dicttoxml({"ResourceRecordSet": value}, root=False))
return 200, headers, template.render(rrsets=rrset_list)