Skip to content

Commit

Permalink
fix(domain): allow single or multiple dns zone in waiter (#1839)
Browse files Browse the repository at this point in the history
  • Loading branch information
Codelax committed Sep 20, 2023
1 parent a731a00 commit d2f8a2e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions api/domain/v2beta1/domain_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (
// WaitForDNSZoneRequest is used by WaitForDNSZone method.
type WaitForDNSZoneRequest struct {
DNSZone string
DNSZones []string
Timeout *time.Duration
RetryInterval *time.Duration
}
Expand All @@ -51,10 +52,16 @@ func (s *API) WaitForDNSZone(

dns, err := async.WaitSync(&async.WaitSyncConfig{
Get: func() (interface{}, bool, error) {
listReq := &ListDNSZonesRequest{
DNSZones: req.DNSZones,
}

if req.DNSZone != "" {
listReq.DNSZone = &req.DNSZone
}

// listing dns zones and take the first one
DNSZones, err := s.ListDNSZones(&ListDNSZonesRequest{
DNSZones: []string{req.DNSZone},
}, opts...)
DNSZones, err := s.ListDNSZones(listReq, opts...)

if err != nil {
return nil, false, err
Expand Down

0 comments on commit d2f8a2e

Please sign in to comment.