Skip to content

Commit ca8abae

Browse files
feat(dom): add more filters on ListDNSZones to ease VPC sync (#1828)
Co-authored-by: Jules Casteran <[email protected]>
1 parent 25fa5d5 commit ca8abae

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

api/domain/v2beta1/domain_sdk.go

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,14 @@ const (
659659
ListDNSZonesRequestOrderBySubdomainAsc = ListDNSZonesRequestOrderBy("subdomain_asc")
660660
// Order by subdomain name (descending).
661661
ListDNSZonesRequestOrderBySubdomainDesc = ListDNSZonesRequestOrderBy("subdomain_desc")
662+
// Order by created date (ascending).
663+
ListDNSZonesRequestOrderByCreatedAtAsc = ListDNSZonesRequestOrderBy("created_at_asc")
664+
// Order by created date (descending).
665+
ListDNSZonesRequestOrderByCreatedAtDesc = ListDNSZonesRequestOrderBy("created_at_desc")
666+
// Order by updated date (ascending).
667+
ListDNSZonesRequestOrderByUpdatedAtAsc = ListDNSZonesRequestOrderBy("updated_at_asc")
668+
// Order by updated date (descending).
669+
ListDNSZonesRequestOrderByUpdatedAtDesc = ListDNSZonesRequestOrderBy("updated_at_desc")
662670
)
663671

664672
func (enum ListDNSZonesRequestOrderBy) String() string {
@@ -1909,8 +1917,18 @@ type ListDNSZonesRequest struct {
19091917
PageSize *uint32 `json:"-"`
19101918
// Domain: domain on which to filter the returned DNS zones.
19111919
Domain string `json:"-"`
1912-
// DNSZone: DNS zone on which to filter the returned DNS zones.
1913-
DNSZone string `json:"-"`
1920+
// Deprecated: DNSZone: DNS zone on which to filter the returned DNS zones.
1921+
DNSZone *string `json:"-"`
1922+
// DNSZones: DNS zones on which to filter the returned DNS zones.
1923+
DNSZones []string `json:"-"`
1924+
// CreatedAfter: only list DNS zones created after this date.
1925+
CreatedAfter *time.Time `json:"-"`
1926+
// CreatedBefore: only list DNS zones created before this date.
1927+
CreatedBefore *time.Time `json:"-"`
1928+
// UpdatedAfter: only list DNS zones updated after this date.
1929+
UpdatedAfter *time.Time `json:"-"`
1930+
// UpdatedBefore: only list DNS zones updated before this date.
1931+
UpdatedBefore *time.Time `json:"-"`
19141932
}
19151933

19161934
// ListDNSZones: list DNS zones.
@@ -1931,6 +1949,11 @@ func (s *API) ListDNSZones(req *ListDNSZonesRequest, opts ...scw.RequestOption)
19311949
parameter.AddToQuery(query, "page_size", req.PageSize)
19321950
parameter.AddToQuery(query, "domain", req.Domain)
19331951
parameter.AddToQuery(query, "dns_zone", req.DNSZone)
1952+
parameter.AddToQuery(query, "dns_zones", req.DNSZones)
1953+
parameter.AddToQuery(query, "created_after", req.CreatedAfter)
1954+
parameter.AddToQuery(query, "created_before", req.CreatedBefore)
1955+
parameter.AddToQuery(query, "updated_after", req.UpdatedAfter)
1956+
parameter.AddToQuery(query, "updated_before", req.UpdatedBefore)
19341957

19351958
scwReq := &scw.ScalewayRequest{
19361959
Method: "GET",

api/domain/v2beta1/domain_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (s *API) WaitForDNSZone(
5353
Get: func() (interface{}, bool, error) {
5454
// listing dns zones and take the first one
5555
DNSZones, err := s.ListDNSZones(&ListDNSZonesRequest{
56-
DNSZone: req.DNSZone,
56+
DNSZones: []string{req.DNSZone},
5757
}, opts...)
5858

5959
if err != nil {

0 commit comments

Comments
 (0)