Update records entries for a domain.

    You can update an individual record using --record and --new-record
    parameters

    Or you can use a plaintext file to update all records of a DNS zone at
    once with --file parameter.
504234
def update(gandi, domain, zone_id, file, record, new_record):
    
    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 file:
        records = file.read()
        result = gandi.record.zone_update(zone_id, records)
        return result
    elif record and new_record:
        result = gandi.record.update(zone_id, record, new_record)
        return result
    else:
        gandi.echo('You must indicate a zone file or a record.'
                   ' Use `gandi record update --help` for more information')
375892
def search_records(self, domain, record_type, name=None, data=None):
        
        search_params = []
        if name:
            search_params.append("name=%s" % name)
        if data:
            search_params.append("data=%s" % data)
        query_string = "&".join(search_params)
        dom_id = utils.get_id(domain)
        uri = "/domains/%s/records?type=%s" % (dom_id, record_type)
        if query_string:
            uri = "%s&%s" % (uri, query_string)
        resp, body = self._retry_get(uri)
        records = body.get("records", [])
        self._reset_paging("record", body)
        rec_paging = self._paging.get("record", {})
        while rec_paging.get("next_uri"):
            resp, body = self._retry_get(rec_paging.get("next_uri"))
            self._reset_paging("record", body)
            records.extend(body.get("records", []))
        for record in records:
            record["domain_id"] = dom_id
        return [CloudDNSRecord(self, record, loaded=False)
                for record in records if record]
1205804
def _update_record_with_id(self, identifier, rtype, content):
        """"""
        record = self._create_request_record(identifier, rtype, None, content,
                                             self._get_lexicon_option('ttl'),
                                             self._get_lexicon_option('priority'))

        self._request_modify_dns_record(record)
436912
def update(self, data=None, priority=None, ttl=None, comment=None):
        
        return self.manager.update_record(self.domain_id, self, data=data,
            priority=priority, ttl=ttl, comment=comment)
648447
protected function saveDnsRecord($domain, $record)
    {
        $this->sortArray($record);

        try {
            History::create(['type' => 'dns',
                             'meta' => $domain,
                             'record' => $this->utf8_converter($record)]);
        } catch (Exception $e) {
            $this->eye->logger()->error('DNS record save failed', $e, $domain);
            throw $e;
        }
    }
1327962
def _update_record(self, identifier, rtype=None, name=None, content=None):
        
        result = False

        # TODO: some providers allow content-based updates without supplying an
        # ID, and therefore `identifier` is here optional. If we don't receive
        # an ID, look it up.
        if not identifier and rtype and name:
            records = self._list_records(rtype, name)
            if len(records) == 1:
                identifier = records[0]["id"]

        if identifier and content:
            with localzone.manage(self.filename, self.origin, autosave=True) as zone:
                if zone.update_record(identifier, content):  # pylint: disable=no-member
                    result = True

        LOGGER.debug("update_record: %s", result)
        return result
1179730
public static base_response update(nitro_service client, dnszone resource) throws Exception {
		dnszone updateresource = new dnszone();
		updateresource.zonename = resource.zonename;
		updateresource.proxymode = resource.proxymode;
		updateresource.dnssecoffload = resource.dnssecoffload;
		updateresource.nsec = resource.nsec;
		return updateresource.update_resource(client);
	}
381317
def update_subdomain_entry(self, subdomain_obj, cur=None):
        
        # sanity checks
        assert isinstance(subdomain_obj, Subdomain)
       
        # NOTE: there is no need to call fsync() on the zone file fd here---we already have the data from the on-chain name's zone file fsync'ed,
        # so this information is already durable (albeit somewhere else) and can ostensibly be restored later.
        # We get such high subdomain traffic that we cannot call fsync() here each time; otherwise we could stall the node.
        zonefile_hash = get_zonefile_data_hash(subdomain_obj.zonefile_str)
        rc = store_atlas_zonefile_data(subdomain_obj.zonefile_str, self.zonefiles_dir, fsync=False)
        if not rc:
            raise Exception("Failed to store zone file {} from {}".format(zonefile_hash, subdomain_obj.get_fqn()))
        
        write_cmd = 'INSERT OR REPLACE INTO {} VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)'.format(self.subdomain_table)
        args = (subdomain_obj.get_fqn(), subdomain_obj.domain, subdomain_obj.n, subdomain_obj.address, zonefile_hash,
                subdomain_obj.sig, subdomain_obj.block_height, subdomain_obj.parent_zonefile_hash,
                subdomain_obj.parent_zonefile_index, subdomain_obj.zonefile_offset, subdomain_obj.txid, 
                ','.join(str(i) for i in subdomain_obj.domain_zonefiles_missing),
                1 if subdomain_obj.accepted else 0,
                subdomain_obj.resolver)

        cursor = None
        if cur is None:
            cursor = self.conn.cursor()
        else:
            cursor = cur

        db_query_execute(cursor, write_cmd, args)
        num_rows_written = cursor.rowcount
        
        if cur is None:
            # not part of a transaction
            self.conn.commit()

        if num_rows_written != 1:
            raise ValueError("No row written: fqn={} seq={}".format(subdomain_obj.get_fqn(), subdomain_obj.n))

        return True
