Merge pull request #557 from 2rs2ts/cf-delete-record-sets

Allow cloudformation to delete Route 53 RecordSets
This commit is contained in:
Steve Pulec 2016-03-05 18:11:13 -05:00
commit ad2dca607f

View File

@ -70,6 +70,8 @@ class RecordSet(object):
self.weight = kwargs.get('Weight')
self.region = kwargs.get('Region')
self.health_check = kwargs.get('HealthCheckId')
self.hosted_zone_name = kwargs.get('HostedZoneName')
self.hosted_zone_id = kwargs.get('HostedZoneId')
@classmethod
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
@ -107,6 +109,11 @@ class RecordSet(object):
</ResourceRecordSet>""")
return template.render(record_set=self)
def delete(self, *args, **kwargs):
''' Not exposed as part of the Route 53 API - used for CloudFormation. args are ignored '''
hosted_zone = route53_backend.get_hosted_zone_by_name(self.hosted_zone_name)
hosted_zone.delete_rrset_by_name(self.name)
class FakeZone(object):