Пример #1
0
func main() {
	user := os.Args[1]
	key := os.Args[2]
	client, err := dozens.NewClient(&http.Client{}, user, key)
	if err != nil {
		fmt.Println(err)
		return
	}
	domains, err := client.ListDomains()
	if err != nil {
		fmt.Println(err)
		return
	}
	for di, d := range domains {
		fmt.Printf("Domain #%02d: %s\n", di, d.Name)
		records, err := client.ListRecords(d)
		if err != nil {
			fmt.Println(err)
			return
		}
		for ri, r := range records {
			fmt.Printf("\tRecord #%02d: %s %s %s\n", ri, r.Type, r.FQName, r.Content)
		}
	}
}
Пример #2
0
func configure(d *schema.ResourceData) (interface{}, error) {
	user := d.Get("user").(string)
	key := d.Get("key").(string)
	client := &http.Client{}
	return dozens.NewClient(client, user, key)
}