From eb77b78c11c21dc83309128a728c7a9c471c2a7f Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Fri, 26 May 2017 08:20:38 -0400 Subject: [PATCH] Add tips for provider authors. --- docs/writing-providers.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/writing-providers.md b/docs/writing-providers.md index e39ad255f..4c9b57c0b 100644 --- a/docs/writing-providers.md +++ b/docs/writing-providers.md @@ -4,11 +4,25 @@ layout: default # Writing new DNS providers -Writing a new DNS provider is a relatively straightforward process. You essentially need to implement the [providers.DNSServiceProvider interface.](https://godoc.org/github.com/StackExchange/dnscontrol/providers#DNSServiceProvider) +Writing a new DNS provider is a relatively straightforward process. You essentially need to implement the [providers.DNSServiceProvider interface.](https://godoc.org/github.com/StackExchange/dnscontrol/providers#DNSServiceProvider) and the system takes care of the rest. -... +Use another provider as the basis for yours. Pick the provider that has the most similar +API. Some APIs update one DNS record at a time (cloudflare, namedotcom, activedir), some APIs update +all the DNS records on a particular label, some APIs require you to upload the entire +zone every time (bind, gandi). -More info to follow soon. +You'll notice that most providers use the "diff" module to detect differences. It takes +two zones and returns records that are unchanged, created, deleted, and modified. Even +if the API simply requires the entire zone to be uploaded each time, we prefer to list +the specific changes so the user knows exactly what changed. + +Here are some tips: + +* Create a directory for the provider called `providers/name` where `name` is all lowercase and represents the commonly-used name for the service. +* The main driver should be called `providers/name/nameProvider.go`. The API abstraction is usually in a separate file (often called `api.go`). +* List the provider in `providers/_all/all.go` so DNSControl knows it exists. +* Implement all the calls in [providers.DNSServiceProvider interface.](https://godoc.org/github.com/StackExchange/dnscontrol/providers#DNSServiceProvider). The function `GetDomainCorrections` is a bit interesting. It returns a list of corrections to be made. These are in the form of functions that DNSControl can call to actually make the corrections. +* If you have any questions, please dicuss them in the Github issue related to the request for this provider. Please let us know what was confusing so we can update this document with advice for future authors (or feel free to update this document yourself!). ## Documentation