-
Notifications
You must be signed in to change notification settings - Fork 3
/
providers.go
40 lines (37 loc) · 941 Bytes
/
providers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Factory for DNS providers
package dns
import (
"fmt"
"strings"
"gomodules.xyz/dns/aws"
"gomodules.xyz/dns/azure"
"gomodules.xyz/dns/cloudflare"
"gomodules.xyz/dns/digitalocean"
"gomodules.xyz/dns/googlecloud"
"gomodules.xyz/dns/linode"
dp "gomodules.xyz/dns/provider"
"gomodules.xyz/dns/vultr"
)
func Default(name string) (dp.Provider, error) {
var err error
var provider dp.Provider
switch strings.ToLower(name) {
case "azure":
provider, err = azure.Default()
case "cloudflare":
provider, err = cloudflare.Default()
case "digitalocean":
provider, err = digitalocean.Default()
case "gcloud", "googlecloud", "gce", "gke":
provider, err = googlecloud.Default()
case "linode":
provider, err = linode.Default()
case "aws", "route53":
provider, err = aws.Default()
case "vultr":
provider, err = vultr.Default()
default:
err = fmt.Errorf("unrecognised DNS provider: %s", name)
}
return provider, err
}