Skip to content

weyto/CyonClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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();

Releases

No releases published

Packages

No packages published

Languages