def destroy_record(client=None, found_record=None, record='', zone_id=''):
    """Destroy an individual DNS record.

    Args:
        client (botocore.client.Route53): Route 53 boto3 client.
        found_record (dict): Route 53 record set::

            {'Name': 'unicorn.forrest.dev.example.com.',
             'ResourceRecords':
             [{'Value':
               'internal-unicornforrest-1777489395.us-east-1.elb.amazonaws.com'
               }],
             'TTL': 60,
             'Type': 'CNAME'}

        record (str): Application DNS record name. e.g.
        zone_id (str): Route 53 Hosted Zone ID, e.g. /hostedzone/ZSVGJWJ979WQD.

    Returns:
        bool: True upon successful completion.
    """
    LOG.debug('Found DNS record: %s', found_record)

    if found_record['Name'].strip('.') == record:
        dns_json = get_template(template_file='destroy/destroy_dns.json.j2', record=json.dumps(found_record))
        dns_dict = json.loads(dns_json)

        client.change_resource_record_sets(HostedZoneId=zone_id, ChangeBatch=dns_dict)
        LOG.info('Destroyed "%s" in %s', found_record['Name'], zone_id)
    else:
        LOG.info('DNS record "%s" missing from %s.', record, zone_id)
        LOG.debug('Found someone else\'s record: %s', found_record['Name'])

    return True
def destroy_record ( client = None , found_record = None , record = '' , zone_id = '' ) : LOG . debug ( 'Found DNS record: %s' , found_record ) if found_record [ 'Name' ] . strip ( '.' ) == record : dns_json = get_template ( template_file = 'destroy/destroy_dns.json.j2' , record = json . dumps ( found_record ) ) dns_dict = json . loads ( dns_json ) client . change_resource_record_sets ( HostedZoneId = zone_id , ChangeBatch = dns_dict ) LOG . info ( 'Destroyed "%s" in %s' , found_record [ 'Name' ] , zone_id ) else : LOG . info ( 'DNS record "%s" missing from %s.' , record , zone_id ) LOG . debug ( 'Found someone else\'s record: %s' , found_record [ 'Name' ] ) return True
Destroy an individual DNS record.

    Args:
        client (botocore.client.Route53): Route 53 boto3 client.
        found_record (dict): Route 53 record set::

            {'Name': 'unicorn.forrest.dev.example.com.',
             'ResourceRecords':
             [{'Value':
               'internal-unicornforrest-1777489395.us-east-1.elb.amazonaws.com'
               }],
             'TTL': 60,
             'Type': 'CNAME'}

        record (str): Application DNS record name. e.g.
        zone_id (str): Route 53 Hosted Zone ID, e.g. /hostedzone/ZSVGJWJ979WQD.

    Returns:
        bool: True upon successful completion.