Load a high level Record object from a domain within this Zone.

        :param str domain: The name of the record to load
        :param str rtype: The DNS record type
        :rtype: ns1.records.Record
        :return: new Record
517771
def loadRecord(self, domain, rtype, callback=None, errback=None):
        
        rec = Record(self, domain, rtype)
        return rec.load(callback=callback, errback=errback)
1110079
def update_record(self, domain, recordid, params=None):
        ''' 
        '''
        params = update_params(params, {
            'domain': domain,
            'RECORDID': recordid
        })
        return self.request('/v1/dns/update_record', params, 'POST')
68807
def _list_records(self, rtype=None, name=None, content=None):
        

        filter_query = {}
        if rtype:
            filter_query["record_type"] = rtype
        if name:
            name = self._relative_name(name)
            filter_query["name"] = name
        payload = self._get(
            "/v1/domains/{0}/records".format(self.domain),
            query_params=filter_query,
        )

        records = []
        for data in payload:
            record = data["record"]

            if content and record["content"] != content:
                continue

            if record["name"] == "":
                rname = self.domain
            else:
                rname = ".".join((record["name"], self.domain))

            processed_record = {
                "type": record["record_type"],
                "name": rname,
                "ttl": record["ttl"],
                "content": record["content"],
                "id": record["id"],
            }
            if record["prio"]:
                processed_record["options"] = {
                    "mx": {"priority": record["prio"]}
                }
            records.append(processed_record)

        LOGGER.debug("list_records: %s", records)
        return records
340104
def load(self, **kwargs):
        """"""
        if 'name' in kwargs:
            if 'ldns' not in kwargs['name'] or 'server' not in kwargs['name']:
                raise InvalidName("Topology record name should contain both "
                                  "'ldns', 'server' keywords with their "
                                  "proper arguments")
        kwargs['transform_name'] = True

        return self._load(**kwargs)
1261482
def create_record(self, dns_type, name, content, **kwargs):
        
        data = {
            'type': dns_type,
            'name': name,
            'content': content
        }
        if kwargs.get('ttl') and kwargs['ttl'] != 1:
            data['ttl'] = kwargs['ttl']
        if kwargs.get('proxied') is True:
            data['proxied'] = True
        else:
            data['proxied'] = False
        content = self.request(
            self.api_url + self.zone['id'] + '/dns_records',
            'post',
            data=data
        )
        print('DNS record successfully created')
        return content['result']
188437
def _update_record(self, identifier, rtype=None, name=None, content=None):
        
        if self.protocol == 'rpc':
            return self.rpc_helper.update_record(identifier, rtype, name, content)

        data = {}
        if rtype:
            data['rrset_type'] = rtype
        if name:
            data['rrset_name'] = self._relative_name(name)
        if content:
            if isinstance(content, (list, tuple, set)):
                data['rrset_values'] = list(content)
            else:
                data['rrset_values'] = [content]
        if rtype is not None:
            # replace the records of a specific rtype
            url = '/domains/{0}/records/{1}/{2}'.format(self.domain_id,
                                                        identifier or self._relative_name(
                                                            name),
                                                        rtype)
            self._put(url, data)
        else:
            # replace all records with a matching name
            url = '/domains/{0}/records/{1}'.format(self.domain_id,
                                                    identifier or self._relative_name(name))
            self._put(url, {'items': [data]})
        LOGGER.debug('update_record: %s', True)
        return True
1335478
public static dnsrecords_stats get(nitro_service service, String dnsrecordtype) throws Exception{
		dnsrecords_stats obj = new dnsrecords_stats();
		obj.set_dnsrecordtype(dnsrecordtype);
		dnsrecords_stats response = (dnsrecords_stats) obj.stat_resource(service);
		return response;
	}