1223475
def parse_zone_details(zone_contents):
    """"""
    records = []
    bad_lines = []
    zone_lines = [line.strip() for line in zone_contents.split('\n')]

    zone_search = re.search(r'^\$ORIGIN (?P<zone>.*)\.', zone_lines[0])
    zone = zone_search.group('zone')

    for line in zone_lines[1:]:
        record_search = re.search(RECORD_REGEX, line)
        if record_search is None:
            bad_lines.append(line)
            continue

        name = record_search.group('domain')
        # The API requires we send a host, although bind allows a blank
        # entry. @ is the same thing as blank
        if name is None:
            name = "@"

        ttl = record_search.group('ttl')
        # we don't do anything with the class
        # domain_class = domainSearch.group('class')
        record_type = record_search.group('type').upper()
        data = record_search.group('data')

        # the dns class doesn't support weighted MX records yet, so we chomp
        # that part out.
        if record_type == "MX":
            record_search = re.search(r'(?P<weight>\d+)\s+(?P<data>.*)', data)
            data = record_search.group('data')

        # This will skip the SOA record bit. And any domain that gets
        # parsed oddly.
        if record_type == 'IN':
            bad_lines.append(line)
            continue

        records.append({
            'record': name,
            'type': record_type,
            'data': data,
            'ttl': ttl,
        })

    return zone, records, bad_lines
173853
def update(cls, zone_id, old_record, new_record):
        """"""
        cls.echo('Creating new zone file')
        new_version_id = Zone.new(zone_id)

        new_record = new_record.replace(' IN', '')
        new_record = new_record.split(' ', 4)
        params_newrecord = {'name': new_record[0], 'ttl': int(new_record[1]),
                            'type': new_record[2], 'value': new_record[3]}

        old_record = old_record.replace(' IN', '')
        old_record = old_record.split(' ', 4)
        try:
            params = {'name': old_record[0], 'ttl': int(old_record[1]),
                      'type': old_record[2], 'value': old_record[3]}
        except IndexError:
            # failed to retrieve all values, try only use the name
            params = {'name': old_record[0]}
        record = cls.call('domain.zone.record.list', zone_id, new_version_id,
                          params)

        if record:
            cls.echo('Updating zone records')
            try:
                cls.call('domain.zone.record.update', zone_id,
                         new_version_id, {'id': record[0]['id']},
                         params_newrecord)
                cls.echo('Activation of new zone version')
                Zone.set(zone_id, new_version_id)
                return new_version_id
            except Exception as err:
                cls.echo('An error as occured: %s' % err)
                Zone.delete(zone_id, new_version_id)
        else:
            cls.echo('The record to update does not exist. Check records'
                     ' already created with `gandi record list example.com'
                     ' --output`')
            return False
1112325
public static base_responses update(nitro_service client, dnszone resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			dnszone updateresources[] = new dnszone[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new dnszone();
				updateresources[i].zonename = resources[i].zonename;
				updateresources[i].proxymode = resources[i].proxymode;
				updateresources[i].dnssecoffload = resources[i].dnssecoffload;
				updateresources[i].nsec = resources[i].nsec;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
1187184
def update_ptr_record(self, device, record, domain_name, data=None,
            ttl=None, comment=None):
        
        return self._manager.update_ptr_record(device, record, domain_name,
                data=data, ttl=ttl, comment=comment)
357864
def _gen_records(self, record, zone_id, creating=False):
        '''
        
        '''
        return _Route53Record.new(self, record, zone_id, creating)
186385
def delete_record(self, domain, recordid, params=None):
        ''' 
        '''
        params = update_params(params, {
            'domain': domain,
            'RECORDID': recordid
        })
        return self.request('/v1/dns/delete_record', params, 'POST')
1064311
def _request_modify_dns_record(self, record):
        """"""
        return self._request_internal("Modify_DNS_Record",
                                      domain=self.domain,
                                      record=record)
492669
def update_record(cls, fqdn, name, type, value, ttl, content):
        """"""
        data = {
            "rrset_name": name,
            "rrset_type": type,
            "rrset_values": value,
        }
        if ttl:
            data['rrset_ttl'] = int(ttl)
        meta = cls.get_fqdn_info(fqdn)
        if content:
            url = meta['domain_records_href']
            kwargs = {'headers': {'Content-Type': 'text/plain'},
                      'data': content}
            return cls.json_put(url, **kwargs)

        url = '%s/domains/%s/records/%s/%s' % (cls.api_url, fqdn, name, type)
        return cls.json_put(url, data=json.dumps(data))
799617
def records(self, domain, params=None):
        ''' 
        '''
        params = update_params(params, {'domain': domain})
        return self.request('/v1/dns/records', params, 'GET')