forked from toolshed/abra
		
	WIP: dns support via libdns
This commit is contained in:
		
							
								
								
									
										52
									
								
								pkg/dns/gandi.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								pkg/dns/gandi.go
									
									
									
									
									
										Normal 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
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user