Skip to content

Commit

Permalink
feat(dns_firewall): break out into standalone package (#3693)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Dec 3, 2024
1 parent 160af8b commit 6e7733c
Show file tree
Hide file tree
Showing 16 changed files with 913 additions and 520 deletions.
120 changes: 60 additions & 60 deletions api.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/cloudflare/cloudflare-go/v3/dcv_delegation"
"github.com/cloudflare/cloudflare-go/v3/diagnostics"
"github.com/cloudflare/cloudflare-go/v3/dns"
"github.com/cloudflare/cloudflare-go/v3/dns_firewall"
"github.com/cloudflare/cloudflare-go/v3/durable_objects"
"github.com/cloudflare/cloudflare-go/v3/email_routing"
"github.com/cloudflare/cloudflare-go/v3/email_security"
Expand Down Expand Up @@ -114,6 +115,7 @@ type Client struct {
CustomCertificates *custom_certificates.CustomCertificateService
CustomHostnames *custom_hostnames.CustomHostnameService
CustomNameservers *custom_nameservers.CustomNameserverService
DNSFirewall *dns_firewall.DNSFirewallService
DNS *dns.DNSService
EmailSecurity *email_security.EmailSecurityService
EmailRouting *email_routing.EmailRoutingService
Expand Down Expand Up @@ -222,6 +224,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) {
r.CustomCertificates = custom_certificates.NewCustomCertificateService(opts...)
r.CustomHostnames = custom_hostnames.NewCustomHostnameService(opts...)
r.CustomNameservers = custom_nameservers.NewCustomNameserverService(opts...)
r.DNSFirewall = dns_firewall.NewDNSFirewallService(opts...)
r.DNS = dns.NewDNSService(opts...)
r.EmailSecurity = email_security.NewEmailSecurityService(opts...)
r.EmailRouting = email_routing.NewEmailRoutingService(opts...)
Expand Down
3 changes: 2 additions & 1 deletion dns/analyticsreportbytime.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/url"
"time"

"github.com/cloudflare/cloudflare-go/v3/dns_firewall"
"github.com/cloudflare/cloudflare-go/v3/internal/apijson"
"github.com/cloudflare/cloudflare-go/v3/internal/apiquery"
"github.com/cloudflare/cloudflare-go/v3/internal/param"
Expand Down Expand Up @@ -147,7 +148,7 @@ type AnalyticsReportBytimeGetParams struct {
// prefixed by - (descending) or + (ascending).
Sort param.Field[string] `query:"sort"`
// Unit of time to group data by.
TimeDelta param.Field[Delta] `query:"time_delta"`
TimeDelta param.Field[dns_firewall.Delta] `query:"time_delta"`
// End date and time of requesting data period in ISO 8601 format.
Until param.Field[time.Time] `query:"until" format:"date-time"`
}
Expand Down
3 changes: 2 additions & 1 deletion dns/analyticsreportbytime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/cloudflare/cloudflare-go/v3"
"github.com/cloudflare/cloudflare-go/v3/dns"
"github.com/cloudflare/cloudflare-go/v3/dns_firewall"
"github.com/cloudflare/cloudflare-go/v3/internal/testutil"
"github.com/cloudflare/cloudflare-go/v3/option"
)
Expand All @@ -36,7 +37,7 @@ func TestAnalyticsReportBytimeGetWithOptionalParams(t *testing.T) {
Metrics: cloudflare.F("queryCount,uncachedCount"),
Since: cloudflare.F(time.Now()),
Sort: cloudflare.F("+responseCode,-queryName"),
TimeDelta: cloudflare.F(dns.DeltaAll),
TimeDelta: cloudflare.F(dns_firewall.DeltaAll),
Until: cloudflare.F(time.Now()),
})
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package dns
import (
"time"

"github.com/cloudflare/cloudflare-go/v3/dns_firewall"
"github.com/cloudflare/cloudflare-go/v3/internal/apijson"
"github.com/cloudflare/cloudflare-go/v3/option"
)
Expand All @@ -21,7 +22,6 @@ type DNSService struct {
Records *RecordService
Settings *SettingService
Analytics *AnalyticsService
Firewall *FirewallService
ZoneTransfers *ZoneTransferService
}

Expand All @@ -35,7 +35,6 @@ func NewDNSService(opts ...option.RequestOption) (r *DNSService) {
r.Records = NewRecordService(opts...)
r.Settings = NewSettingService(opts...)
r.Analytics = NewAnalyticsService(opts...)
r.Firewall = NewFirewallService(opts...)
r.ZoneTransfers = NewZoneTransferService(opts...)
return
}
Expand All @@ -52,7 +51,7 @@ type DNSAnalyticsQuery struct {
// Start date and time of requesting data period in ISO 8601 format.
Since time.Time `json:"since,required" format:"date-time"`
// Unit of time to group data by.
TimeDelta Delta `json:"time_delta,required"`
TimeDelta dns_firewall.Delta `json:"time_delta,required"`
// End date and time of requesting data period in ISO 8601 format.
Until time.Time `json:"until,required" format:"date-time"`
// Segmentation filter in 'attribute operator value' format.
Expand Down
223 changes: 0 additions & 223 deletions dns/firewallreversedns.go

This file was deleted.

Loading

0 comments on commit 6e7733c

Please sign in to comment.