943716
def update_record(self, identifier, rtype=None, name=None, content=None):  # pylint: disable=too-many-branches
        """"""
        if not identifier:
            records = self.list_records(rtype, name)
            if len(records) == 1:
                identifier = records[0]['id']
            elif len(records) > 1:
                raise Exception('Several record identifiers match the request')
            else:
                raise Exception('Record identifier could not be found')

        identifier = str(identifier)
        version = None

        # Gandi doesn't allow you to edit records on the active zone file.
        # Gandi also doesn't persist zone record identifiers when creating
        # a new zone file. To update by identifier, we lookup the record
        # by identifier, then use the record fields to find the record in
        # the newly created zone.
        records = self._api.domain.zone.record.list(
            self._api_key, self._zone_id, 0, {'id': identifier})

        if len(records) == 1:
            rec = records[0]
            del rec['id']

            try:
                version = self._api.domain.zone.version.new(
                    self._api_key, self._zone_id)
                records = self._api.domain.zone.record.list(
                    self._api_key, self._zone_id, version, rec)
                if len(records) != 1:
                    raise self.GandiInternalError("expected one record")

                if rtype is not None:
                    rec['type'] = rtype.upper()
                if name is not None:
                    rec['name'] = self._relative_name(name)
                if content is not None:
                    rec['value'] = self._txt_encode(
                        content) if rec['type'] == 'TXT' else content

                records = self._api.domain.zone.record.update(
                    self._api_key, self._zone_id, version, {'id': records[0]['id']}, rec)
                if len(records) != 1:
                    raise self.GandiInternalError(
                        "Expected one updated record")

                self._api.domain.zone.version.set(
                    self._api_key, self._zone_id, version)
                ret = True

            except self.GandiInternalError:
                pass

            finally:
                if not ret and version is not None:
                    self._api.domain.zone.version.delete(
                        self._api_key, self._zone_id, version)

        LOGGER.debug("update_record: %s", ret)
        return ret
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)
1257503
def from_record(self, record):
        """"""

        self.record = record
        self._setup_tls_files(self.record['files'])
        return self
810298
def update_record(self, domain, record, data=None, priority=None, ttl=None,
            comment=None):
        
        return domain.update_record(record, data=data, priority=priority,
                ttl=ttl, comment=comment)
953022
def _create_record(self, name, address, ttl):
        """"""
        data = json.dumps({'record': {'name': name,
                                      'record_type': 'A',
                                      'content': address,
                                      'ttl': ttl}})
        headers = {'Content-Type': 'application/json'}
        request = self._session.post(self._baseurl, data=data, headers=headers)
        if not request.ok:
            raise RuntimeError('Failed to create new record: %s - %s' %
                               (self._format_hostname(name), request.json()))
        record = request.json()
        if 'record' not in record or 'id' not in record['record']:
            raise RuntimeError('Invalid record JSON format: %s - %s' %
                               (self._format_hostname(name), request.json()))
        return record['record']
1350047
def create_record(self, rtype=None, name=None, content=None, **kwargs):
        
        if not rtype and kwargs.get('type'):
            warnings.warn('Parameter "type" is deprecated, use "rtype" instead.',
                          DeprecationWarning)
            rtype = kwargs.get('type')

        return self._create_record(rtype, name, content)
803012
def get_axfr_records(self, server, domains):
        
        zones = []
        for zoneName in domains:
            try:
                zone = {
                    'zone_id': get_resource_id('axfrz', zoneName),
                    'name': zoneName,
                    'source': 'AXFR',
                    'comment': None,
                    'tags': {},
                    'records': []
                }

                z = dns_zone.from_xfr(query.xfr(server, zoneName))
                rdata_fields = ('name', 'ttl', 'rdata')
                for rr in [dict(zip(rdata_fields, x)) for x in z.iterate_rdatas()]:
                    record_name = rr['name'].derelativize(z.origin).to_text()
                    zone['records'].append(
                    {
                        'id': get_resource_id('axfrr', record_name, ['{}={}'.format(k, str(v)) for k, v in rr.items()]),
                        'zone_id': zone['zone_id'],
                        'name': record_name,
                        'value': sorted([rr['rdata'].to_text()]),
                        'type': type_to_text(rr['rdata'].rdtype)
                    })

                if len(zone['records']) > 0:
                    zones.append(zone)

            except Exception as ex:
                self.log.exception('Failed fetching DNS zone information for {}: {}'.format(zoneName, ex))
                raise

        return zones
969469
def _create_record(self, rtype, name, content):
        """"""
        found = self._list_records(rtype=rtype, name=name, content=content)
        if found:
            return True

        record = self._create_request_record(None, rtype, name, content,
                                             self._get_lexicon_option('ttl'),
                                             self._get_lexicon_option('priority'))

        self._request_add_dns_record(record)
        return True
1132328
def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
        
        if not identifier:
            records = self._list_records(rtype, name, content)
            identifiers = [record["id"] for record in records]
        else:
            identifiers = [identifier]

        LOGGER.debug("delete_records: %s", identifiers)

        for record_id in identifiers:
            self._delete(
                "/v1/domains/{0}/records/{1}".format(
                    self.domain, record_id
                )
            )
            LOGGER.debug("delete_record: %s", record_id)

        LOGGER.debug("delete_record: %s", True)
        return True
1064311
def _request_modify_dns_record(self, record):
        """"""
        return self._request_internal("Modify_DNS_Record",
                                      domain=self.domain,
                                      record=record)