func resource_cloudflare_record_retrieve(domain string, id string, client *cloudflare.Client) (*cloudflare.Record, error) {
	record, err := client.RetrieveRecord(domain, id)
	if err != nil {
		return nil, err
	}

	return record, nil
}
Beispiel #2
0
func isRecordExists(client *cf.Client, domain string, name string) (bool, cf.Record) {

	var record cf.Record
	records, err := client.RetrieveRecordsByName(domain, name, false)

	if err != nil {
		log.Println(err.Error())
		return false, record
	}

	for _, rec := range records {
		if rec.Name == name {
			record = rec
			break
		}
	}

	return len(records) != 0, record
}