// AUTO-GENERATED by scripts/generate.ts from .generated-specs. Do not edit. import * as S from "@distilled.cloud/core/schema"; import * as API from "@distilled.cloud/core/api"; import * as T from "../traits.ts"; import { CloudflareProtocol, CloudflarePaginatedProtocol, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.ts"; import { cloudflarePaginate, ResultInfo } from "../pagination.ts"; import { CloudflareError, CloudflareRateLimited } from "../errors.ts"; import * as Retry from "../retry.ts"; export type { CloudflareOpError, CloudflareOpContext }; /** Fallback camelCase→wire mapping for opaque content (mined from the distilled SDK). */ const KEY_DICTIONARY: Record> = { attackMitigation: "attack_mitigation", dataLag: "data_lag", deprecateAnyRequests: "deprecate_any_requests", dnsFirewallIpCount: "dns_firewall_ip_count", dnsFirewallIps: "dns_firewall_ips", ecsFallback: "ecs_fallback", maximumCacheTtl: "maximum_cache_ttl", minimumCacheTtl: "minimum_cache_ttl", modifiedOn: "modified_on", negativeCacheTtl: "negative_cache_ttl", onlyWhenUpstreamUnhealthy: "only_when_upstream_unhealthy", perPage: "per_page", resultInfo: "result_info", timeDelta: "time_delta", timeIntervals: "time_intervals", totalCount: "total_count", upstreamIps: "upstream_ips", }; export class DnsFirewallNotEntitled extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "DnsFirewallNotEntitled", { code: S.Number, message: S.String, }, ), [{ code: 10101 }], ) {} export class DnsFirewallNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("DnsFirewallNotFound", { code: S.Number, message: S.String, }), [{ code: 11001 }], ) {} export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export type CreateRequestUpstreamIpsList = Array; export const CreateRequestUpstreamIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface CreateRequestAttackMitigation { /** When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers */ enabled?: boolean; /** Only mitigate attacks when upstream servers seem unhealthy */ onlyWhenUpstreamUnhealthy?: boolean; } export const CreateRequestAttackMitigation = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.Boolean), onlyWhenUpstreamUnhealthy: S.optional( S.Boolean.pipe(T.Body("only_when_upstream_unhealthy")), ), }), ).annotate({ identifier: "CreateRequestAttackMitigation", }) as any as S.Schema; export interface CreateDnsFirewallRequest { /** Identifier. */ accountId: string; /** DNS Firewall cluster name */ name: string; upstreamIps: CreateRequestUpstreamIpsList; /** Attack mitigation settings */ attackMitigation?: CreateRequestAttackMitigation; /** Whether to refuse to answer queries for the ANY type */ deprecateAnyRequests?: boolean; /** Number of IPv4 addresses to assign to the DNS Firewall cluster. Only used during cluster creation and cannot be changed later. */ dnsFirewallIpCount?: number; /** Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent */ ecsFallback?: boolean; /** By default, Cloudflare attempts to cache responses for as long as */ maximumCacheTtl?: number; /** By default, Cloudflare attempts to cache responses for as long as */ minimumCacheTtl?: number; /** This setting controls how long DNS Firewall should cache negative */ negativeCacheTtl?: number | null; /** Maximum number of DNS queries per second that will be forwarded to your upstream nameservers. The limit is enforced per server, where each server receives a fraction of the configured value. The actual aggregate rate for a data center may vary depending on how many servers are present. Responses served from cache do not count toward this limit. Set to null to disable rate limiting. */ ratelimit?: number | null; /** Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) */ retries?: number; } export const CreateDnsFirewallRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), name: S.String, upstreamIps: CreateRequestUpstreamIpsList.pipe(T.Body("upstream_ips")), attackMitigation: S.optional( CreateRequestAttackMitigation.pipe(T.Body("attack_mitigation")), ), deprecateAnyRequests: S.optional( S.Boolean.pipe(T.Body("deprecate_any_requests")), ), dnsFirewallIpCount: S.optional( S.Number.pipe(T.Body("dns_firewall_ip_count")), ), ecsFallback: S.optional(S.Boolean.pipe(T.Body("ecs_fallback"))), maximumCacheTtl: S.optional(S.Number.pipe(T.Body("maximum_cache_ttl"))), minimumCacheTtl: S.optional(S.Number.pipe(T.Body("minimum_cache_ttl"))), negativeCacheTtl: S.optional( S.NullOr(S.Number).pipe(T.Body("negative_cache_ttl")), ), ratelimit: S.optional(S.NullOr(S.Number)), retries: S.optional(S.Number), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/dns_firewall", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateDnsFirewallRequest", }) as any as S.Schema; export type CreateResponseDnsFirewallIpsList = Array; export const CreateResponseDnsFirewallIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type CreateResponseUpstreamIpsList = Array; export const CreateResponseUpstreamIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface CreateResponseAttackMitigation { /** When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers */ enabled?: boolean | null; /** Only mitigate attacks when upstream servers seem unhealthy */ onlyWhenUpstreamUnhealthy?: boolean | null; } export const CreateResponseAttackMitigation = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.NullOr(S.Boolean)), onlyWhenUpstreamUnhealthy: S.optional( S.NullOr(S.Boolean).pipe(T.Body("only_when_upstream_unhealthy")), ), }), ).annotate({ identifier: "CreateResponseAttackMitigation", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateDnsFirewallResponse { /** Identifier. */ id: string; /** Whether to refuse to answer queries for the ANY type */ deprecateAnyRequests: boolean; dnsFirewallIps: CreateResponseDnsFirewallIpsList; /** Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent */ ecsFallback: boolean; /** By default, Cloudflare attempts to cache responses for as long as */ maximumCacheTtl: number; /** By default, Cloudflare attempts to cache responses for as long as */ minimumCacheTtl: number; /** Last modification of DNS Firewall cluster */ modifiedOn: string; /** DNS Firewall cluster name */ name: string; /** This setting controls how long DNS Firewall should cache negative */ negativeCacheTtl: number; /** Maximum number of DNS queries per second that will be forwarded to your upstream nameservers. The limit is enforced per server, where each server receives a fraction of the configured value. The actual aggregate rate for a data center may vary depending on how many servers are present. Responses served from cache do not count toward this limit. Set to null to disable rate limiting. */ ratelimit: number; /** Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) */ retries: number; upstreamIps: CreateResponseUpstreamIpsList; /** Attack mitigation settings */ attackMitigation?: CreateResponseAttackMitigation | null; } export const CreateDnsFirewallResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, deprecateAnyRequests: S.Boolean.pipe(T.Body("deprecate_any_requests")), dnsFirewallIps: CreateResponseDnsFirewallIpsList.pipe( T.Body("dns_firewall_ips"), ), ecsFallback: S.Boolean.pipe(T.Body("ecs_fallback")), maximumCacheTtl: S.Number.pipe(T.Body("maximum_cache_ttl")), minimumCacheTtl: S.Number.pipe(T.Body("minimum_cache_ttl")), modifiedOn: S.String.pipe(T.Body("modified_on")), name: S.String, negativeCacheTtl: S.Number.pipe(T.Body("negative_cache_ttl")), ratelimit: S.Number, retries: S.Number, upstreamIps: CreateResponseUpstreamIpsList.pipe(T.Body("upstream_ips")), attackMitigation: S.optional( S.NullOr(CreateResponseAttackMitigation).pipe( T.Body("attack_mitigation"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateDnsFirewallResponse", }) as any as S.Schema; export interface DeleteDnsFirewallRequest { /** Identifier. */ accountId: string; /** Identifier. */ dnsFirewallId: string; } export const DeleteDnsFirewallRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), dnsFirewallId: S.String.pipe(T.Label("dns_firewall_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/dns_firewall/{dns_firewall_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteDnsFirewallRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeleteDnsFirewallResponse { /** Identifier. */ id?: string | null; } export const DeleteDnsFirewallResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteDnsFirewallResponse", }) as any as S.Schema; export interface GetAnalyticReportRequest { /** Identifier. */ accountId: string; /** Identifier. */ dnsFirewallId: string; /** A comma-separated list of dimensions to group results by. */ dimensions?: string; /** Segmentation filter in 'attribute operator value' format. */ filters?: string; /** Limit number of returned metrics. */ limit?: number; /** A comma-separated list of metrics to query. */ metrics?: string; /** Start date and time of requesting data period in ISO 8601 format. */ since?: string; /** A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). */ sort?: string; /** End date and time of requesting data period in ISO 8601 format. */ until?: string; } export const GetAnalyticReportRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), dnsFirewallId: S.String.pipe(T.Label("dns_firewall_id")), dimensions: S.optional(S.String.pipe(T.Query())), filters: S.optional(S.String.pipe(T.Query())), limit: S.optional(S.Number.pipe(T.Query())), metrics: S.optional(S.String.pipe(T.Query())), since: S.optional(S.String.pipe(T.Query())), sort: S.optional(S.String.pipe(T.Query())), until: S.optional(S.String.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/dns_firewall/{dns_firewall_id}/dns_analytics/report", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetAnalyticReportRequest", }) as any as S.Schema; export type AnalyticsReportsGetResponseDataItemDimensionsList = Array; export const AnalyticsReportsGetResponseDataItemDimensionsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type AnalyticsReportsGetResponseDataItemMetricsList = Array; export const AnalyticsReportsGetResponseDataItemMetricsList = /*@__PURE__*/ S.Array( S.Number, ) as any as S.Schema; export interface AnalyticsReportsGetResponseDataItem { /** Array of dimension values, representing the combination of dimension values corresponding to this row. */ dimensions: AnalyticsReportsGetResponseDataItemDimensionsList; /** Array with one item per requested metric. Each item is a single value. */ metrics: AnalyticsReportsGetResponseDataItemMetricsList; } export const AnalyticsReportsGetResponseDataItem = /*@__PURE__*/ S.suspend(() => S.Struct({ dimensions: AnalyticsReportsGetResponseDataItemDimensionsList, metrics: AnalyticsReportsGetResponseDataItemMetricsList, }), ).annotate({ identifier: "AnalyticsReportsGetResponseDataItem", }) as any as S.Schema; export type AnalyticsReportsGetResponseDataList = Array; export const AnalyticsReportsGetResponseDataList = /*@__PURE__*/ S.Array( AnalyticsReportsGetResponseDataItem, ) as any as S.Schema; export type AnalyticsReportsGetResponseQueryDimensionsList = Array; export const AnalyticsReportsGetResponseQueryDimensionsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type AnalyticsReportsGetResponseQueryMetricsList = Array; export const AnalyticsReportsGetResponseQueryMetricsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type AnalyticsReportsGetResponseQuerySortList = Array; export const AnalyticsReportsGetResponseQuerySortList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface AnalyticsReportsGetResponseQuery { /** Array of dimension names. */ dimensions: AnalyticsReportsGetResponseQueryDimensionsList; /** Limit number of returned metrics. */ limit: number; /** Array of metric names. */ metrics: AnalyticsReportsGetResponseQueryMetricsList; /** Start date and time of requesting data period in ISO 8601 format. */ since: string; /** End date and time of requesting data period in ISO 8601 format. */ until: string; /** Segmentation filter in 'attribute operator value' format. */ filters?: string | null; /** Array of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). */ sort?: AnalyticsReportsGetResponseQuerySortList | null; } export const AnalyticsReportsGetResponseQuery = /*@__PURE__*/ S.suspend(() => S.Struct({ dimensions: AnalyticsReportsGetResponseQueryDimensionsList, limit: S.Number, metrics: AnalyticsReportsGetResponseQueryMetricsList, since: S.String, until: S.String, filters: S.optional(S.NullOr(S.String)), sort: S.optional(S.NullOr(AnalyticsReportsGetResponseQuerySortList)), }), ).annotate({ identifier: "AnalyticsReportsGetResponseQuery", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetAnalyticReportResponse { /** Array with one row per combination of dimension values. */ data: AnalyticsReportsGetResponseDataList; /** Number of seconds between current time and last processed event, in another words how many seconds of data could be missing. */ dataLag: number; /** Maximum results for each metric (object mapping metric names to values). Currently always an empty object. */ max: unknown; /** Minimum results for each metric (object mapping metric names to values). Currently always an empty object. */ min: unknown; query: AnalyticsReportsGetResponseQuery; /** Total number of rows in the result. */ rows: number; /** Total results for metrics across all data (object mapping metric names to values). */ totals: unknown; } export const GetAnalyticReportResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ data: AnalyticsReportsGetResponseDataList, dataLag: S.Number.pipe(T.Body("data_lag")), max: S.Unknown, min: S.Unknown, query: AnalyticsReportsGetResponseQuery, rows: S.Number, totals: S.Unknown, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetAnalyticReportResponse", }) as any as S.Schema; export type AnalyticsReportsBytimesGetRequestTimeDelta = | "all" | "auto" | "year" | "quarter" | "month" | "week" | "day" | "hour" | "dekaminute" | "minute"; export const AnalyticsReportsBytimesGetRequestTimeDelta = /*@__PURE__*/ S.String; export interface GetAnalyticReportBytimeRequest { /** Identifier. */ accountId: string; /** Identifier. */ dnsFirewallId: string; /** A comma-separated list of dimensions to group results by. */ dimensions?: string; /** Segmentation filter in 'attribute operator value' format. */ filters?: string; /** Limit number of returned metrics. */ limit?: number; /** A comma-separated list of metrics to query. */ metrics?: string; /** Start date and time of requesting data period in ISO 8601 format. */ since?: string; /** A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). */ sort?: string; /** Unit of time to group data by. */ timeDelta?: AnalyticsReportsBytimesGetRequestTimeDelta | (string & {}); /** End date and time of requesting data period in ISO 8601 format. */ until?: string; } export const GetAnalyticReportBytimeRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), dnsFirewallId: S.String.pipe(T.Label("dns_firewall_id")), dimensions: S.optional(S.String.pipe(T.Query())), filters: S.optional(S.String.pipe(T.Query())), limit: S.optional(S.Number.pipe(T.Query())), metrics: S.optional(S.String.pipe(T.Query())), since: S.optional(S.String.pipe(T.Query())), sort: S.optional(S.String.pipe(T.Query())), timeDelta: S.optional( AnalyticsReportsBytimesGetRequestTimeDelta.pipe(T.Query("time_delta")), ), until: S.optional(S.String.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/dns_firewall/{dns_firewall_id}/dns_analytics/report/bytime", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetAnalyticReportBytimeRequest", }) as any as S.Schema; export type AnalyticsReportsBytimesGetResponseDataItemDimensionsList = Array; export const AnalyticsReportsBytimesGetResponseDataItemDimensionsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type AnalyticsReportsBytimesGetResponseDataItemMetricsItemList = Array; export const AnalyticsReportsBytimesGetResponseDataItemMetricsItemList = /*@__PURE__*/ S.Array( S.Number, ) as any as S.Schema; export type AnalyticsReportsBytimesGetResponseDataItemMetricsList = Array; export const AnalyticsReportsBytimesGetResponseDataItemMetricsList = /*@__PURE__*/ S.Array( AnalyticsReportsBytimesGetResponseDataItemMetricsItemList, ) as any as S.Schema; export interface AnalyticsReportsBytimesGetResponseDataItem { /** Array of dimension values, representing the combination of dimension values corresponding to this row. */ dimensions: AnalyticsReportsBytimesGetResponseDataItemDimensionsList; /** Array with one item per requested metric. Each item is an array of values, broken down by time interval. */ metrics: AnalyticsReportsBytimesGetResponseDataItemMetricsList; } export const AnalyticsReportsBytimesGetResponseDataItem = /*@__PURE__*/ S.suspend(() => S.Struct({ dimensions: AnalyticsReportsBytimesGetResponseDataItemDimensionsList, metrics: AnalyticsReportsBytimesGetResponseDataItemMetricsList, }), ).annotate({ identifier: "AnalyticsReportsBytimesGetResponseDataItem", }) as any as S.Schema; export type AnalyticsReportsBytimesGetResponseDataList = Array; export const AnalyticsReportsBytimesGetResponseDataList = /*@__PURE__*/ S.Array( AnalyticsReportsBytimesGetResponseDataItem, ) as any as S.Schema; export type AnalyticsReportsBytimesGetResponseQueryDimensionsList = Array; export const AnalyticsReportsBytimesGetResponseQueryDimensionsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type AnalyticsReportsBytimesGetResponseQueryMetricsList = Array; export const AnalyticsReportsBytimesGetResponseQueryMetricsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type AnalyticsReportsBytimesGetResponseQueryTimeDelta = | "all" | "auto" | "year" | "quarter" | "month" | "week" | "day" | "hour" | "dekaminute" | "minute"; export const AnalyticsReportsBytimesGetResponseQueryTimeDelta = /*@__PURE__*/ S.String; export type AnalyticsReportsBytimesGetResponseQuerySortList = Array; export const AnalyticsReportsBytimesGetResponseQuerySortList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface AnalyticsReportsBytimesGetResponseQuery { /** Array of dimension names. */ dimensions: AnalyticsReportsBytimesGetResponseQueryDimensionsList; /** Limit number of returned metrics. */ limit: number; /** Array of metric names. */ metrics: AnalyticsReportsBytimesGetResponseQueryMetricsList; /** Start date and time of requesting data period in ISO 8601 format. */ since: string; /** Unit of time to group data by. */ timeDelta: AnalyticsReportsBytimesGetResponseQueryTimeDelta; /** End date and time of requesting data period in ISO 8601 format. */ until: string; /** Segmentation filter in 'attribute operator value' format. */ filters?: string | null; /** Array of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). */ sort?: AnalyticsReportsBytimesGetResponseQuerySortList | null; } export const AnalyticsReportsBytimesGetResponseQuery = /*@__PURE__*/ S.suspend( () => S.Struct({ dimensions: AnalyticsReportsBytimesGetResponseQueryDimensionsList, limit: S.Number, metrics: AnalyticsReportsBytimesGetResponseQueryMetricsList, since: S.String, timeDelta: AnalyticsReportsBytimesGetResponseQueryTimeDelta.pipe( T.Body("time_delta"), ), until: S.String, filters: S.optional(S.NullOr(S.String)), sort: S.optional( S.NullOr(AnalyticsReportsBytimesGetResponseQuerySortList), ), }), ).annotate({ identifier: "AnalyticsReportsBytimesGetResponseQuery", }) as any as S.Schema; export type AnalyticsReportsBytimesGetResponseTimeIntervalsItemList = Array; export const AnalyticsReportsBytimesGetResponseTimeIntervalsItemList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type AnalyticsReportsBytimesGetResponseTimeIntervalsList = Array; export const AnalyticsReportsBytimesGetResponseTimeIntervalsList = /*@__PURE__*/ S.Array( AnalyticsReportsBytimesGetResponseTimeIntervalsItemList, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetAnalyticReportBytimeResponse { /** Array with one row per combination of dimension values. */ data: AnalyticsReportsBytimesGetResponseDataList; /** Number of seconds between current time and last processed event, in another words how many seconds of data could be missing. */ dataLag: number; /** Maximum results for each metric (object mapping metric names to values). Currently always an empty object. */ max: unknown; /** Minimum results for each metric (object mapping metric names to values). Currently always an empty object. */ min: unknown; query: AnalyticsReportsBytimesGetResponseQuery; /** Total number of rows in the result. */ rows: number; /** 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. */ timeIntervals: AnalyticsReportsBytimesGetResponseTimeIntervalsList; /** Total results for metrics across all data (object mapping metric names to values). */ totals: unknown; } export const GetAnalyticReportBytimeResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ data: AnalyticsReportsBytimesGetResponseDataList, dataLag: S.Number.pipe(T.Body("data_lag")), max: S.Unknown, min: S.Unknown, query: AnalyticsReportsBytimesGetResponseQuery, rows: S.Number, timeIntervals: AnalyticsReportsBytimesGetResponseTimeIntervalsList.pipe( T.Body("time_intervals"), ), totals: S.Unknown, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetAnalyticReportBytimeResponse", }) as any as S.Schema; export interface GetDnsFirewallRequest { /** Identifier. */ accountId: string; /** Identifier. */ dnsFirewallId: string; } export const GetDnsFirewallRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), dnsFirewallId: S.String.pipe(T.Label("dns_firewall_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/dns_firewall/{dns_firewall_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetDnsFirewallRequest", }) as any as S.Schema; export type GetResponseDnsFirewallIpsList = Array; export const GetResponseDnsFirewallIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type GetResponseUpstreamIpsList = Array; export const GetResponseUpstreamIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type GetResponseAttackMitigation = CreateResponseAttackMitigation; export const GetResponseAttackMitigation = CreateResponseAttackMitigation; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetDnsFirewallResponse { /** Identifier. */ id: string; /** Whether to refuse to answer queries for the ANY type */ deprecateAnyRequests: boolean; dnsFirewallIps: GetResponseDnsFirewallIpsList; /** Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent */ ecsFallback: boolean; /** By default, Cloudflare attempts to cache responses for as long as */ maximumCacheTtl: number; /** By default, Cloudflare attempts to cache responses for as long as */ minimumCacheTtl: number; /** Last modification of DNS Firewall cluster */ modifiedOn: string; /** DNS Firewall cluster name */ name: string; /** This setting controls how long DNS Firewall should cache negative */ negativeCacheTtl: number; /** Maximum number of DNS queries per second that will be forwarded to your upstream nameservers. The limit is enforced per server, where each server receives a fraction of the configured value. The actual aggregate rate for a data center may vary depending on how many servers are present. Responses served from cache do not count toward this limit. Set to null to disable rate limiting. */ ratelimit: number; /** Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) */ retries: number; upstreamIps: GetResponseUpstreamIpsList; /** Attack mitigation settings */ attackMitigation?: CreateResponseAttackMitigation | null; } export const GetDnsFirewallResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, deprecateAnyRequests: S.Boolean.pipe(T.Body("deprecate_any_requests")), dnsFirewallIps: GetResponseDnsFirewallIpsList.pipe( T.Body("dns_firewall_ips"), ), ecsFallback: S.Boolean.pipe(T.Body("ecs_fallback")), maximumCacheTtl: S.Number.pipe(T.Body("maximum_cache_ttl")), minimumCacheTtl: S.Number.pipe(T.Body("minimum_cache_ttl")), modifiedOn: S.String.pipe(T.Body("modified_on")), name: S.String, negativeCacheTtl: S.Number.pipe(T.Body("negative_cache_ttl")), ratelimit: S.Number, retries: S.Number, upstreamIps: GetResponseUpstreamIpsList.pipe(T.Body("upstream_ips")), attackMitigation: S.optional( S.NullOr(CreateResponseAttackMitigation).pipe( T.Body("attack_mitigation"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetDnsFirewallResponse", }) as any as S.Schema; export interface GetReverseDnRequest { /** Identifier. */ accountId: string; /** Identifier. */ dnsFirewallId: string; } export const GetReverseDnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), dnsFirewallId: S.String.pipe(T.Label("dns_firewall_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/dns_firewall/{dns_firewall_id}/reverse_dns", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetReverseDnRequest", }) as any as S.Schema; export type ReverseDnsGetResponsePtrMap = { [key: string]: string | undefined }; export const ReverseDnsGetResponsePtrMap = /*@__PURE__*/ S.Record( S.String, S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetReverseDnResponse { /** Map of cluster IP addresses to PTR record contents */ ptr: ReverseDnsGetResponsePtrMap; } export const GetReverseDnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ ptr: ReverseDnsGetResponsePtrMap, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetReverseDnResponse", }) as any as S.Schema; export interface ListDnsFirewallsRequest { /** Identifier. */ accountId: string; /** Page number of paginated results */ page?: number; /** Number of clusters per page */ perPage?: number; } export const ListDnsFirewallsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), page: S.optional(S.Number.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/dns_firewall", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListDnsFirewallsRequest", }) as any as S.Schema; export type ListResultItemDnsFirewallIpsList = Array; export const ListResultItemDnsFirewallIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type ListResultItemUpstreamIpsList = Array; export const ListResultItemUpstreamIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type ListResultItemAttackMitigation = CreateResponseAttackMitigation; export const ListResultItemAttackMitigation = CreateResponseAttackMitigation; export interface ListResultItem { /** Identifier. */ id: string; /** Whether to refuse to answer queries for the ANY type */ deprecateAnyRequests: boolean; dnsFirewallIps: ListResultItemDnsFirewallIpsList; /** Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent */ ecsFallback: boolean; /** By default, Cloudflare attempts to cache responses for as long as */ maximumCacheTtl: number; /** By default, Cloudflare attempts to cache responses for as long as */ minimumCacheTtl: number; /** Last modification of DNS Firewall cluster */ modifiedOn: string; /** DNS Firewall cluster name */ name: string; /** This setting controls how long DNS Firewall should cache negative */ negativeCacheTtl: number; /** Maximum number of DNS queries per second that will be forwarded to your upstream nameservers. The limit is enforced per server, where each server receives a fraction of the configured value. The actual aggregate rate for a data center may vary depending on how many servers are present. Responses served from cache do not count toward this limit. Set to null to disable rate limiting. */ ratelimit: number; /** Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) */ retries: number; upstreamIps: ListResultItemUpstreamIpsList; /** Attack mitigation settings */ attackMitigation?: CreateResponseAttackMitigation | null; } export const ListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, deprecateAnyRequests: S.Boolean.pipe(T.Body("deprecate_any_requests")), dnsFirewallIps: ListResultItemDnsFirewallIpsList.pipe( T.Body("dns_firewall_ips"), ), ecsFallback: S.Boolean.pipe(T.Body("ecs_fallback")), maximumCacheTtl: S.Number.pipe(T.Body("maximum_cache_ttl")), minimumCacheTtl: S.Number.pipe(T.Body("minimum_cache_ttl")), modifiedOn: S.String.pipe(T.Body("modified_on")), name: S.String, negativeCacheTtl: S.Number.pipe(T.Body("negative_cache_ttl")), ratelimit: S.Number, retries: S.Number, upstreamIps: ListResultItemUpstreamIpsList.pipe(T.Body("upstream_ips")), attackMitigation: S.optional( S.NullOr(CreateResponseAttackMitigation).pipe( T.Body("attack_mitigation"), ), ), }), ).annotate({ identifier: "ListResultItem" }) as any as S.Schema; export type ListResultList = Array; export const ListResultList = /*@__PURE__*/ S.Array( ListResultItem, ) as any as S.Schema; export interface ListDnsFirewallsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: ListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListDnsFirewallsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: ListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListDnsFirewallsResponse", }) as any as S.Schema; export type EditRequestAttackMitigation = CreateRequestAttackMitigation; export const EditRequestAttackMitigation = CreateRequestAttackMitigation; export type EditRequestUpstreamIpsList = Array; export const EditRequestUpstreamIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface PatchDnsFirewallRequest { /** Identifier. */ accountId: string; /** Identifier. */ dnsFirewallId: string; /** Attack mitigation settings */ attackMitigation?: CreateRequestAttackMitigation; /** Whether to refuse to answer queries for the ANY type */ deprecateAnyRequests?: boolean; /** Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent */ ecsFallback?: boolean; /** By default, Cloudflare attempts to cache responses for as long as */ maximumCacheTtl?: number; /** By default, Cloudflare attempts to cache responses for as long as */ minimumCacheTtl?: number; /** DNS Firewall cluster name */ name?: string; /** This setting controls how long DNS Firewall should cache negative */ negativeCacheTtl?: number | null; /** Maximum number of DNS queries per second that will be forwarded to your upstream nameservers. The limit is enforced per server, where each server receives a fraction of the configured value. The actual aggregate rate for a data center may vary depending on how many servers are present. Responses served from cache do not count toward this limit. Set to null to disable rate limiting. */ ratelimit?: number | null; /** Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) */ retries?: number; upstreamIps?: EditRequestUpstreamIpsList; } export const PatchDnsFirewallRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), dnsFirewallId: S.String.pipe(T.Label("dns_firewall_id")), attackMitigation: S.optional( CreateRequestAttackMitigation.pipe(T.Body("attack_mitigation")), ), deprecateAnyRequests: S.optional( S.Boolean.pipe(T.Body("deprecate_any_requests")), ), ecsFallback: S.optional(S.Boolean.pipe(T.Body("ecs_fallback"))), maximumCacheTtl: S.optional(S.Number.pipe(T.Body("maximum_cache_ttl"))), minimumCacheTtl: S.optional(S.Number.pipe(T.Body("minimum_cache_ttl"))), name: S.optional(S.String), negativeCacheTtl: S.optional( S.NullOr(S.Number).pipe(T.Body("negative_cache_ttl")), ), ratelimit: S.optional(S.NullOr(S.Number)), retries: S.optional(S.Number), upstreamIps: S.optional( EditRequestUpstreamIpsList.pipe(T.Body("upstream_ips")), ), }) .pipe( T.Http({ method: "PATCH", uri: "/accounts/{account_id}/dns_firewall/{dns_firewall_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchDnsFirewallRequest", }) as any as S.Schema; export type EditResponseDnsFirewallIpsList = Array; export const EditResponseDnsFirewallIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type EditResponseUpstreamIpsList = Array; export const EditResponseUpstreamIpsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type EditResponseAttackMitigation = CreateResponseAttackMitigation; export const EditResponseAttackMitigation = CreateResponseAttackMitigation; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PatchDnsFirewallResponse { /** Identifier. */ id: string; /** Whether to refuse to answer queries for the ANY type */ deprecateAnyRequests: boolean; dnsFirewallIps: EditResponseDnsFirewallIpsList; /** Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent */ ecsFallback: boolean; /** By default, Cloudflare attempts to cache responses for as long as */ maximumCacheTtl: number; /** By default, Cloudflare attempts to cache responses for as long as */ minimumCacheTtl: number; /** Last modification of DNS Firewall cluster */ modifiedOn: string; /** DNS Firewall cluster name */ name: string; /** This setting controls how long DNS Firewall should cache negative */ negativeCacheTtl: number; /** Maximum number of DNS queries per second that will be forwarded to your upstream nameservers. The limit is enforced per server, where each server receives a fraction of the configured value. The actual aggregate rate for a data center may vary depending on how many servers are present. Responses served from cache do not count toward this limit. Set to null to disable rate limiting. */ ratelimit: number; /** Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) */ retries: number; upstreamIps: EditResponseUpstreamIpsList; /** Attack mitigation settings */ attackMitigation?: CreateResponseAttackMitigation | null; } export const PatchDnsFirewallResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, deprecateAnyRequests: S.Boolean.pipe(T.Body("deprecate_any_requests")), dnsFirewallIps: EditResponseDnsFirewallIpsList.pipe( T.Body("dns_firewall_ips"), ), ecsFallback: S.Boolean.pipe(T.Body("ecs_fallback")), maximumCacheTtl: S.Number.pipe(T.Body("maximum_cache_ttl")), minimumCacheTtl: S.Number.pipe(T.Body("minimum_cache_ttl")), modifiedOn: S.String.pipe(T.Body("modified_on")), name: S.String, negativeCacheTtl: S.Number.pipe(T.Body("negative_cache_ttl")), ratelimit: S.Number, retries: S.Number, upstreamIps: EditResponseUpstreamIpsList.pipe(T.Body("upstream_ips")), attackMitigation: S.optional( S.NullOr(CreateResponseAttackMitigation).pipe( T.Body("attack_mitigation"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchDnsFirewallResponse", }) as any as S.Schema; export type ReverseDnsEditRequestPtrMap = { [key: string]: string | undefined }; export const ReverseDnsEditRequestPtrMap = /*@__PURE__*/ S.Record( S.String, S.String, ) as any as S.Schema; export interface PatchReverseDnRequest { /** Identifier. */ accountId: string; /** Identifier. */ dnsFirewallId: string; /** Map of cluster IP addresses to PTR record contents */ ptr?: ReverseDnsEditRequestPtrMap; } export const PatchReverseDnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), dnsFirewallId: S.String.pipe(T.Label("dns_firewall_id")), ptr: S.optional(ReverseDnsEditRequestPtrMap), }) .pipe( T.Http({ method: "PATCH", uri: "/accounts/{account_id}/dns_firewall/{dns_firewall_id}/reverse_dns", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchReverseDnRequest", }) as any as S.Schema; export type ReverseDnsEditResponsePtrMap = { [key: string]: string | undefined; }; export const ReverseDnsEditResponsePtrMap = /*@__PURE__*/ S.Record( S.String, S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PatchReverseDnResponse { /** Map of cluster IP addresses to PTR record contents */ ptr: ReverseDnsEditResponsePtrMap; } export const PatchReverseDnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ ptr: ReverseDnsEditResponsePtrMap, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchReverseDnResponse", }) as any as S.Schema; export type CreateDnsFirewallError = | DnsFirewallNotEntitled | Forbidden | CloudflareOpError; /** Create a DNS Firewall cluster */ export const createDnsFirewall: API.OperationMethod< CreateDnsFirewallRequest, CreateDnsFirewallResponse, CreateDnsFirewallError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateDnsFirewallRequest, output: CreateDnsFirewallResponse, errors: [ DnsFirewallNotEntitled, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteDnsFirewallError = | DnsFirewallNotFound | Forbidden | CloudflareOpError; /** Delete a DNS Firewall cluster */ export const deleteDnsFirewall: API.OperationMethod< DeleteDnsFirewallRequest, DeleteDnsFirewallResponse, DeleteDnsFirewallError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteDnsFirewallRequest, output: DeleteDnsFirewallResponse, errors: [ DnsFirewallNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetAnalyticReportError = CloudflareOpError; /** 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. */ export const getAnalyticReport: API.OperationMethod< GetAnalyticReportRequest, GetAnalyticReportResponse, GetAnalyticReportError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetAnalyticReportRequest, output: GetAnalyticReportResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetAnalyticReportBytimeError = CloudflareOpError; /** 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. */ export const getAnalyticReportBytime: API.OperationMethod< GetAnalyticReportBytimeRequest, GetAnalyticReportBytimeResponse, GetAnalyticReportBytimeError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetAnalyticReportBytimeRequest, output: GetAnalyticReportBytimeResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetDnsFirewallError = | DnsFirewallNotFound | Forbidden | CloudflareOpError; /** Show a single DNS Firewall cluster for an account */ export const getDnsFirewall: API.OperationMethod< GetDnsFirewallRequest, GetDnsFirewallResponse, GetDnsFirewallError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetDnsFirewallRequest, output: GetDnsFirewallResponse, errors: [ DnsFirewallNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetReverseDnError = | DnsFirewallNotFound | Forbidden | CloudflareOpError; /** Show reverse DNS configuration (PTR records) for a DNS Firewall cluster */ export const getReverseDn: API.OperationMethod< GetReverseDnRequest, GetReverseDnResponse, GetReverseDnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetReverseDnRequest, output: GetReverseDnResponse, errors: [ DnsFirewallNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListDnsFirewallsError = Forbidden | CloudflareOpError; /** List DNS Firewall clusters for an account */ export const listDnsFirewalls: API.PaginatedOperationMethod< ListDnsFirewallsRequest, ListDnsFirewallsResponse, ListDnsFirewallsError, CloudflareOpContext, ListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListDnsFirewallsRequest, output: ListDnsFirewallsResponse, errors: [Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "page", inputToken: "page", outputToken: "resultInfo.page", items: "result", pageSize: "perPage", } as const, }), cloudflarePaginate, ) as any; export type PatchDnsFirewallError = | DnsFirewallNotFound | Forbidden | CloudflareOpError; /** Modify the configuration of a DNS Firewall cluster */ export const patchDnsFirewall: API.OperationMethod< PatchDnsFirewallRequest, PatchDnsFirewallResponse, PatchDnsFirewallError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PatchDnsFirewallRequest, output: PatchDnsFirewallResponse, errors: [ DnsFirewallNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type PatchReverseDnError = | DnsFirewallNotFound | Forbidden | CloudflareOpError; /** Update reverse DNS configuration (PTR records) for a DNS Firewall cluster */ export const patchReverseDn: API.OperationMethod< PatchReverseDnRequest, PatchReverseDnResponse, PatchReverseDnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PatchReverseDnRequest, output: PatchReverseDnResponse, errors: [ DnsFirewallNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, }));