mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
GANDI: Now works large zones and >100 domains
* update to latest github.com/prasmussen/gandi-api/domain * Fixed https://github.com/StackExchange/dnscontrol/issues/185 * GANDI: Now works with >100 domains * GANDI: Now works with zones with >100 records
This commit is contained in:
27
vendor/github.com/prasmussen/gandi-api/domain/domain.go
generated
vendored
27
vendor/github.com/prasmussen/gandi-api/domain/domain.go
generated
vendored
@@ -35,16 +35,25 @@ func (self *Domain) Info(name string) (*DomainInfo, error) {
|
||||
|
||||
// List domains associated to the contact represented by apikey
|
||||
func (self *Domain) List() ([]*DomainInfoBase, error) {
|
||||
var res []interface{}
|
||||
params := []interface{}{self.Key}
|
||||
if err := self.Call("domain.list", params, &res); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
opts := &struct {
|
||||
Page int `xmlrpc:"page"`
|
||||
}{0}
|
||||
const perPage = 100
|
||||
params := []interface{}{self.Key, opts}
|
||||
domains := make([]*DomainInfoBase, 0)
|
||||
for _, r := range res {
|
||||
domain := ToDomainInfoBase(r.(map[string]interface{}))
|
||||
domains = append(domains, domain)
|
||||
for {
|
||||
var res []interface{}
|
||||
if err := self.Call("domain.list", params, &res); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, r := range res {
|
||||
domain := ToDomainInfoBase(r.(map[string]interface{}))
|
||||
domains = append(domains, domain)
|
||||
}
|
||||
if len(res) < perPage {
|
||||
break
|
||||
}
|
||||
opts.Page++
|
||||
}
|
||||
return domains, nil
|
||||
}
|
||||
|
||||
31
vendor/github.com/prasmussen/gandi-api/domain/zone/record/record.go
generated
vendored
31
vendor/github.com/prasmussen/gandi-api/domain/zone/record/record.go
generated
vendored
@@ -1,6 +1,8 @@
|
||||
package record
|
||||
|
||||
import "github.com/prasmussen/gandi-api/client"
|
||||
import (
|
||||
"github.com/prasmussen/gandi-api/client"
|
||||
)
|
||||
|
||||
type Record struct {
|
||||
*client.Client
|
||||
@@ -22,16 +24,25 @@ func (self *Record) Count(zoneId, version int64) (int64, error) {
|
||||
|
||||
// List records of a version of a DNS zone
|
||||
func (self *Record) List(zoneId, version int64) ([]*RecordInfo, error) {
|
||||
var res []interface{}
|
||||
params := []interface{}{self.Key, zoneId, version}
|
||||
if err := self.Call("domain.zone.record.list", params, &res); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
opts := &struct {
|
||||
Page int `xmlrpc:"page"`
|
||||
}{0}
|
||||
const perPage = 100
|
||||
params := []interface{}{self.Key, zoneId, version, opts}
|
||||
records := make([]*RecordInfo, 0)
|
||||
for _, r := range res {
|
||||
record := ToRecordInfo(r.(map[string]interface{}))
|
||||
records = append(records, record)
|
||||
for {
|
||||
var res []interface{}
|
||||
if err := self.Call("domain.zone.record.list", params, &res); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, r := range res {
|
||||
record := ToRecordInfo(r.(map[string]interface{}))
|
||||
records = append(records, record)
|
||||
}
|
||||
if len(res) < perPage {
|
||||
break
|
||||
}
|
||||
opts.Page++
|
||||
}
|
||||
return records, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user