public UpdateRecord ( int domainId, int record_id, string name, string content, int ttl = null, int priority = null ) : dynamic | ||
domainId | int | |
record_id | int | The ID of the DNS record to affect |
name | string | The name of the DNS record |
content | string | The value of the DNS record |
ttl | int | The optional TTL (Time-To-Live) for this DNS record |
priority | int | The optional priority for this DNS record |
return | dynamic |
public dynamic UpdateRecord(int domainId, int record_id, string name, string content, int? ttl = null, int? priority = null)
{
Require.Argument("domainId", domainId);
return UpdateRecord(domainId.ToString(), record_id, name, content, ttl, priority);
}
DNSimpleRestClient::UpdateRecord ( string domain, int record_id, string name, string content, int ttl = null, int priority = null ) : dynamic |
private static void UpdateRecordIfNeeded(RecordUpdateRequest rur) { try { // Is the update request enabled? if (rur.Enabled) { // Yes, so validate first rur.Validate(); // Check if it is time to update... bool bUpdate = true; if (rur.LastUpdated.HasValue) { TimeSpan ts = DateTime.Now.Subtract(rur.LastUpdated.Value); bUpdate = ts.TotalMinutes >= rur.UpdateFrequencyMinutes; } // Update? if (bUpdate) { string pwd = null; string tok = null; if(rur.IsApiToken) { tok = rur.Password; } else { pwd = rur.Password; } DNSimple.DNSimpleRestClient c = new DNSimpleRestClient(rur.EmailAddress, pwd, tok); rur.RecordContent = GetPublicIP(); dynamic ret = c.UpdateRecord(rur.Domain, rur.RecordId, rur.RecordName, rur.RecordContent); rur.LastUpdated = DateTime.Now; } } } catch (Exception ex) { HandleException(ex); } }