WIP: dns support via libdns

This commit is contained in:
2021-10-18 20:35:43 +02:00
parent 5941ed9728
commit 7ea3df45d4
5 changed files with 151 additions and 0 deletions

52
pkg/dns/gandi.go Normal file
View File

@ -0,0 +1,52 @@
package gandi
import (
"os"
"github.com/AlecAivazis/survey/v2"
"github.com/libdns/gandi"
"github.com/libdns/libdns"
"github.com/sirupsen/logrus"
)
func getToken() (string, error) {
if token, present := os.LookupEnv("GANDI_TOKEN"); present {
return token, nil
}
logrus.Debugf("no GANDI_TOKEN in environment, asking via stdin")
var token string
prompt := &survey.Input{
Message: "Gandi API token?",
}
if err := survey.AskOne(prompt, &token); err != nil {
return "", err
}
return token, nil
}
func getProvider() (gandi.Provider, error) {
token, err := getToken()
if err != nil {
return gandi.Provider{}, err
}
return gandi.Provider{APIToken: token}, nil
}
func ListDomains() ([]libdns.Record, error) {
return []libdns.Record{}, nil
}
func RemoveDomain() (bool, error) {
return false, nil
}
func AddDomain() (bool, error) {
return false, nil
}
func UpdateDomain() (bool, error) {
return false, nil
}