@@ -175,18 +175,6 @@ func NewInfobloxProvider(cfg *StartupConfig, domainFilter endpoint.DomainFilter)
175175 return provider , nil
176176}
177177
178- func recordQueryParams (zone string , view string ) * ibclient.QueryParams {
179- searchFields := map [string ]string {}
180- if zone != "" {
181- searchFields ["zone" ] = zone
182- }
183-
184- if view != "" {
185- searchFields ["view" ] = view
186- }
187- return ibclient .NewQueryParams (false , searchFields )
188- }
189-
190178// Records gets the current records.
191179func (p * Provider ) Records (_ context.Context ) (endpoints []* endpoint.Endpoint , err error ) {
192180 zones , err := p .zones ()
@@ -568,8 +556,11 @@ func (p *Provider) zones() ([]ibclient.ZoneAuth, error) {
568556 View : & p .config .View ,
569557 },
570558 )
571- queryParams := recordQueryParams ("" , p .config .View )
572- err := p .client .GetObject (obj , "" , queryParams , & res )
559+ searchFields := map [string ]string {}
560+ if p .config .View != "" {
561+ searchFields ["view" ] = p .config .View
562+ }
563+ err := PagingGetObject (p .client , obj , "" , searchFields , & res )
573564 if err != nil && ! isNotFoundError (err ) {
574565 return nil , err
575566 }
@@ -686,6 +677,10 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
686677 err = fmt .Errorf ("could not fetch A record ['%s':'%s'] : %w" , * obj .Name , * obj .Ipv4Addr , err )
687678 return
688679 }
680+ } else {
681+ // If getObject is not set (action == create), we need to set the View for Infoblox to find the parent zone
682+ // If View is set for the other actions, Infoblox will complain that the view field is not allowed
683+ obj .View = p .config .View
689684 }
690685 recordSet = infobloxRecordSet {
691686 obj : obj ,
@@ -705,6 +700,10 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
705700 if err != nil && ! isNotFoundError (err ) {
706701 return
707702 }
703+ } else {
704+ // If getObject is not set (action == create), we need to set the View for Infoblox to find the parent zone
705+ // If View is set for the other actions, Infoblox will complain that the view field is not allowed
706+ obj .View = p .config .View
708707 }
709708 recordSet = infobloxRecordSet {
710709 obj : obj ,
@@ -723,6 +722,10 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
723722 if err != nil && ! isNotFoundError (err ) {
724723 return
725724 }
725+ } else {
726+ // If getObject is not set (action == create), we need to set the View for Infoblox to find the parent zone
727+ // If View is set for the other actions, Infoblox will complain that the view field is not allowed
728+ obj .View = & p .config .View
726729 }
727730 recordSet = infobloxRecordSet {
728731 obj : obj ,
@@ -747,6 +750,10 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
747750 if err != nil && ! isNotFoundError (err ) {
748751 return
749752 }
753+ } else {
754+ // If getObject is not set (action == create), we need to set the View for Infoblox to find the parent zone
755+ // If View is set for the other actions, Infoblox will complain that the view field is not allowed
756+ obj .View = & p .config .View
750757 }
751758 recordSet = infobloxRecordSet {
752759 obj : obj ,
0 commit comments