Skip to content

Latest commit

 

History

History
60 lines (52 loc) · 2.29 KB

README.md

File metadata and controls

60 lines (52 loc) · 2.29 KB

CyonClient

A DNS client library for https://my.cyon.ch based on .Net Core 2.2.

This library supports the following functions:

  • List all domains including all DNS Records
  • Create a new DNS record
  • Update existing DNS record
  • Delete a DNS record

Usage

The following section describes the usage of the library.

Initialize connection

To initialize the client you need

CyonClient.CyonContext cyonContext = new CyonClient.CyonContext("accountName", "username", "password");

List domains

CyonClient.CyonContext cyonContext = new CyonClient.CyonContext("accountName", "username", "password");
List<Domain> domains = cyonContext.GetDomains().Result;

List DNS Records

CyonClient.CyonContext cyonContext = new CyonClient.CyonContext("accountName", "username", "password");
List<Domain> domains = cyonContext.GetDomains().Result;
IReadOnlyCollection<DNSRecord> dnsrecords = domains.FirstOrDefault(d => d.Name == "mydomain.ch").DNSRecords;

Create DNS Records

CyonClient.CyonContext cyonContext = new CyonClient.CyonContext("accountName", "username", "password");
List<Domain> domains = cyonContext.GetDomains().Result;
IReadOnlyCollection<DNSRecord> mydomain = domains.FirstOrDefault(d => d.Name == "mydomain.ch");
mydomain.CreateARecord("test3.mydomain.ch", "203.0.113.47", DNSTTL.FourHours).Wait()

Update DNS Records

CyonClient.CyonContext cyonContext = new CyonClient.CyonContext("accountName", "username", "password");
List<Domain> domains = cyonContext.GetDomains().Result;
Domain mydomain = domains.FirstOrDefault(d => d.Name == "mydomain.ch");
DNSRecord record = mydomain.DNSRecords.FirstOrDefault(r => r.Name.Equals("test.mydomain.ch."));
record.Value = "203.0.113.48";
mydomain.UpdateDNSRecord(record).Wait();

Delete DNS Records

CyonClient.CyonContext cyonContext = new CyonClient.CyonContext("accountName", "username", "password");
List<Domain> domains = cyonContext.GetDomains().Result;
Domain mydomain = domains.FirstOrDefault(d => d.Name == "mydomain.ch");
DNSRecord record = mydomain.DNSRecords.FirstOrDefault(r => r.Name.Equals("test.mydomain.ch."));
oninovit.DeleteDNSRecord(record).Wait();