# DNS Firewall ## List DNS Firewall Clusters `client.DNSFirewall.List(ctx, params) (*V4PagePaginationArray[DNSFirewallListResponse], error)` **get** `/accounts/{account_id}/dns_firewall` List DNS Firewall clusters for an account ### Parameters - `params DNSFirewallListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Page param.Field[float64]` Query param: Page number of paginated results - `PerPage param.Field[float64]` Query param: Number of clusters per page ### Returns - `type DNSFirewallListResponse struct{…}` - `ID string` Identifier. - `DeprecateAnyRequests bool` Whether to refuse to answer queries for the ANY type - `DNSFirewallIPs []FirewallIPs` - `ECSFallback bool` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `MaximumCacheTTL float64` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `MinimumCacheTTL float64` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `ModifiedOn Time` Last modification of DNS Firewall cluster - `Name string` DNS Firewall cluster name - `NegativeCacheTTL float64` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `Ratelimit float64` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `Retries float64` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `UpstreamIPs []UpstreamIPs` - `AttackMitigation AttackMitigation` Attack mitigation settings - `Enabled bool` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `OnlyWhenUpstreamUnhealthy bool` Only mitigate attacks when upstream servers seem unhealthy ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns_firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.DNSFirewall.List(context.TODO(), dns_firewall.DNSFirewallListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "deprecate_any_requests": true, "dns_firewall_ips": [ "203.0.113.1", "203.0.113.254", "2001:DB8:AB::CF", "2001:DB8:CD::CF" ], "ecs_fallback": false, "maximum_cache_ttl": 900, "minimum_cache_ttl": 60, "modified_on": "2014-01-01T05:20:00.12345Z", "name": "My Awesome DNS Firewall cluster", "negative_cache_ttl": 900, "ratelimit": 600, "retries": 2, "upstream_ips": [ "192.0.2.1", "198.51.100.1", "2001:DB8:100::CF" ], "attack_mitigation": { "enabled": true, "only_when_upstream_unhealthy": false } } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## DNS Firewall Cluster Details `client.DNSFirewall.Get(ctx, dnsFirewallID, query) (*DNSFirewallGetResponse, error)` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}` Show a single DNS Firewall cluster for an account ### Parameters - `dnsFirewallID string` Identifier. - `query DNSFirewallGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DNSFirewallGetResponse struct{…}` - `ID string` Identifier. - `DeprecateAnyRequests bool` Whether to refuse to answer queries for the ANY type - `DNSFirewallIPs []FirewallIPs` - `ECSFallback bool` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `MaximumCacheTTL float64` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `MinimumCacheTTL float64` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `ModifiedOn Time` Last modification of DNS Firewall cluster - `Name string` DNS Firewall cluster name - `NegativeCacheTTL float64` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `Ratelimit float64` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `Retries float64` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `UpstreamIPs []UpstreamIPs` - `AttackMitigation AttackMitigation` Attack mitigation settings - `Enabled bool` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `OnlyWhenUpstreamUnhealthy bool` Only mitigate attacks when upstream servers seem unhealthy ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns_firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dnsFirewall, err := client.DNSFirewall.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns_firewall.DNSFirewallGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dnsFirewall.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "deprecate_any_requests": true, "dns_firewall_ips": [ "203.0.113.1", "203.0.113.254", "2001:DB8:AB::CF", "2001:DB8:CD::CF" ], "ecs_fallback": false, "maximum_cache_ttl": 900, "minimum_cache_ttl": 60, "modified_on": "2014-01-01T05:20:00.12345Z", "name": "My Awesome DNS Firewall cluster", "negative_cache_ttl": 900, "ratelimit": 600, "retries": 2, "upstream_ips": [ "192.0.2.1", "198.51.100.1", "2001:DB8:100::CF" ], "attack_mitigation": { "enabled": true, "only_when_upstream_unhealthy": false } } } ``` ## Create DNS Firewall Cluster `client.DNSFirewall.New(ctx, params) (*DNSFirewallNewResponse, error)` **post** `/accounts/{account_id}/dns_firewall` Create a DNS Firewall cluster ### Parameters - `params DNSFirewallNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `Name param.Field[string]` Body param: DNS Firewall cluster name - `UpstreamIPs param.Field[[]UpstreamIPs]` Body param - `AttackMitigation param.Field[AttackMitigation]` Body param: Attack mitigation settings - `DeprecateAnyRequests param.Field[bool]` Body param: Whether to refuse to answer queries for the ANY type - `ECSFallback param.Field[bool]` Body param: Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `MaximumCacheTTL param.Field[float64]` Body param: By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `MinimumCacheTTL param.Field[float64]` Body param: By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `NegativeCacheTTL param.Field[float64]` Body param: This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `Ratelimit param.Field[float64]` Body param: Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `Retries param.Field[float64]` Body param: Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) ### Returns - `type DNSFirewallNewResponse struct{…}` - `ID string` Identifier. - `DeprecateAnyRequests bool` Whether to refuse to answer queries for the ANY type - `DNSFirewallIPs []FirewallIPs` - `ECSFallback bool` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `MaximumCacheTTL float64` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `MinimumCacheTTL float64` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `ModifiedOn Time` Last modification of DNS Firewall cluster - `Name string` DNS Firewall cluster name - `NegativeCacheTTL float64` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `Ratelimit float64` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `Retries float64` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `UpstreamIPs []UpstreamIPs` - `AttackMitigation AttackMitigation` Attack mitigation settings - `Enabled bool` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `OnlyWhenUpstreamUnhealthy bool` Only mitigate attacks when upstream servers seem unhealthy ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns_firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dnsFirewall, err := client.DNSFirewall.New(context.TODO(), dns_firewall.DNSFirewallNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("My Awesome DNS Firewall cluster"), UpstreamIPs: cloudflare.F([]dns_firewall.UpstreamIPsParam{"192.0.2.1", "198.51.100.1", "2001:DB8:100::CF"}), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dnsFirewall.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "deprecate_any_requests": true, "dns_firewall_ips": [ "203.0.113.1", "203.0.113.254", "2001:DB8:AB::CF", "2001:DB8:CD::CF" ], "ecs_fallback": false, "maximum_cache_ttl": 900, "minimum_cache_ttl": 60, "modified_on": "2014-01-01T05:20:00.12345Z", "name": "My Awesome DNS Firewall cluster", "negative_cache_ttl": 900, "ratelimit": 600, "retries": 2, "upstream_ips": [ "192.0.2.1", "198.51.100.1", "2001:DB8:100::CF" ], "attack_mitigation": { "enabled": true, "only_when_upstream_unhealthy": false } } } ``` ## Update DNS Firewall Cluster `client.DNSFirewall.Edit(ctx, dnsFirewallID, params) (*DNSFirewallEditResponse, error)` **patch** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}` Modify the configuration of a DNS Firewall cluster ### Parameters - `dnsFirewallID string` Identifier. - `params DNSFirewallEditParams` - `AccountID param.Field[string]` Path param: Identifier. - `AttackMitigation param.Field[AttackMitigation]` Body param: Attack mitigation settings - `DeprecateAnyRequests param.Field[bool]` Body param: Whether to refuse to answer queries for the ANY type - `ECSFallback param.Field[bool]` Body param: Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `MaximumCacheTTL param.Field[float64]` Body param: By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `MinimumCacheTTL param.Field[float64]` Body param: By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `Name param.Field[string]` Body param: DNS Firewall cluster name - `NegativeCacheTTL param.Field[float64]` Body param: This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `Ratelimit param.Field[float64]` Body param: Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `Retries param.Field[float64]` Body param: Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `UpstreamIPs param.Field[[]UpstreamIPs]` Body param ### Returns - `type DNSFirewallEditResponse struct{…}` - `ID string` Identifier. - `DeprecateAnyRequests bool` Whether to refuse to answer queries for the ANY type - `DNSFirewallIPs []FirewallIPs` - `ECSFallback bool` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `MaximumCacheTTL float64` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `MinimumCacheTTL float64` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `ModifiedOn Time` Last modification of DNS Firewall cluster - `Name string` DNS Firewall cluster name - `NegativeCacheTTL float64` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `Ratelimit float64` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `Retries float64` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `UpstreamIPs []UpstreamIPs` - `AttackMitigation AttackMitigation` Attack mitigation settings - `Enabled bool` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `OnlyWhenUpstreamUnhealthy bool` Only mitigate attacks when upstream servers seem unhealthy ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns_firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.DNSFirewall.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns_firewall.DNSFirewallEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "deprecate_any_requests": true, "dns_firewall_ips": [ "203.0.113.1", "203.0.113.254", "2001:DB8:AB::CF", "2001:DB8:CD::CF" ], "ecs_fallback": false, "maximum_cache_ttl": 900, "minimum_cache_ttl": 60, "modified_on": "2014-01-01T05:20:00.12345Z", "name": "My Awesome DNS Firewall cluster", "negative_cache_ttl": 900, "ratelimit": 600, "retries": 2, "upstream_ips": [ "192.0.2.1", "198.51.100.1", "2001:DB8:100::CF" ], "attack_mitigation": { "enabled": true, "only_when_upstream_unhealthy": false } } } ``` ## Delete DNS Firewall Cluster `client.DNSFirewall.Delete(ctx, dnsFirewallID, body) (*DNSFirewallDeleteResponse, error)` **delete** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}` Delete a DNS Firewall cluster ### Parameters - `dnsFirewallID string` Identifier. - `body DNSFirewallDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type DNSFirewallDeleteResponse struct{…}` - `ID string` Identifier. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns_firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dnsFirewall, err := client.DNSFirewall.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns_firewall.DNSFirewallDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dnsFirewall.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353" } } ``` ## Domain Types ### Attack Mitigation - `type AttackMitigation struct{…}` Attack mitigation settings - `Enabled bool` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `OnlyWhenUpstreamUnhealthy bool` Only mitigate attacks when upstream servers seem unhealthy ### Firewall IPs - `type FirewallIPs string` Cloudflare-assigned DNS IPv4 address ### Upstream IPs - `type UpstreamIPs string` Upstream DNS Server IPv4 address # Analytics # Reports ## Table `client.DNSFirewall.Analytics.Reports.Get(ctx, dnsFirewallID, params) (*Report, error)` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/dns_analytics/report` Retrieves a list of summarised aggregate metrics over a given time period. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters. ### Parameters - `dnsFirewallID string` Identifier. - `params AnalyticsReportGetParams` - `AccountID param.Field[string]` Path param: Identifier. - `Dimensions param.Field[string]` Query param: A comma-separated list of dimensions to group results by. - `Filters param.Field[string]` Query param: Segmentation filter in 'attribute operator value' format. - `Limit param.Field[int64]` Query param: Limit number of returned metrics. - `Metrics param.Field[string]` Query param: A comma-separated list of metrics to query. - `Since param.Field[Time]` Query param: Start date and time of requesting data period in ISO 8601 format. - `Sort param.Field[string]` Query param: A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `Until param.Field[Time]` Query param: End date and time of requesting data period in ISO 8601 format. ### Returns - `type Report struct{…}` - `Data []ReportData` Array with one row per combination of dimension values. - `Dimensions []string` Array of dimension values, representing the combination of dimension values corresponding to this row. - `Metrics []float64` Array with one item per requested metric. Each item is a single value. - `DataLag float64` Number of seconds between current time and last processed event, in another words how many seconds of data could be missing. - `Max unknown` Maximum results for each metric (object mapping metric names to values). Currently always an empty object. - `Min unknown` Minimum results for each metric (object mapping metric names to values). Currently always an empty object. - `Query ReportQuery` - `Dimensions []string` Array of dimension names. - `Limit int64` Limit number of returned metrics. - `Metrics []string` Array of metric names. - `Since Time` Start date and time of requesting data period in ISO 8601 format. - `Until Time` End date and time of requesting data period in ISO 8601 format. - `Filters string` Segmentation filter in 'attribute operator value' format. - `Sort []string` Array of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `Rows float64` Total number of rows in the result. - `Totals unknown` Total results for metrics across all data (object mapping metric names to values). ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns_firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) report, err := client.DNSFirewall.Analytics.Reports.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns_firewall.AnalyticsReportGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", report.Data) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "data": [ { "dimensions": [ "NODATA" ], "metrics": [ 0 ] } ], "data_lag": 60, "max": {}, "min": {}, "query": { "dimensions": [ "responseCode", "queryName" ], "limit": 100, "metrics": [ "queryCount", "responseTimeAvg" ], "since": "2023-11-11T12:00:00Z", "until": "2023-11-11T13:00:00Z", "filters": "responseCode==NOERROR,queryType==A", "sort": [ "+responseCode", "-queryName" ] }, "rows": 100, "totals": {} } } ``` # Bytimes ## By Time `client.DNSFirewall.Analytics.Reports.Bytimes.Get(ctx, dnsFirewallID, params) (*ByTime, error)` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/dns_analytics/report/bytime` Retrieves a list of aggregate metrics grouped by time interval. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters. ### Parameters - `dnsFirewallID string` Identifier. - `params AnalyticsReportBytimeGetParams` - `AccountID param.Field[string]` Path param: Identifier. - `Dimensions param.Field[string]` Query param: A comma-separated list of dimensions to group results by. - `Filters param.Field[string]` Query param: Segmentation filter in 'attribute operator value' format. - `Limit param.Field[int64]` Query param: Limit number of returned metrics. - `Metrics param.Field[string]` Query param: A comma-separated list of metrics to query. - `Since param.Field[Time]` Query param: Start date and time of requesting data period in ISO 8601 format. - `Sort param.Field[string]` Query param: A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `TimeDelta param.Field[AnalyticsReportBytimeGetParamsTimeDelta]` Query param: Unit of time to group data by. - `const AnalyticsReportBytimeGetParamsTimeDeltaAll AnalyticsReportBytimeGetParamsTimeDelta = "all"` - `const AnalyticsReportBytimeGetParamsTimeDeltaAuto AnalyticsReportBytimeGetParamsTimeDelta = "auto"` - `const AnalyticsReportBytimeGetParamsTimeDeltaYear AnalyticsReportBytimeGetParamsTimeDelta = "year"` - `const AnalyticsReportBytimeGetParamsTimeDeltaQuarter AnalyticsReportBytimeGetParamsTimeDelta = "quarter"` - `const AnalyticsReportBytimeGetParamsTimeDeltaMonth AnalyticsReportBytimeGetParamsTimeDelta = "month"` - `const AnalyticsReportBytimeGetParamsTimeDeltaWeek AnalyticsReportBytimeGetParamsTimeDelta = "week"` - `const AnalyticsReportBytimeGetParamsTimeDeltaDay AnalyticsReportBytimeGetParamsTimeDelta = "day"` - `const AnalyticsReportBytimeGetParamsTimeDeltaHour AnalyticsReportBytimeGetParamsTimeDelta = "hour"` - `const AnalyticsReportBytimeGetParamsTimeDeltaDekaminute AnalyticsReportBytimeGetParamsTimeDelta = "dekaminute"` - `const AnalyticsReportBytimeGetParamsTimeDeltaMinute AnalyticsReportBytimeGetParamsTimeDelta = "minute"` - `Until param.Field[Time]` Query param: End date and time of requesting data period in ISO 8601 format. ### Returns - `type ByTime struct{…}` - `Data []ByTimeData` Array with one row per combination of dimension values. - `Dimensions []string` Array of dimension values, representing the combination of dimension values corresponding to this row. - `Metrics [][]float64` Array with one item per requested metric. Each item is an array of values, broken down by time interval. - `DataLag float64` Number of seconds between current time and last processed event, in another words how many seconds of data could be missing. - `Max unknown` Maximum results for each metric (object mapping metric names to values). Currently always an empty object. - `Min unknown` Minimum results for each metric (object mapping metric names to values). Currently always an empty object. - `Query ByTimeQuery` - `Dimensions []string` Array of dimension names. - `Limit int64` Limit number of returned metrics. - `Metrics []string` Array of metric names. - `Since Time` Start date and time of requesting data period in ISO 8601 format. - `TimeDelta ByTimeQueryTimeDelta` Unit of time to group data by. - `const ByTimeQueryTimeDeltaAll ByTimeQueryTimeDelta = "all"` - `const ByTimeQueryTimeDeltaAuto ByTimeQueryTimeDelta = "auto"` - `const ByTimeQueryTimeDeltaYear ByTimeQueryTimeDelta = "year"` - `const ByTimeQueryTimeDeltaQuarter ByTimeQueryTimeDelta = "quarter"` - `const ByTimeQueryTimeDeltaMonth ByTimeQueryTimeDelta = "month"` - `const ByTimeQueryTimeDeltaWeek ByTimeQueryTimeDelta = "week"` - `const ByTimeQueryTimeDeltaDay ByTimeQueryTimeDelta = "day"` - `const ByTimeQueryTimeDeltaHour ByTimeQueryTimeDelta = "hour"` - `const ByTimeQueryTimeDeltaDekaminute ByTimeQueryTimeDelta = "dekaminute"` - `const ByTimeQueryTimeDeltaMinute ByTimeQueryTimeDelta = "minute"` - `Until Time` End date and time of requesting data period in ISO 8601 format. - `Filters string` Segmentation filter in 'attribute operator value' format. - `Sort []string` Array of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `Rows float64` Total number of rows in the result. - `TimeIntervals [][]Time` Array of time intervals in the response data. Each interval is represented as an array containing two values: the start time, and the end time. - `Totals unknown` Total results for metrics across all data (object mapping metric names to values). ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns_firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) byTime, err := client.DNSFirewall.Analytics.Reports.Bytimes.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns_firewall.AnalyticsReportBytimeGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", byTime.Data) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "data": [ { "dimensions": [ "NODATA" ], "metrics": [ [ 0 ] ] } ], "data_lag": 60, "max": {}, "min": {}, "query": { "dimensions": [ "responseCode", "queryName" ], "limit": 100, "metrics": [ "queryCount", "responseTimeAvg" ], "since": "2023-11-11T12:00:00Z", "time_delta": "hour", "until": "2023-11-11T13:00:00Z", "filters": "responseCode==NOERROR,queryType==A", "sort": [ "+responseCode", "-queryName" ] }, "rows": 100, "time_intervals": [ [ "2023-11-11T12:00:00Z" ] ], "totals": {} } } ``` # Reverse DNS ## Show DNS Firewall Cluster Reverse DNS `client.DNSFirewall.ReverseDNS.Get(ctx, dnsFirewallID, query) (*ReverseDNSGetResponse, error)` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/reverse_dns` Show reverse DNS configuration (PTR records) for a DNS Firewall cluster ### Parameters - `dnsFirewallID string` Identifier. - `query ReverseDNSGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type ReverseDNSGetResponse struct{…}` - `PTR map[string, string]` Map of cluster IP addresses to PTR record contents ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns_firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) reverseDNS, err := client.DNSFirewall.ReverseDNS.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns_firewall.ReverseDNSGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", reverseDNS.PTR) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "ptr": { "foo": "string" } } } ``` ## Update DNS Firewall Cluster Reverse DNS `client.DNSFirewall.ReverseDNS.Edit(ctx, dnsFirewallID, params) (*ReverseDNSEditResponse, error)` **patch** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/reverse_dns` Update reverse DNS configuration (PTR records) for a DNS Firewall cluster ### Parameters - `dnsFirewallID string` Identifier. - `params ReverseDNSEditParams` - `AccountID param.Field[string]` Path param: Identifier. - `PTR param.Field[map[string, string]]` Body param: Map of cluster IP addresses to PTR record contents ### Returns - `type ReverseDNSEditResponse struct{…}` - `PTR map[string, string]` Map of cluster IP addresses to PTR record contents ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns_firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.DNSFirewall.ReverseDNS.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns_firewall.ReverseDNSEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.PTR) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "ptr": { "foo": "string" } } } ```