Scan our hosted zones for the record of a given name.

        Returns the record entry, else None.
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
1176857
def _find_record(self, domain, _type=None):
        """"""

        def _is_matching(record):
            """filter function for records"""

            if domain and record.get('domain', None) != domain:
                return False
            if _type and record.get('type', None) != _type:
                return False
            return True

        payload = self._get('/search?q={0}&type=record'.format(domain))
        for record in payload:
            if _is_matching(record):
                match = record
                break
        else:
            # no such domain on ns1
            return None

        record = self._get(
            '/zones/{0}/{1}/{2}'.format(match['zone'], match['domain'], match['type']))
        if record.get('message', None):
            return None  # {"message":"record not found"}
        short_answers = [x['answer'][0] for x in record['answers']]

        # ensure a compatibility level with self._list_records
        record['short_answers'] = short_answers
        return record
1311896
def _raw_records(self, identifier=None, rtype=None, name=None, content=None):
        """"""
        record_fields = {
            'id': identifier,
            'type': rtype,
            'hostname': name and self._relative_name(name),
            'destination': content,
        }
        # type/hostname/destination of the dnsrecord type are mandatory (even
        # when deleting), and must be queried if not all were specified:
        if all(record_fields.values()):
            return [record_fields]
        data = self._apicall('infoDnsRecords', domainname=self.domain)
        records = data.get('dnsrecords', [])
        return [
            record for record in records
            if all(record[k] == v for k, v in record_fields.items() if v)
        ]
1071522
def is_name_zonefile_hash(self, name, zonefile_hash):
        
        cur = self.db.cursor()
        return namedb_is_name_zonefile_hash(cur, name, zonefile_hash)
1126345
def _list_records(self, rtype=None, name=None, content=None):
        
        opts = {'domain': self._domain}
        if rtype is not None:
            opts['type'] = rtype.upper()
        if name is not None:
            opts['name'] = self._full_name(name)
        if content is not None:
            opts['content'] = content
        opts.update(self._auth)

        response = self._api.nameserver.info(opts)
        self._validate_response(
            response=response, message='Failed to get records')

        records = []
        if 'record' in response['resData']:
            for record in response['resData']['record']:
                processed_record = {
                    'type': record['type'],
                    'name': record['name'],
                    'ttl': record['ttl'],
                    'content': record['content'],
                    'id': record['id']
                }
                records.append(processed_record)

        return records
1050302
public Record getRecord(String sFileName)
    {
        Record pQueryCore = null;
        Record pStmtTable = null;
        pQueryCore = super.getRecord(sFileName);
        if (pQueryCore != null)
            return pQueryCore;
        for (int i = 0; i < this.getRecordlistCount(); i++)
        {
            pStmtTable = this.getRecordlistAt(i);
            pQueryCore = pStmtTable.getRecord(sFileName);
            if (pQueryCore != null)
                return pQueryCore;
        }
        return null;
    }
1160866
def load(self, callback=None, errback=None, reload=False):
        
        if not reload and self.data:
            raise RecordException('record already loaded')

        def success(result, *args):
            self._parseModel(result)
            if callback:
                return callback(self)
            else:
                return self
        return self._rest.retrieve(self.parentZone.zone,
                                   self.domain, self.type,
                                   callback=success, errback=errback)
713757
def rpc_get_name_blockchain_record(self, name, **con_info):
        
        res = None
        if check_name(name):
            res = self.get_name_record(name, include_expired=True, include_history=True)
        elif check_subdomain(name):
            res = self.get_subdomain_record(name, include_history=True)
        else:
            return {'error': 'Invalid name or subdomain', 'http_status': 400}

        if 'error' in res:
            return {'error': res['error'], 'http_status': res.get('http_status', 404)}

        return self.success_response({'record': res['record']})
