diff --git a/vendor.conf b/vendor.conf index 2037b1b..b03c2d0 100644 --- a/vendor.conf +++ b/vendor.conf @@ -19,7 +19,7 @@ github.com/juju/ratelimit 77ed1c8 github.com/kolo/xmlrpc 0826b98 github.com/miekg/dns 48ab660 github.com/pkg/errors ff09b13 -github.com/prasmussen/gandi-api 13205dc +github.com/prasmussen/gandi-api 2dd22da github.com/rancher/go-rancher-metadata/metadata 11a77c2 github.com/rancher/go-rancher/v2 939fd85 github.com/tent/http-link-go ac974c6 diff --git a/vendor/github.com/prasmussen/gandi-api/domain/domain.go b/vendor/github.com/prasmussen/gandi-api/domain/domain.go index d4697f7..7c3edfa 100644 --- a/vendor/github.com/prasmussen/gandi-api/domain/domain.go +++ b/vendor/github.com/prasmussen/gandi-api/domain/domain.go @@ -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 } diff --git a/vendor/github.com/prasmussen/gandi-api/domain/zone/record/record.go b/vendor/github.com/prasmussen/gandi-api/domain/zone/record/record.go index ead9564..b06f7b5 100644 --- a/vendor/github.com/prasmussen/gandi-api/domain/zone/record/record.go +++ b/vendor/github.com/prasmussen/gandi-api/domain/zone/record/record.go @@ -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 } @@ -54,7 +65,7 @@ func (self *Record) Add(args RecordAdd) (*RecordInfo, error) { } // Remove a record from a zone/version -func (self *Record) Delete(zoneId, version, recordId int64) (bool, error) { +func (self *Record) Delete(zoneId, version int64, recordId string) (bool, error) { var res int64 deleteArgs := map[string]interface{}{"id": recordId} params := []interface{}{self.Key, zoneId, version, deleteArgs} @@ -73,7 +84,7 @@ func (self *Record) Update(args RecordUpdate) ([]*RecordInfo, error) { "value": args.Value, "ttl": args.Ttl, } - updateOpts := map[string]int64{ + updateOpts := map[string]string{ "id": args.Id, } diff --git a/vendor/github.com/prasmussen/gandi-api/domain/zone/record/structs.go b/vendor/github.com/prasmussen/gandi-api/domain/zone/record/structs.go index 03d253c..ea9fd14 100644 --- a/vendor/github.com/prasmussen/gandi-api/domain/zone/record/structs.go +++ b/vendor/github.com/prasmussen/gandi-api/domain/zone/record/structs.go @@ -1,7 +1,7 @@ package record type RecordInfo struct { - Id int64 + Id string Name string Ttl int64 Type string @@ -24,7 +24,7 @@ type RecordUpdate struct { Type string `goptions:"-t, --type, obligatory, description='Record type'"` Value string `goptions:"-V, --value, obligatory, description='Value for record. Semantics depends on the record type.'"` Ttl int64 `goptions:"-T, --ttl, description='Time to live, in seconds, between 5 minutes and 30 days'"` - Id int64 `goptions:"-r, --record, obligatory, description='Record id'"` + Id string `goptions:"-r, --record, obligatory, description='Record id'"` } type RecordSet map[string]interface{} diff --git a/vendor/github.com/prasmussen/gandi-api/domain/zone/record/util.go b/vendor/github.com/prasmussen/gandi-api/domain/zone/record/util.go index 5560f0d..9a6add5 100644 --- a/vendor/github.com/prasmussen/gandi-api/domain/zone/record/util.go +++ b/vendor/github.com/prasmussen/gandi-api/domain/zone/record/util.go @@ -1,16 +1,15 @@ package record import ( - "github.com/prasmussen/gandi-api/util" + "github.com/prasmussen/gandi-api/util" ) - func ToRecordInfo(res map[string]interface{}) *RecordInfo { - return &RecordInfo{ - Id: util.ToInt64(res["id"]), - Name: util.ToString(res["name"]), - Ttl: util.ToInt64(res["ttl"]), - Type: util.ToString(res["type"]), - Value: util.ToString(res["value"]), - } + return &RecordInfo{ + Id: util.ToString(res["id"]), + Name: util.ToString(res["name"]), + Ttl: util.ToInt64(res["ttl"]), + Type: util.ToString(res["type"]), + Value: util.ToString(res["value"]), + } }