Delete a Route53 hosted zone by domain name, and PrivateZone status if provided.

    CLI Example::

        salt myminion boto3_route53.delete_hosted_zone_by_domain example.org.
354951
def delete_hosted_zone_by_domain(Name, PrivateZone=None, region=None, key=None, keyid=None,
                                 profile=None):
    '''
    
    '''
    args = {'Name': Name, 'PrivateZone': PrivateZone,
            'region': region, 'key': key, 'keyid': keyid, 'profile': profile}
    # Be extra pedantic in the service of safety - if public/private is not provided and the domain
    # name resolves to both, fail and require them to declare it explicitly.
    zone = find_hosted_zone(**args)
    if not zone:
        log.error("Couldn't resolve domain name %s to a hosted zone ID.", Name)
        return False
    Id = zone[0]['HostedZone']['Id']
    return delete_hosted_zone(Id=Id, region=region, key=key, keyid=keyid, profile=profile)
21795
public void zone_zoneName_dynHost_login_login_DELETE(String zoneName, String login) throws IOException {
		String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}";
		StringBuilder sb = path(qPath, zoneName, login);
		exec(qPath, "DELETE", sb.toString(), null);
	}
324526
def get_domain_name(self, domain_name, route53=True):
        
        # Make sure api gateway domain is present
        try:
            self.apigateway_client.get_domain_name(domainName=domain_name)
        except Exception:
            return None

        if not route53:
            return True

        try:
            zones = self.get_all_zones()
            for zone in zones['HostedZones']:
                records = self.route53.list_resource_record_sets(HostedZoneId=zone['Id'])
                for record in records['ResourceRecordSets']:
                    if record['Type'] in ('CNAME', 'A') and record['Name'][:-1] == domain_name:
                        return record

        except Exception as e:
            return None

        ##
        # Old, automatic logic.
        # If re-introduced, should be moved to a new function.
        # Related ticket: https://github.com/Miserlou/Zappa/pull/458
        ##

        # We may be in a position where Route53 doesn't have a domain, but the API Gateway does.
        # We need to delete this before we can create the new Route53.
        # try:
        #     api_gateway_domain = self.apigateway_client.get_domain_name(domainName=domain_name)
        #     self.apigateway_client.delete_domain_name(domainName=domain_name)
        # except Exception:
        #     pass

        return None
192227
def parse_create_zone(prs, conn):
    
    prs_zone_create = prs.add_parser('zone_create', help='create zone')
    prs_zone_create.add_argument(
        '--domain', action='store', required=True, help='specify zone')
    prs_zone_create.add_argument('--dnsaddr', action='store', required=True,
                                 help='specify IP address of DNS master')
    group_zone_create = prs_zone_create.add_mutually_exclusive_group()
    group_zone_create.add_argument('-S', action='store_true',
                                   help='create zone to SLAVE')
    group_zone_create.add_argument('-N', action='store_true',
                                   help='create zone to NATIVE')
    conn_options(prs_zone_create, conn)
    prs_zone_create.set_defaults(func=create_zone)
1017987
def delete(gandi, domain, zone_id, name, type, value):
    """"""
    if not zone_id:
        result = gandi.domain.info(domain)
        zone_id = result['zone_id']

    if not zone_id:
        gandi.echo('No zone records found, domain %s doesn\'t seems to be '
                   'managed at Gandi.' % domain)
        return
    if not name and not type and not value:
        proceed = click.confirm('This command without parameters --type, '
                                '--name or --value will remove all records'
                                ' in this zone file. Are you sur to '
                                'perform this action ?')
        if not proceed:
            return
    record = {'name': name, 'type': type, 'value': value}
    result = gandi.record.delete(zone_id, record)
    return result
415309
def strip_domain(jid)
      domain = jid.domain.split('.').drop(1).join('.')
      JID.new(domain)
    end
212476
def find_elb_dns_zone_id(name='', env='dev', region='us-east-1'):
    
    LOG.info('Find %s ELB DNS Zone ID in %s [%s].', name, env, region)
    client = boto3.Session(profile_name=env).client('elb', region_name=region)
    elbs = client.describe_load_balancers(LoadBalancerNames=[name])
    return elbs['LoadBalancerDescriptions'][0]['CanonicalHostedZoneNameID']
