TypedRest / PowerDns.Client

.NET client library for the PowerDNS API

Home Page:https://powerdns.typedrest.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PowerDNS Client

NuGet Build API documentation

This project provides a .NET client library for the PowerDNS API.

Usage

Add the NuGet package PowerDns.Client to your project. You can then create an instance of the client like this:

var client = new PowerDnsClient(
    uri: new Uri("http://example.com/"), // without /api/v1
    apiKey: "changeme");
var zonesEndpoint = client.Servers["localhost"].Zones;

Get a list of all zones:

List<Zone> zones = await zonesEndpoint.ReadAllAsync();

Get a specific zone:

Zone zone = await zonesEndpoint["example.org"].ReadAsync();

Create a new zone:

await zonesEndpoint.CreateAsync(new Zone("example.org", /*nameservers:*/ "ns1.example.org", "ns2.example.org")
{
    RecordSets =
    {
        new RecordSet
        {
            Name = "www.example.org",
            Type = RecordType.A,
            Ttl = 10,
            Records = 
            {
                new Record(content: "1.2.3.4"),
                new Record(content: "5.6.7.8")
            }
        }
    }
});

Patch a record set in a zone:

RecordSet recordSet = await zonesEndpoint["example.org"].GetRecordSetAsync("www.example.org");

recordSet.ChangeType = ChangeType.Replace;
recordSet.Records.Add(new ResourceRecord(content: "4.3.2.1"));

await zonesEndpoint["example.org"].PatchRecordSetAsync(recordSet);

Delete a zone:

await zonesEndpoint["example.org"].DeleteAsync();

About

.NET client library for the PowerDNS API

https://powerdns.typedrest.net

License:MIT License


Languages

Language:C# 88.5%Language:PowerShell 6.2%Language:Shell 5.4%