1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

adding docs again

This commit is contained in:
Craig Peterson
2017-01-11 13:02:45 -07:00
parent 8e5257c497
commit 7ba051d750
40 changed files with 761 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
---
name: D
parameters:
- name
- registrar
- modifiers...
---
`D` adds a new Domain for DNSControl to manage. The first two arguments are required: the domain name (fully qualified `example.com` without a trailing dot), and the
name of the registrar (as previously declared with [NewRegistrar](#NewRegistrar)). Any number of additional arguments may be included to add DNS Providers with [DNSProvider](#DNSProvider),
add records with [A](#A), [CNAME](#CNAME), and so forth, or add metadata.
Modifier arguments are processed according to type as follows:
- A function argument will be called with the domain object as it's only argument. Most of the [built-in modifier functions](#domain-modifiers) return such functions.
- An object argument will be merged into the domain's metadata collection.
- An array arument will have all of it's members evaluated recursively. This allows you to combine multiple common records or modifiers into a variable that can
be used like a macro in multiple domains.
{% include startExample.html %}
{% highlight js %}
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
var r53 = NewDnsProvider("R53","ROUTE53");
//simple domain
D("example.com", REGISTRAR, DnsProvider(r53),
A("@","1.2.3.4"),
CNAME("test", "foo.example2.com.")
);
//"macro" for records that can be mixed into any zone
var GOOGLE_APPS_DOMAIN_MX = [
MX('@', 1, 'aspmx.l.google.com.'),
MX('@', 5, 'alt1.aspmx.l.google.com.'),
MX('@', 5, 'alt2.aspmx.l.google.com.'),
MX('@', 10, 'alt3.aspmx.l.google.com.'),
MX('@', 10, 'alt4.aspmx.l.google.com.'),
]
D("example.com", REGISTRAR, DnsProvider(r53),
A("@","1.2.3.4"),
CNAME("test", "foo.example2.com."),
GOOGLE_APPS_DOMAIN_MX
);
{%endhighlight%}
{% include endExample.html %}

View File

@@ -0,0 +1,23 @@
---
name: DEFAULTS
parameters:
- modifiers...
---
`DEFAULTS` allows you to declare a set of default arguments to apply to all subsequent domains. Subsequent calls to [D](#D) will have these
arguments passed as if they were the first modifiers in the argument list.
{% include startExample.html %}
{% highlight js %}
var COMMON = NewDnsProvider("foo","BIND");
//we want to create backup zone files for all domains, but not actually register them.
//also create a default TTL
DEFAULTS( DnsProvider(COMMON,0), DefaultTTL(1000));
D("example.com", REGISTRAR, DnsProvider("R53"), A("@","1.2.3.4")); //this domain will have the defaults set.
//clear defaults
DEFAULTS();
D("example2.com", REGISTRAR, DnsProvider("R53"), A("@","1.2.3.4")); //this domain will not have the previous defaults.
{%endhighlight%}
{% include endExample.html %}

View File

View File

@@ -0,0 +1,24 @@
---
name: NewDnsProvider
parameters:
- name
- type
- meta
return: string
---
NewDnsProvider registers a new DNS Service Provider. The name can be any string value you would like to use.
The type must match a valid dns provider type identifer (see [provider page.]({{site.github.url}}/provider-list))
Metadata is an optional object, that will only be used by certain providers. See [individual provider docs]({{site.github.url}}/provider-list) for specific details.
This function will return the name as a string so that you may assign it to a variable to use inside [D](#D) directives.
{% include startExample.html %}
{% highlight js %}
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
var r53 = NewDnsProvider("R53","ROUTE53");
D("example.com", REGISTRAR, DnsProvider(r53), A("@","1.2.3.4"));
{%endhighlight%}
{% include endExample.html %}

View File

@@ -0,0 +1,24 @@
---
name: NewRegistrar
parameters:
- name
- type
- meta
return: string
---
NewRegistrar registers a registrar provider. The name can be any string value you would like to use.
The type must match a valid registar provider type identifer (see [provider page.]({{site.github.url}}/provider-list))
Metadata is an optional object, that will only be used by certain providers. See [individual provider docs]({{site.github.url}}/provider-list) for specific details.
This function will return the name as a string so that you may assign it to a variable to use inside [D](#D) directives.
{% include startExample.html %}
{% highlight js %}
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
var r53 = NewDnsProvider("R53","ROUTE53");
D("example.com", REGISTRAR, DnsProvider(r53), A("@","1.2.3.4"));
{%endhighlight%}
{% include endExample.html %}