mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-09-11 23:54:28 +08: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:
parent
627334803e
commit
e8f7886d0c
3 changed files with 55 additions and 35 deletions
15
vendor/github.com/prasmussen/gandi-api/domain/domain.go
generated
vendored
15
vendor/github.com/prasmussen/gandi-api/domain/domain.go
generated
vendored
|
@ -35,17 +35,26 @@ func (self *Domain) Info(name string) (*DomainInfo, error) {
|
||||||
|
|
||||||
// List domains associated to the contact represented by apikey
|
// List domains associated to the contact represented by apikey
|
||||||
func (self *Domain) List() ([]*DomainInfoBase, error) {
|
func (self *Domain) List() ([]*DomainInfoBase, error) {
|
||||||
|
opts := &struct {
|
||||||
|
Page int `xmlrpc:"page"`
|
||||||
|
}{0}
|
||||||
|
const perPage = 100
|
||||||
|
params := []interface{}{self.Key, opts}
|
||||||
|
domains := make([]*DomainInfoBase, 0)
|
||||||
|
for {
|
||||||
var res []interface{}
|
var res []interface{}
|
||||||
params := []interface{}{self.Key}
|
|
||||||
if err := self.Call("domain.list", params, &res); err != nil {
|
if err := self.Call("domain.list", params, &res); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
domains := make([]*DomainInfoBase, 0)
|
|
||||||
for _, r := range res {
|
for _, r := range res {
|
||||||
domain := ToDomainInfoBase(r.(map[string]interface{}))
|
domain := ToDomainInfoBase(r.(map[string]interface{}))
|
||||||
domains = append(domains, domain)
|
domains = append(domains, domain)
|
||||||
}
|
}
|
||||||
|
if len(res) < perPage {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
opts.Page++
|
||||||
|
}
|
||||||
return domains, nil
|
return domains, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
vendor/github.com/prasmussen/gandi-api/domain/zone/record/record.go
generated
vendored
19
vendor/github.com/prasmussen/gandi-api/domain/zone/record/record.go
generated
vendored
|
@ -1,6 +1,8 @@
|
||||||
package record
|
package record
|
||||||
|
|
||||||
import "github.com/prasmussen/gandi-api/client"
|
import (
|
||||||
|
"github.com/prasmussen/gandi-api/client"
|
||||||
|
)
|
||||||
|
|
||||||
type Record struct {
|
type Record struct {
|
||||||
*client.Client
|
*client.Client
|
||||||
|
@ -22,17 +24,26 @@ func (self *Record) Count(zoneId, version int64) (int64, error) {
|
||||||
|
|
||||||
// List records of a version of a DNS zone
|
// List records of a version of a DNS zone
|
||||||
func (self *Record) List(zoneId, version int64) ([]*RecordInfo, error) {
|
func (self *Record) List(zoneId, version int64) ([]*RecordInfo, error) {
|
||||||
|
opts := &struct {
|
||||||
|
Page int `xmlrpc:"page"`
|
||||||
|
}{0}
|
||||||
|
const perPage = 100
|
||||||
|
params := []interface{}{self.Key, zoneId, version, opts}
|
||||||
|
records := make([]*RecordInfo, 0)
|
||||||
|
for {
|
||||||
var res []interface{}
|
var res []interface{}
|
||||||
params := []interface{}{self.Key, zoneId, version}
|
|
||||||
if err := self.Call("domain.zone.record.list", params, &res); err != nil {
|
if err := self.Call("domain.zone.record.list", params, &res); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
records := make([]*RecordInfo, 0)
|
|
||||||
for _, r := range res {
|
for _, r := range res {
|
||||||
record := ToRecordInfo(r.(map[string]interface{}))
|
record := ToRecordInfo(r.(map[string]interface{}))
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
}
|
}
|
||||||
|
if len(res) < perPage {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
opts.Page++
|
||||||
|
}
|
||||||
return records, nil
|
return records, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
32
vendor/vendor.json
vendored
32
vendor/vendor.json
vendored
|
@ -299,44 +299,44 @@
|
||||||
{
|
{
|
||||||
"checksumSHA1": "nS4kKHjMlJpQg3sixqelpCg1jyk=",
|
"checksumSHA1": "nS4kKHjMlJpQg3sixqelpCg1jyk=",
|
||||||
"path": "github.com/prasmussen/gandi-api/client",
|
"path": "github.com/prasmussen/gandi-api/client",
|
||||||
"revision": "13205dc554f4aeb75c93e8b57ad1e3d6fa3be5d5",
|
"revision": "931915c3a2ca2661373f0b25bbedfee9e1958d2b",
|
||||||
"revisionTime": "2016-04-18T18:49:04Z"
|
"revisionTime": "2017-09-08T20:15:21Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "JZSh5mPC7r4AHhSg+IjD897n22A=",
|
"checksumSHA1": "tT8xSQc+QM3/JPs16WjDtTFY7j0=",
|
||||||
"path": "github.com/prasmussen/gandi-api/domain",
|
"path": "github.com/prasmussen/gandi-api/domain",
|
||||||
"revision": "13205dc554f4aeb75c93e8b57ad1e3d6fa3be5d5",
|
"revision": "931915c3a2ca2661373f0b25bbedfee9e1958d2b",
|
||||||
"revisionTime": "2016-04-18T18:49:04Z"
|
"revisionTime": "2017-09-08T20:15:21Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "/t4nBKtJF6W3PHzTBNAzgcw54GU=",
|
"checksumSHA1": "/t4nBKtJF6W3PHzTBNAzgcw54GU=",
|
||||||
"path": "github.com/prasmussen/gandi-api/domain/zone",
|
"path": "github.com/prasmussen/gandi-api/domain/zone",
|
||||||
"revision": "13205dc554f4aeb75c93e8b57ad1e3d6fa3be5d5",
|
"revision": "931915c3a2ca2661373f0b25bbedfee9e1958d2b",
|
||||||
"revisionTime": "2016-04-18T18:49:04Z"
|
"revisionTime": "2017-09-08T20:15:21Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "QXUT2Olct3vKqg6RIgdoUqJHsFU=",
|
"checksumSHA1": "wers/RRtpv1SXRpnUg6ptC1nKoM=",
|
||||||
"path": "github.com/prasmussen/gandi-api/domain/zone/record",
|
"path": "github.com/prasmussen/gandi-api/domain/zone/record",
|
||||||
"revision": "13205dc554f4aeb75c93e8b57ad1e3d6fa3be5d5",
|
"revision": "931915c3a2ca2661373f0b25bbedfee9e1958d2b",
|
||||||
"revisionTime": "2016-04-18T18:49:04Z"
|
"revisionTime": "2017-09-08T20:15:21Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "avzpVkEeXzDiaNLsl4agXWm9tm0=",
|
"checksumSHA1": "avzpVkEeXzDiaNLsl4agXWm9tm0=",
|
||||||
"path": "github.com/prasmussen/gandi-api/domain/zone/version",
|
"path": "github.com/prasmussen/gandi-api/domain/zone/version",
|
||||||
"revision": "13205dc554f4aeb75c93e8b57ad1e3d6fa3be5d5",
|
"revision": "931915c3a2ca2661373f0b25bbedfee9e1958d2b",
|
||||||
"revisionTime": "2016-04-18T18:49:04Z"
|
"revisionTime": "2017-09-08T20:15:21Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "txVNPkzE0Jkag20VZ1hLj/Td+O4=",
|
"checksumSHA1": "txVNPkzE0Jkag20VZ1hLj/Td+O4=",
|
||||||
"path": "github.com/prasmussen/gandi-api/operation",
|
"path": "github.com/prasmussen/gandi-api/operation",
|
||||||
"revision": "13205dc554f4aeb75c93e8b57ad1e3d6fa3be5d5",
|
"revision": "931915c3a2ca2661373f0b25bbedfee9e1958d2b",
|
||||||
"revisionTime": "2016-04-18T18:49:04Z"
|
"revisionTime": "2017-09-08T20:15:21Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "FwIh1Rk/XNANaxCz3Fw/vQ3Hu5E=",
|
"checksumSHA1": "FwIh1Rk/XNANaxCz3Fw/vQ3Hu5E=",
|
||||||
"path": "github.com/prasmussen/gandi-api/util",
|
"path": "github.com/prasmussen/gandi-api/util",
|
||||||
"revision": "13205dc554f4aeb75c93e8b57ad1e3d6fa3be5d5",
|
"revision": "931915c3a2ca2661373f0b25bbedfee9e1958d2b",
|
||||||
"revisionTime": "2016-04-18T18:49:04Z"
|
"revisionTime": "2017-09-08T20:15:21Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "EqyHXBcg5cWi4ERsMXN6g1opi1o=",
|
"checksumSHA1": "EqyHXBcg5cWi4ERsMXN6g1opi1o=",
|
||||||
|
|
Loading…
Add table
Reference in a new issue