39899
def cli(ctx, dname, site, delete_code, no_prompt):
    
    assert isinstance(ctx, Context)

    # Get the domain
    dname = domain_parse(dname)
    domain = Domain.get(dname)
    if not domain:
        click.secho('No such domain: {dn}'.format(dn=domain.name), fg='red', bold=True, err=True)
        return

    domain_sites = {site.name.lower(): site for site in domain.sites}

    # Single site?
    if site:
        if site.lower() not in domain_sites:
            click.secho('No such site "{sn}" under the domain {dn}'.format(sn=site, dn=domain.name))
        site = domain_sites[site.lower()]

        delete_single(site, domain, delete_code, no_prompt)
        return

    # Delete the entire domain
    delete_all(domain, delete_code, no_prompt)
686374
def domain_delete(domain, logger, filesystem):
    
    if domain is not None:
        try:
            if domain.isActive():
                domain.destroy()
        except libvirt.libvirtError:
            logger.exception("Unable to destroy the domain.")
        try:
            domain.undefine()
        except libvirt.libvirtError:
            logger.exception("Unable to undefine the domain.")
        try:
            if filesystem is not None and os.path.exists(filesystem):
                shutil.rmtree(filesystem)
        except Exception:
            logger.exception("Unable to remove the shared folder.")
971486
def delete(self, domain, delete_subdomains=False):
        
        uri = "/%s/%s" % (self.uri_base, utils.get_id(domain))
        if delete_subdomains:
            uri = "%s?deleteSubdomains=true" % uri
        resp, resp_body = self._async_call(uri, method="DELETE",
                error_class=exc.DomainDeletionFailed, has_response=False)
