public async Task UpdateARecord(DomainSummaryDto domain, RecordDto record, int ttl, string ip) { var content = new StringContent(JsonConvert.SerializeObject(new { ttl = ttl, data = ip }), Encoding.UTF8, "application/json"); await this.PutAsync($"https://api.godaddy.com/v1/domains/{domain.Domain}/records/A/{record.Name}", content); }
/// <summary> /// Refreshes the ip of the selected domain. /// </summary> /// <returns></returns> private async Task updateDomain(DomainSummaryDto domain) { var updateMessage = String.Format(Properties.Resources.frmMain_UpdatingDomainIp, domain.Domain); await updateDomain(updateMessage, async() => { await this._dnsManager.UpdateDomain(domain, this._currentIp); await refreshDomainsList(); }); }
/// <summary> /// Updates the given domain with its new IP address. /// </summary> /// <param name="domain">The domain to be updated.</param> /// <param name="newIp">The new IP to update the domain with.</param> /// <returns></returns> public async Task UpdateDomain(DomainSummaryDto domain, string newIp) { var record = (await this._dnsClient.GetARecord(domain)).FirstOrDefault(); var currentIp = record.Data; if (currentIp != newIp) { await UpdateRecord(domain, record, newIp); } }
/// <summary> /// Updates the specified domain with its new ip information. /// </summary> /// <param name="domain">The domain to be updated.</param> /// <param name="newIp">The new IP that will be set to it.</param> /// <returns></returns> public async Task UpdateRecord(DomainSummaryDto domain, RecordDto record, string newIp) { await this._dnsClient.UpdateARecord(domain, record, this._defaultTtl, newIp); }
public async Task <List <RecordDto> > GetARecord(DomainSummaryDto domain) { var resultString = await this.GetStringAsync($"https://api.godaddy.com/v1/domains/{domain.Domain}/records/A"); return(JsonConvert.DeserializeObject <List <RecordDto> >(resultString)); }