// SetDomainRecord utilizes Digital Ocean API to set a DNS record
SetDomainRecord utilizes Digital Ocean API to set a DNS record
// SetDomainRecord utilizes Digital Ocean API to set a DNS record
func SetDomainRecord(domain string, recordID int, IP string, token string) error {
	client := &http.Client{}
	jsonPayload, _ := json.Marshal(map[string]string{"data": IP})
	req, err := http.NewRequest(
		"PUT",
		"https://api.digitalocean.com/v2/domains/"+domain+"/records/"+strconv.Itoa(recordID),
		bytes.NewBuffer(jsonPayload),
	)
	if err != nil {
		return err
	}
	req.Header.Add("Authorization", "Bearer "+token)
	req.Header.Add("Content-Type", "application/json")
	res, err := client.Do(req)
	if err != nil {
		return err
	}
	defer res.Body.Close()
	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return err
	}
	os.Stdout.WriteString(string(body) + "\n")
	return nil
}
func SetDomainRecord ( domain string , recordID int , IP string , token string ) error { client := & http . Client { } jsonPayload , _ := json . Marshal ( map [ string ] string { " " : IP } ) req , err := http . NewRequest ( " " , " " + domain + " " + strconv . Itoa ( recordID ) , bytes . NewBuffer ( jsonPayload ) , ) if err != nil { return err } req . Header . Add ( " " , " " + token ) req . Header . Add ( " " , " " ) res , err := client . Do ( req ) if err != nil { return err } defer res . Body . Close ( ) body , err := ioutil . ReadAll ( res . Body ) if err != nil { return err } os . Stdout . WriteString ( string ( body ) + " \n " ) return nil }
SetDomainRecord utilizes Digital Ocean API to set a DNS record
SetDomainRecord utilizes Digital Ocean API to set a DNS record