145477
def delete_zone(zone, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    if region is None:
        region = 'universal'

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    _zone = conn.get_zone(zone)

    if _zone:
        conn.delete_hosted_zone(_zone.id)
        return True
    return False
723030
def _find_limit_hosted_zone(self):
        
        for limit_type in [self.MAX_RRSETS_BY_ZONE,
                           self.MAX_VPCS_ASSOCIATED_BY_ZONE]:
            self.limits[limit_type["name"]]._reset_usage()

        for hosted_zone in self._get_hosted_zones():
            for limit_type in [self.MAX_RRSETS_BY_ZONE,
                               self.MAX_VPCS_ASSOCIATED_BY_ZONE]:

                if limit_type == self.MAX_VPCS_ASSOCIATED_BY_ZONE and \
                        not hosted_zone["Config"]["PrivateZone"]:
                    continue

                limit = self._get_hosted_zone_limit(limit_type["type"],
                                                    hosted_zone['Id'])

                self.limits[limit_type["name"]]._add_current_usage(
                    int(limit["Count"]),
                    maximum=int(limit["Limit"]["Value"]),
                    aws_type='AWS::Route53::HostedZone',
                    resource_id=hosted_zone["Name"]
                )
1201099
def delete_topic_rule(ruleName,
            region=None, key=None, keyid=None, profile=None):
    '''
    

    '''

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        conn.delete_topic_rule(ruleName=ruleName)
        return {'deleted': True}
    except ClientError as e:
        return {'deleted': False, 'error': __utils__['boto3.get_error'](e)}
386056
def __fetch_route53_zones(self):
        
        done = False
        marker = None
        zones = {}
        route53 = self.session.client('route53')

        try:
            while not done:
                if marker:
                    response = route53.list_hosted_zones(Marker=marker)
                else:
                    response = route53.list_hosted_zones()

                if response['IsTruncated']:
                    marker = response['NextMarker']
                else:
                    done = True

                for zone_data in response['HostedZones']:
                    zones[get_resource_id('r53z', zone_data['Id'])] = {
                        'name': zone_data['Name'].rstrip('.'),
                        'source': 'AWS/{}'.format(self.account),
                        'comment': zone_data['Config']['Comment'] if 'Comment' in zone_data['Config'] else None,
                        'zone_id': zone_data['Id'],
                        'private_zone': zone_data['Config']['PrivateZone'],
                        'tags': self.__fetch_route53_zone_tags(zone_data['Id'])
                    }

            return zones
        finally:
            del route53
1061817
def delete(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    try:
        url = conn.get_queue_url(QueueName=name)['QueueUrl']
        conn.delete_queue(QueueUrl=url)
    except botocore.exceptions.ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}
    return {'result': True}
995519
def delete_record(name, zone, record_type, identifier=None, all_records=False,
                  region=None, key=None, keyid=None, profile=None,
                  wait_for_sync=True, split_dns=False, private_zone=False,
                  retry_on_rate_limit=None, rate_limit_retries=None,
                  retry_on_errors=True, error_retries=5):
    '''
    
    '''
    if region is None:
        region = 'universal'

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if split_dns:
        _zone = _get_split_zone(zone, conn, private_zone)
    else:
        _zone = conn.get_zone(zone)
    if not _zone:
        msg = 'Failed to retrieve zone {0}'.format(zone)
        log.error(msg)
        return False
    _type = record_type.upper()

    if retry_on_rate_limit or rate_limit_retries is not None:
        salt.utils.versions.warn_until(
            'Neon',
            'The \'retry_on_rate_limit\' and \'rate_limit_retries\' arguments '
            'have been deprecated in favor of \'retry_on_errors\' and '
            '\'error_retries\' respectively. Their functionality will be '
            'removed, as such, their usage is no longer required.'
        )
        if retry_on_rate_limit is not None:
            retry_on_errors = retry_on_rate_limit
        if rate_limit_retries is not None:
            error_retries = rate_limit_retries

    while error_retries > 0:
        try:
            old_record = _zone.find_records(name, _type, all=all_records, identifier=identifier)
            if not old_record:
                return False
            status = _zone.delete_record(old_record)
            return _wait_for_sync(status.id, conn, wait_for_sync)

        except DNSServerError as e:
            if retry_on_errors:
                if 'Throttling' == e.code:
                    log.debug('Throttled by AWS API.')
                elif 'PriorRequestNotComplete' == e.code:
                    log.debug('The request was rejected by AWS API.\
                              Route 53 was still processing a prior request')
                time.sleep(3)
                error_retries -= 1
                continue
            raise e
108857
def delete_single(site, domain, delete_code=False, no_prompt=False):
    
    click.secho('Deleting installation "{sn}" hosted on the domain {dn}'.format(sn=site.name, dn=domain.name),
                fg='yellow', bold=True)
    if not no_prompt:
        if delete_code:
            warn_text = click.style('WARNING! THIS WILL PERMANENTLY DELETE THIS SITE AND ALL OF THE ASSOCIATED '
                                    'PROJECT CODE FILES!\nTHIS MEANS ALL DATA FILES, INCLUDING ANY CREATED CUSTOM '
                                    'APPLICATIONS AND PLUGINS WILL BE PERMANENTLY AND IRREVOCABLY ERASED!',
                                    fg='red', bold=True)
            click.echo(warn_text)
            prompt_text = click.style('In order to continue, please re-input the site name', fg='white', bold=True)
            prompt = click.prompt(prompt_text)

            # If our prompt doesn't match, abort
            if prompt != site.name:
                click.secho('Site name did not match, site will not be deleted. Aborting.', fg='red', bold=True)
                raise click.Abort('Site name prompt did not match')

        else:
            prompt_text = click.style('Are you sure you want to delete this site entry? Your project files will '
                                      'still be preserved.', fg='white', bold=True)
            click.confirm(prompt_text, abort=True)

    site.delete()

    if delete_code:
        _remove_code(site)

    # If this is the only site left in the domain, remove the domain now as well
    domain_sites = [ds for ds in domain.sites if ds.id != site.id]
    if not len(domain_sites):
        Session.delete(domain)

    Session.commit()
    click.secho('{sn} removed'.format(sn=site.name), fg='yellow', bold=True)

    # Restart Nginx
    FNULL = open(os.devnull, 'w')
    subprocess.check_call(['service', 'nginx', 'restart'], stdout=FNULL, stderr=subprocess.STDOUT)