666657
def is_subdomain_missing_zonefiles_record(rec):
    
    if rec['name'] != SUBDOMAIN_TXT_RR_MISSING:
        return False

    txt_entry = rec['txt']
    if isinstance(txt_entry, list):
        return False

    missing = txt_entry.split(',')
    try:
        for m in missing:
            m = int(m)
    except ValueError:
        return False

    return True
1030139
def cli(env, zone, data, record, ttl, type):
    """"""

    manager = SoftLayer.DNSManager(env.client)
    table = formatting.Table(['id', 'record', 'type', 'ttl', 'data'])

    table.align['ttl'] = 'l'
    table.align['record'] = 'r'
    table.align['data'] = 'l'

    zone_id = helpers.resolve_id(manager.resolve_ids, zone, name='zone')

    records = manager.get_records(zone_id,
                                  record_type=type,
                                  host=record,
                                  ttl=ttl,
                                  data=data)

    for the_record in records:
        table.add_row([
            the_record['id'],
            the_record['host'],
            the_record['type'].upper(),
            the_record['ttl'],
            the_record['data']
        ])

    env.fout(table)
998134
def _get_zone(self, domain, domain_id):
        
        api = self.api[self.account]
        for request in api['zone']['GET']:
            url = (request.copy()).get('url', '/').replace('<id>', domain_id)
            params = request.get('params', {}).copy()
            for param in params:
                params[param] = params[param].replace('<id>', domain_id)
            response = self._get(url, query_params=params)
        dom = Provider._filter_dom(response.text, api['filter'])
        zone_file_filter = [{'name': 'textarea', 'attrs': {'name': api['zone']['file']}}]
        zone_file = Provider._filter_dom(dom, zone_file_filter).renderContents().decode('UTF-8')
        hidden = Provider._extract_hidden_data(dom)
        zone = {'data': dns.zone.from_text(zone_file, origin=domain, relativize=False),
                'hidden': hidden}
        LOGGER.info('Hetzner => Get zone for domain %s', domain)
        return zone
550442
def get_record(self, name):
        

        return set().union(self.records.get(name, set()))
1357985
def get_record(self, dns_type, name):
        
        try:
            record = [record for record in self.dns_records
                      if record['type'] == dns_type and record['name'] == name][0]
        except IndexError:
            raise RecordNotFound(
                'Cannot find the specified dns record in domain {domain}'
                .format(domain=name))
        return record
1105591
def get_zones(region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    return [z.name for z in conn.get_all_zones()]
1098505
def get_record(self, name):
        

        result = {}
        result.update(self.records.get(name, {}))
        return result
27460
def _list_records(self, rtype=None, name=None, content=None):
        
        if name:
            name = self._relative_name(name)
        if not rtype:
            rtype = "ANY"

        filter_query = {"rdtype": rtype, "name": name, "content": content}

        with localzone.manage(self.filename, self.origin, autosave=True) as zone:
            records = zone.find_record(**filter_query)  # pylint: disable=no-member

        result = []
        for record in records:
            rdict = {
                "type": record.rdtype,
                "name": self._full_name(record.name),
                "ttl": record.ttl,
                "content": record.content,
                "id": record.hashid,
            }

            if rdict["type"] == "TXT":
                rdict["content"] = rdict["content"].replace('"', "")

            result.append(rdict)

        LOGGER.debug("list_records: %s", result)
        return result
1062264
def get_subdomain_entry_at_zonefile_index(self, fqn, zonefile_index, cur=None):
        
        get_cmd = "SELECT * FROM {} WHERE fully_qualified_subdomain=? AND parent_zonefile_index=?".format(self.subdomain_table)
        cursor = None
        if cur is None:
            cursor = self.conn.cursor()
        else:
            cursor = cur

        db_query_execute(cursor, get_cmd, (fqn,zonefile_index))

        try:
            rowdata = cursor.fetchone()
            assert rowdata
        except Exception as e:
            raise SubdomainNotFound(fqn)

        return self._extract_subdomain(rowdata)