// 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> = { allowInsecure: "allow_insecure", checkRegions: "check_regions", consecutiveFails: "consecutive_fails", consecutiveSuccesses: "consecutive_successes", createdOn: "created_on", expectedBody: "expected_body", expectedCodes: "expected_codes", failureReason: "failure_reason", followRedirects: "follow_redirects", httpConfig: "http_config", modifiedOn: "modified_on", perPage: "per_page", resultInfo: "result_info", tcpConfig: "tcp_config", totalCount: "total_count", }; export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export class HealthcheckAlreadyExists extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "HealthcheckAlreadyExists", { code: S.Number, message: S.String, }, ), [{ message: { includes: "already exists" } }], ) {} export class HealthcheckNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("HealthcheckNotFound", { code: S.Number, message: S.String, }), [{ status: 404 }], ) {} export type CreateRequestCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const CreateRequestCheckRegionsItem = /*@__PURE__*/ S.String; export type CreateRequestCheckRegionsList = Array< CreateRequestCheckRegionsItem | (string & {}) >; export const CreateRequestCheckRegionsList = /*@__PURE__*/ S.Array( CreateRequestCheckRegionsItem, ) as any as S.Schema; export type CreateRequestHttpConfigExpectedCodesList = Array; export const CreateRequestHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type CreateRequestHttpConfigHeaderValueList = Array; export const CreateRequestHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type CreateRequestHttpConfigHeaderMap = { [key: string]: CreateRequestHttpConfigHeaderValueList | undefined; }; export const CreateRequestHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, CreateRequestHttpConfigHeaderValueList, ) as any as S.Schema; export type CreateRequestHttpConfigMethod = "GET" | "HEAD"; export const CreateRequestHttpConfigMethod = /*@__PURE__*/ S.String; export interface CreateRequestHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: CreateRequestHttpConfigExpectedCodesList; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: CreateRequestHttpConfigHeaderMap; /** The HTTP method to use for the health check. */ method?: CreateRequestHttpConfigMethod | (string & {}); /** The endpoint path to health check against. */ path?: string; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number; } export const CreateRequestHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional(S.Boolean.pipe(T.Body("allow_insecure"))), expectedBody: S.optional(S.String.pipe(T.Body("expected_body"))), expectedCodes: S.optional( CreateRequestHttpConfigExpectedCodesList.pipe(T.Body("expected_codes")), ), followRedirects: S.optional(S.Boolean.pipe(T.Body("follow_redirects"))), header: S.optional(CreateRequestHttpConfigHeaderMap), method: S.optional(CreateRequestHttpConfigMethod), path: S.optional(S.String), port: S.optional(S.Number), }), ).annotate({ identifier: "CreateRequestHttpConfig", }) as any as S.Schema; export type CreateRequestTcpConfigMethod = "connection_established"; export const CreateRequestTcpConfigMethod = /*@__PURE__*/ S.String; export interface CreateRequestTcpConfig { /** The TCP connection method to use for the health check. */ method?: CreateRequestTcpConfigMethod | (string & {}); /** Port number to connect to for the health check. Defaults to 80. */ port?: number; } export const CreateRequestTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(CreateRequestTcpConfigMethod), port: S.optional(S.Number), }), ).annotate({ identifier: "CreateRequestTcpConfig", }) as any as S.Schema; export interface CreateHealthcheckRequest { /** Identifier */ zoneId: string; /** The hostname or IP address of the origin server to run health checks on. */ address: string; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name: string; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: CreateRequestCheckRegionsList; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number; /** A human-readable description of the health check. */ description?: string; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: CreateRequestHttpConfig; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean; /** Parameters specific to TCP health check. */ tcpConfig?: CreateRequestTcpConfig; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string; } export const CreateHealthcheckRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), address: S.String, name: S.String, checkRegions: S.optional( CreateRequestCheckRegionsList.pipe(T.Body("check_regions")), ), consecutiveFails: S.optional(S.Number.pipe(T.Body("consecutive_fails"))), consecutiveSuccesses: S.optional( S.Number.pipe(T.Body("consecutive_successes")), ), description: S.optional(S.String), httpConfig: S.optional(CreateRequestHttpConfig.pipe(T.Body("http_config"))), interval: S.optional(S.Number), retries: S.optional(S.Number), suspended: S.optional(S.Boolean), tcpConfig: S.optional(CreateRequestTcpConfig.pipe(T.Body("tcp_config"))), timeout: S.optional(S.Number), type: S.optional(S.String), }) .pipe( T.Http({ method: "POST", uri: "/zones/{zone_id}/healthchecks", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateHealthcheckRequest", }) as any as S.Schema; export type CreateResponseCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const CreateResponseCheckRegionsItem = /*@__PURE__*/ S.String; export type CreateResponseCheckRegionsList = Array; export const CreateResponseCheckRegionsList = /*@__PURE__*/ S.Array( CreateResponseCheckRegionsItem, ) as any as S.Schema; export type CreateResponseHttpConfigExpectedCodesList = Array; export const CreateResponseHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type CreateResponseHttpConfigHeaderValueList = Array; export const CreateResponseHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type CreateResponseHttpConfigHeaderMap = { [key: string]: CreateResponseHttpConfigHeaderValueList | undefined; }; export const CreateResponseHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, CreateResponseHttpConfigHeaderValueList, ) as any as S.Schema; export type CreateResponseHttpConfigMethod = "GET" | "HEAD"; export const CreateResponseHttpConfigMethod = /*@__PURE__*/ S.String; export interface CreateResponseHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean | null; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string | null; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: CreateResponseHttpConfigExpectedCodesList | null; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean | null; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: CreateResponseHttpConfigHeaderMap | null; /** The HTTP method to use for the health check. */ method?: CreateResponseHttpConfigMethod | null; /** The endpoint path to health check against. */ path?: string | null; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number | null; } export const CreateResponseHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional( S.NullOr(S.Boolean).pipe(T.Body("allow_insecure")), ), expectedBody: S.optional(S.NullOr(S.String).pipe(T.Body("expected_body"))), expectedCodes: S.optional( S.NullOr(CreateResponseHttpConfigExpectedCodesList).pipe( T.Body("expected_codes"), ), ), followRedirects: S.optional( S.NullOr(S.Boolean).pipe(T.Body("follow_redirects")), ), header: S.optional(S.NullOr(CreateResponseHttpConfigHeaderMap)), method: S.optional(S.NullOr(CreateResponseHttpConfigMethod)), path: S.optional(S.NullOr(S.String)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "CreateResponseHttpConfig", }) as any as S.Schema; export type CreateResponseStatus = | "unknown" | "healthy" | "unhealthy" | "suspended"; export const CreateResponseStatus = /*@__PURE__*/ S.String; export type CreateResponseTcpConfigMethod = "connection_established"; export const CreateResponseTcpConfigMethod = /*@__PURE__*/ S.String; export interface CreateResponseTcpConfig { /** The TCP connection method to use for the health check. */ method?: CreateResponseTcpConfigMethod | null; /** Port number to connect to for the health check. Defaults to 80. */ port?: number | null; } export const CreateResponseTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(S.NullOr(CreateResponseTcpConfigMethod)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "CreateResponseTcpConfig", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateHealthcheckResponse { /** Identifier */ id?: string | null; /** The hostname or IP address of the origin server to run health checks on. */ address?: string | null; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: CreateResponseCheckRegionsList | null; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number | null; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number | null; createdOn?: string | null; /** A human-readable description of the health check. */ description?: string | null; /** The current failure reason if status is unhealthy. */ failureReason?: string | null; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: CreateResponseHttpConfig | null; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number | null; modifiedOn?: string | null; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name?: string | null; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number | null; /** The current status of the origin server according to the health check. */ status?: CreateResponseStatus | null; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean | null; /** Parameters specific to TCP health check. */ tcpConfig?: CreateResponseTcpConfig | null; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number | null; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string | null; } export const CreateHealthcheckResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), address: S.optional(S.NullOr(S.String)), checkRegions: S.optional( S.NullOr(CreateResponseCheckRegionsList).pipe(T.Body("check_regions")), ), consecutiveFails: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_fails")), ), consecutiveSuccesses: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_successes")), ), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), description: S.optional(S.NullOr(S.String)), failureReason: S.optional( S.NullOr(S.String).pipe(T.Body("failure_reason")), ), httpConfig: S.optional( S.NullOr(CreateResponseHttpConfig).pipe(T.Body("http_config")), ), interval: S.optional(S.NullOr(S.Number)), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), name: S.optional(S.NullOr(S.String)), retries: S.optional(S.NullOr(S.Number)), status: S.optional(S.NullOr(CreateResponseStatus)), suspended: S.optional(S.NullOr(S.Boolean)), tcpConfig: S.optional( S.NullOr(CreateResponseTcpConfig).pipe(T.Body("tcp_config")), ), timeout: S.optional(S.NullOr(S.Number)), type: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateHealthcheckResponse", }) as any as S.Schema; export type PreviewsCreateRequestCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const PreviewsCreateRequestCheckRegionsItem = /*@__PURE__*/ S.String; export type PreviewsCreateRequestCheckRegionsList = Array< PreviewsCreateRequestCheckRegionsItem | (string & {}) >; export const PreviewsCreateRequestCheckRegionsList = /*@__PURE__*/ S.Array( PreviewsCreateRequestCheckRegionsItem, ) as any as S.Schema; export type PreviewsCreateRequestHttpConfigExpectedCodesList = Array; export const PreviewsCreateRequestHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type PreviewsCreateRequestHttpConfigHeaderValueList = Array; export const PreviewsCreateRequestHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type PreviewsCreateRequestHttpConfigHeaderMap = { [key: string]: PreviewsCreateRequestHttpConfigHeaderValueList | undefined; }; export const PreviewsCreateRequestHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, PreviewsCreateRequestHttpConfigHeaderValueList, ) as any as S.Schema; export type PreviewsCreateRequestHttpConfigMethod = "GET" | "HEAD"; export const PreviewsCreateRequestHttpConfigMethod = /*@__PURE__*/ S.String; export interface PreviewsCreateRequestHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: PreviewsCreateRequestHttpConfigExpectedCodesList; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: PreviewsCreateRequestHttpConfigHeaderMap; /** The HTTP method to use for the health check. */ method?: PreviewsCreateRequestHttpConfigMethod | (string & {}); /** The endpoint path to health check against. */ path?: string; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number; } export const PreviewsCreateRequestHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional(S.Boolean.pipe(T.Body("allow_insecure"))), expectedBody: S.optional(S.String.pipe(T.Body("expected_body"))), expectedCodes: S.optional( PreviewsCreateRequestHttpConfigExpectedCodesList.pipe( T.Body("expected_codes"), ), ), followRedirects: S.optional(S.Boolean.pipe(T.Body("follow_redirects"))), header: S.optional(PreviewsCreateRequestHttpConfigHeaderMap), method: S.optional(PreviewsCreateRequestHttpConfigMethod), path: S.optional(S.String), port: S.optional(S.Number), }), ).annotate({ identifier: "PreviewsCreateRequestHttpConfig", }) as any as S.Schema; export type PreviewsCreateRequestTcpConfigMethod = "connection_established"; export const PreviewsCreateRequestTcpConfigMethod = /*@__PURE__*/ S.String; export interface PreviewsCreateRequestTcpConfig { /** The TCP connection method to use for the health check. */ method?: PreviewsCreateRequestTcpConfigMethod | (string & {}); /** Port number to connect to for the health check. Defaults to 80. */ port?: number; } export const PreviewsCreateRequestTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(PreviewsCreateRequestTcpConfigMethod), port: S.optional(S.Number), }), ).annotate({ identifier: "PreviewsCreateRequestTcpConfig", }) as any as S.Schema; export interface CreatePreviewRequest { /** Identifier */ zoneId: string; /** The hostname or IP address of the origin server to run health checks on. */ address: string; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name: string; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: PreviewsCreateRequestCheckRegionsList; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number; /** A human-readable description of the health check. */ description?: string; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: PreviewsCreateRequestHttpConfig; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean; /** Parameters specific to TCP health check. */ tcpConfig?: PreviewsCreateRequestTcpConfig; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string; } export const CreatePreviewRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), address: S.String, name: S.String, checkRegions: S.optional( PreviewsCreateRequestCheckRegionsList.pipe(T.Body("check_regions")), ), consecutiveFails: S.optional(S.Number.pipe(T.Body("consecutive_fails"))), consecutiveSuccesses: S.optional( S.Number.pipe(T.Body("consecutive_successes")), ), description: S.optional(S.String), httpConfig: S.optional( PreviewsCreateRequestHttpConfig.pipe(T.Body("http_config")), ), interval: S.optional(S.Number), retries: S.optional(S.Number), suspended: S.optional(S.Boolean), tcpConfig: S.optional( PreviewsCreateRequestTcpConfig.pipe(T.Body("tcp_config")), ), timeout: S.optional(S.Number), type: S.optional(S.String), }) .pipe( T.Http({ method: "POST", uri: "/zones/{zone_id}/healthchecks/preview", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreatePreviewRequest", }) as any as S.Schema; export type PreviewsCreateResponseCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const PreviewsCreateResponseCheckRegionsItem = /*@__PURE__*/ S.String; export type PreviewsCreateResponseCheckRegionsList = Array; export const PreviewsCreateResponseCheckRegionsList = /*@__PURE__*/ S.Array( PreviewsCreateResponseCheckRegionsItem, ) as any as S.Schema; export type PreviewsCreateResponseHttpConfigExpectedCodesList = Array; export const PreviewsCreateResponseHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type PreviewsCreateResponseHttpConfigHeaderValueList = Array; export const PreviewsCreateResponseHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type PreviewsCreateResponseHttpConfigHeaderMap = { [key: string]: PreviewsCreateResponseHttpConfigHeaderValueList | undefined; }; export const PreviewsCreateResponseHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, PreviewsCreateResponseHttpConfigHeaderValueList, ) as any as S.Schema; export type PreviewsCreateResponseHttpConfigMethod = "GET" | "HEAD"; export const PreviewsCreateResponseHttpConfigMethod = /*@__PURE__*/ S.String; export interface PreviewsCreateResponseHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean | null; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string | null; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: PreviewsCreateResponseHttpConfigExpectedCodesList | null; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean | null; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: PreviewsCreateResponseHttpConfigHeaderMap | null; /** The HTTP method to use for the health check. */ method?: PreviewsCreateResponseHttpConfigMethod | null; /** The endpoint path to health check against. */ path?: string | null; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number | null; } export const PreviewsCreateResponseHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional( S.NullOr(S.Boolean).pipe(T.Body("allow_insecure")), ), expectedBody: S.optional(S.NullOr(S.String).pipe(T.Body("expected_body"))), expectedCodes: S.optional( S.NullOr(PreviewsCreateResponseHttpConfigExpectedCodesList).pipe( T.Body("expected_codes"), ), ), followRedirects: S.optional( S.NullOr(S.Boolean).pipe(T.Body("follow_redirects")), ), header: S.optional(S.NullOr(PreviewsCreateResponseHttpConfigHeaderMap)), method: S.optional(S.NullOr(PreviewsCreateResponseHttpConfigMethod)), path: S.optional(S.NullOr(S.String)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "PreviewsCreateResponseHttpConfig", }) as any as S.Schema; export type PreviewsCreateResponseStatus = | "unknown" | "healthy" | "unhealthy" | "suspended"; export const PreviewsCreateResponseStatus = /*@__PURE__*/ S.String; export type PreviewsCreateResponseTcpConfigMethod = "connection_established"; export const PreviewsCreateResponseTcpConfigMethod = /*@__PURE__*/ S.String; export interface PreviewsCreateResponseTcpConfig { /** The TCP connection method to use for the health check. */ method?: PreviewsCreateResponseTcpConfigMethod | null; /** Port number to connect to for the health check. Defaults to 80. */ port?: number | null; } export const PreviewsCreateResponseTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(S.NullOr(PreviewsCreateResponseTcpConfigMethod)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "PreviewsCreateResponseTcpConfig", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreatePreviewResponse { /** Identifier */ id?: string | null; /** The hostname or IP address of the origin server to run health checks on. */ address?: string | null; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: PreviewsCreateResponseCheckRegionsList | null; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number | null; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number | null; createdOn?: string | null; /** A human-readable description of the health check. */ description?: string | null; /** The current failure reason if status is unhealthy. */ failureReason?: string | null; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: PreviewsCreateResponseHttpConfig | null; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number | null; modifiedOn?: string | null; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name?: string | null; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number | null; /** The current status of the origin server according to the health check. */ status?: PreviewsCreateResponseStatus | null; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean | null; /** Parameters specific to TCP health check. */ tcpConfig?: PreviewsCreateResponseTcpConfig | null; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number | null; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string | null; } export const CreatePreviewResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), address: S.optional(S.NullOr(S.String)), checkRegions: S.optional( S.NullOr(PreviewsCreateResponseCheckRegionsList).pipe( T.Body("check_regions"), ), ), consecutiveFails: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_fails")), ), consecutiveSuccesses: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_successes")), ), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), description: S.optional(S.NullOr(S.String)), failureReason: S.optional( S.NullOr(S.String).pipe(T.Body("failure_reason")), ), httpConfig: S.optional( S.NullOr(PreviewsCreateResponseHttpConfig).pipe(T.Body("http_config")), ), interval: S.optional(S.NullOr(S.Number)), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), name: S.optional(S.NullOr(S.String)), retries: S.optional(S.NullOr(S.Number)), status: S.optional(S.NullOr(PreviewsCreateResponseStatus)), suspended: S.optional(S.NullOr(S.Boolean)), tcpConfig: S.optional( S.NullOr(PreviewsCreateResponseTcpConfig).pipe(T.Body("tcp_config")), ), timeout: S.optional(S.NullOr(S.Number)), type: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreatePreviewResponse", }) as any as S.Schema; export interface DeleteHealthcheckRequest { /** Identifier */ zoneId: string; /** Identifier */ healthcheckId: string; } export const DeleteHealthcheckRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), healthcheckId: S.String.pipe(T.Label("healthcheck_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/zones/{zone_id}/healthchecks/{healthcheck_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteHealthcheckRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeleteHealthcheckResponse { /** Identifier */ id?: string | null; } export const DeleteHealthcheckResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteHealthcheckResponse", }) as any as S.Schema; export interface DeletePreviewRequest { /** Identifier */ zoneId: string; /** Identifier */ healthcheckId: string; } export const DeletePreviewRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), healthcheckId: S.String.pipe(T.Label("healthcheck_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/zones/{zone_id}/healthchecks/preview/{healthcheck_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeletePreviewRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeletePreviewResponse { /** Identifier */ id?: string | null; } export const DeletePreviewResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeletePreviewResponse", }) as any as S.Schema; export interface GetHealthcheckRequest { /** Identifier */ zoneId: string; /** Identifier */ healthcheckId: string; } export const GetHealthcheckRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), healthcheckId: S.String.pipe(T.Label("healthcheck_id")), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/healthchecks/{healthcheck_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetHealthcheckRequest", }) as any as S.Schema; export type GetResponseCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const GetResponseCheckRegionsItem = /*@__PURE__*/ S.String; export type GetResponseCheckRegionsList = Array; export const GetResponseCheckRegionsList = /*@__PURE__*/ S.Array( GetResponseCheckRegionsItem, ) as any as S.Schema; export type GetResponseHttpConfigExpectedCodesList = Array; export const GetResponseHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type GetResponseHttpConfigHeaderValueList = Array; export const GetResponseHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type GetResponseHttpConfigHeaderMap = { [key: string]: GetResponseHttpConfigHeaderValueList | undefined; }; export const GetResponseHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, GetResponseHttpConfigHeaderValueList, ) as any as S.Schema; export type GetResponseHttpConfigMethod = "GET" | "HEAD"; export const GetResponseHttpConfigMethod = /*@__PURE__*/ S.String; export interface GetResponseHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean | null; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string | null; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: GetResponseHttpConfigExpectedCodesList | null; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean | null; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: GetResponseHttpConfigHeaderMap | null; /** The HTTP method to use for the health check. */ method?: GetResponseHttpConfigMethod | null; /** The endpoint path to health check against. */ path?: string | null; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number | null; } export const GetResponseHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional( S.NullOr(S.Boolean).pipe(T.Body("allow_insecure")), ), expectedBody: S.optional(S.NullOr(S.String).pipe(T.Body("expected_body"))), expectedCodes: S.optional( S.NullOr(GetResponseHttpConfigExpectedCodesList).pipe( T.Body("expected_codes"), ), ), followRedirects: S.optional( S.NullOr(S.Boolean).pipe(T.Body("follow_redirects")), ), header: S.optional(S.NullOr(GetResponseHttpConfigHeaderMap)), method: S.optional(S.NullOr(GetResponseHttpConfigMethod)), path: S.optional(S.NullOr(S.String)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "GetResponseHttpConfig", }) as any as S.Schema; export type GetResponseStatus = | "unknown" | "healthy" | "unhealthy" | "suspended"; export const GetResponseStatus = /*@__PURE__*/ S.String; export type GetResponseTcpConfigMethod = "connection_established"; export const GetResponseTcpConfigMethod = /*@__PURE__*/ S.String; export interface GetResponseTcpConfig { /** The TCP connection method to use for the health check. */ method?: GetResponseTcpConfigMethod | null; /** Port number to connect to for the health check. Defaults to 80. */ port?: number | null; } export const GetResponseTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(S.NullOr(GetResponseTcpConfigMethod)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "GetResponseTcpConfig", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetHealthcheckResponse { /** Identifier */ id?: string | null; /** The hostname or IP address of the origin server to run health checks on. */ address?: string | null; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: GetResponseCheckRegionsList | null; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number | null; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number | null; createdOn?: string | null; /** A human-readable description of the health check. */ description?: string | null; /** The current failure reason if status is unhealthy. */ failureReason?: string | null; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: GetResponseHttpConfig | null; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number | null; modifiedOn?: string | null; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name?: string | null; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number | null; /** The current status of the origin server according to the health check. */ status?: GetResponseStatus | null; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean | null; /** Parameters specific to TCP health check. */ tcpConfig?: GetResponseTcpConfig | null; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number | null; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string | null; } export const GetHealthcheckResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), address: S.optional(S.NullOr(S.String)), checkRegions: S.optional( S.NullOr(GetResponseCheckRegionsList).pipe(T.Body("check_regions")), ), consecutiveFails: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_fails")), ), consecutiveSuccesses: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_successes")), ), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), description: S.optional(S.NullOr(S.String)), failureReason: S.optional( S.NullOr(S.String).pipe(T.Body("failure_reason")), ), httpConfig: S.optional( S.NullOr(GetResponseHttpConfig).pipe(T.Body("http_config")), ), interval: S.optional(S.NullOr(S.Number)), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), name: S.optional(S.NullOr(S.String)), retries: S.optional(S.NullOr(S.Number)), status: S.optional(S.NullOr(GetResponseStatus)), suspended: S.optional(S.NullOr(S.Boolean)), tcpConfig: S.optional( S.NullOr(GetResponseTcpConfig).pipe(T.Body("tcp_config")), ), timeout: S.optional(S.NullOr(S.Number)), type: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetHealthcheckResponse", }) as any as S.Schema; export interface GetPreviewRequest { /** Identifier */ zoneId: string; /** Identifier */ healthcheckId: string; } export const GetPreviewRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), healthcheckId: S.String.pipe(T.Label("healthcheck_id")), }) .pipe( T.Http({ method: "GET", uri: "/zones/{zone_id}/healthchecks/preview/{healthcheck_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetPreviewRequest", }) as any as S.Schema; export type PreviewsGetResponseCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const PreviewsGetResponseCheckRegionsItem = /*@__PURE__*/ S.String; export type PreviewsGetResponseCheckRegionsList = Array; export const PreviewsGetResponseCheckRegionsList = /*@__PURE__*/ S.Array( PreviewsGetResponseCheckRegionsItem, ) as any as S.Schema; export type PreviewsGetResponseHttpConfigExpectedCodesList = Array; export const PreviewsGetResponseHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type PreviewsGetResponseHttpConfigHeaderValueList = Array; export const PreviewsGetResponseHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type PreviewsGetResponseHttpConfigHeaderMap = { [key: string]: PreviewsGetResponseHttpConfigHeaderValueList | undefined; }; export const PreviewsGetResponseHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, PreviewsGetResponseHttpConfigHeaderValueList, ) as any as S.Schema; export type PreviewsGetResponseHttpConfigMethod = "GET" | "HEAD"; export const PreviewsGetResponseHttpConfigMethod = /*@__PURE__*/ S.String; export interface PreviewsGetResponseHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean | null; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string | null; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: PreviewsGetResponseHttpConfigExpectedCodesList | null; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean | null; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: PreviewsGetResponseHttpConfigHeaderMap | null; /** The HTTP method to use for the health check. */ method?: PreviewsGetResponseHttpConfigMethod | null; /** The endpoint path to health check against. */ path?: string | null; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number | null; } export const PreviewsGetResponseHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional( S.NullOr(S.Boolean).pipe(T.Body("allow_insecure")), ), expectedBody: S.optional(S.NullOr(S.String).pipe(T.Body("expected_body"))), expectedCodes: S.optional( S.NullOr(PreviewsGetResponseHttpConfigExpectedCodesList).pipe( T.Body("expected_codes"), ), ), followRedirects: S.optional( S.NullOr(S.Boolean).pipe(T.Body("follow_redirects")), ), header: S.optional(S.NullOr(PreviewsGetResponseHttpConfigHeaderMap)), method: S.optional(S.NullOr(PreviewsGetResponseHttpConfigMethod)), path: S.optional(S.NullOr(S.String)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "PreviewsGetResponseHttpConfig", }) as any as S.Schema; export type PreviewsGetResponseStatus = | "unknown" | "healthy" | "unhealthy" | "suspended"; export const PreviewsGetResponseStatus = /*@__PURE__*/ S.String; export type PreviewsGetResponseTcpConfigMethod = "connection_established"; export const PreviewsGetResponseTcpConfigMethod = /*@__PURE__*/ S.String; export interface PreviewsGetResponseTcpConfig { /** The TCP connection method to use for the health check. */ method?: PreviewsGetResponseTcpConfigMethod | null; /** Port number to connect to for the health check. Defaults to 80. */ port?: number | null; } export const PreviewsGetResponseTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(S.NullOr(PreviewsGetResponseTcpConfigMethod)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "PreviewsGetResponseTcpConfig", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetPreviewResponse { /** Identifier */ id?: string | null; /** The hostname or IP address of the origin server to run health checks on. */ address?: string | null; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: PreviewsGetResponseCheckRegionsList | null; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number | null; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number | null; createdOn?: string | null; /** A human-readable description of the health check. */ description?: string | null; /** The current failure reason if status is unhealthy. */ failureReason?: string | null; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: PreviewsGetResponseHttpConfig | null; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number | null; modifiedOn?: string | null; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name?: string | null; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number | null; /** The current status of the origin server according to the health check. */ status?: PreviewsGetResponseStatus | null; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean | null; /** Parameters specific to TCP health check. */ tcpConfig?: PreviewsGetResponseTcpConfig | null; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number | null; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string | null; } export const GetPreviewResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), address: S.optional(S.NullOr(S.String)), checkRegions: S.optional( S.NullOr(PreviewsGetResponseCheckRegionsList).pipe( T.Body("check_regions"), ), ), consecutiveFails: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_fails")), ), consecutiveSuccesses: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_successes")), ), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), description: S.optional(S.NullOr(S.String)), failureReason: S.optional( S.NullOr(S.String).pipe(T.Body("failure_reason")), ), httpConfig: S.optional( S.NullOr(PreviewsGetResponseHttpConfig).pipe(T.Body("http_config")), ), interval: S.optional(S.NullOr(S.Number)), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), name: S.optional(S.NullOr(S.String)), retries: S.optional(S.NullOr(S.Number)), status: S.optional(S.NullOr(PreviewsGetResponseStatus)), suspended: S.optional(S.NullOr(S.Boolean)), tcpConfig: S.optional( S.NullOr(PreviewsGetResponseTcpConfig).pipe(T.Body("tcp_config")), ), timeout: S.optional(S.NullOr(S.Number)), type: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetPreviewResponse", }) as any as S.Schema; export interface ListHealthchecksRequest { /** Identifier */ zoneId: string; /** Page number of paginated results. */ page?: number; /** Maximum number of results per page. Must be a multiple of 5. */ perPage?: number; } export const ListHealthchecksRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_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: "/zones/{zone_id}/healthchecks", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListHealthchecksRequest", }) as any as S.Schema; export type ListResultItemCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const ListResultItemCheckRegionsItem = /*@__PURE__*/ S.String; export type ListResultItemCheckRegionsList = Array; export const ListResultItemCheckRegionsList = /*@__PURE__*/ S.Array( ListResultItemCheckRegionsItem, ) as any as S.Schema; export type ListResultItemHttpConfigExpectedCodesList = Array; export const ListResultItemHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type ListResultItemHttpConfigHeaderValueList = Array; export const ListResultItemHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type ListResultItemHttpConfigHeaderMap = { [key: string]: ListResultItemHttpConfigHeaderValueList | undefined; }; export const ListResultItemHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, ListResultItemHttpConfigHeaderValueList, ) as any as S.Schema; export type ListResultItemHttpConfigMethod = "GET" | "HEAD"; export const ListResultItemHttpConfigMethod = /*@__PURE__*/ S.String; export interface ListResultItemHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean | null; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string | null; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: ListResultItemHttpConfigExpectedCodesList | null; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean | null; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: ListResultItemHttpConfigHeaderMap | null; /** The HTTP method to use for the health check. */ method?: ListResultItemHttpConfigMethod | null; /** The endpoint path to health check against. */ path?: string | null; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number | null; } export const ListResultItemHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional( S.NullOr(S.Boolean).pipe(T.Body("allow_insecure")), ), expectedBody: S.optional(S.NullOr(S.String).pipe(T.Body("expected_body"))), expectedCodes: S.optional( S.NullOr(ListResultItemHttpConfigExpectedCodesList).pipe( T.Body("expected_codes"), ), ), followRedirects: S.optional( S.NullOr(S.Boolean).pipe(T.Body("follow_redirects")), ), header: S.optional(S.NullOr(ListResultItemHttpConfigHeaderMap)), method: S.optional(S.NullOr(ListResultItemHttpConfigMethod)), path: S.optional(S.NullOr(S.String)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "ListResultItemHttpConfig", }) as any as S.Schema; export type ListResultItemStatus = | "unknown" | "healthy" | "unhealthy" | "suspended"; export const ListResultItemStatus = /*@__PURE__*/ S.String; export type ListResultItemTcpConfigMethod = "connection_established"; export const ListResultItemTcpConfigMethod = /*@__PURE__*/ S.String; export interface ListResultItemTcpConfig { /** The TCP connection method to use for the health check. */ method?: ListResultItemTcpConfigMethod | null; /** Port number to connect to for the health check. Defaults to 80. */ port?: number | null; } export const ListResultItemTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(S.NullOr(ListResultItemTcpConfigMethod)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "ListResultItemTcpConfig", }) as any as S.Schema; export interface ListResultItem { /** Identifier */ id?: string | null; /** The hostname or IP address of the origin server to run health checks on. */ address?: string | null; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: ListResultItemCheckRegionsList | null; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number | null; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number | null; createdOn?: string | null; /** A human-readable description of the health check. */ description?: string | null; /** The current failure reason if status is unhealthy. */ failureReason?: string | null; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: ListResultItemHttpConfig | null; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number | null; modifiedOn?: string | null; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name?: string | null; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number | null; /** The current status of the origin server according to the health check. */ status?: ListResultItemStatus | null; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean | null; /** Parameters specific to TCP health check. */ tcpConfig?: ListResultItemTcpConfig | null; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number | null; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string | null; } export const ListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), address: S.optional(S.NullOr(S.String)), checkRegions: S.optional( S.NullOr(ListResultItemCheckRegionsList).pipe(T.Body("check_regions")), ), consecutiveFails: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_fails")), ), consecutiveSuccesses: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_successes")), ), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), description: S.optional(S.NullOr(S.String)), failureReason: S.optional( S.NullOr(S.String).pipe(T.Body("failure_reason")), ), httpConfig: S.optional( S.NullOr(ListResultItemHttpConfig).pipe(T.Body("http_config")), ), interval: S.optional(S.NullOr(S.Number)), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), name: S.optional(S.NullOr(S.String)), retries: S.optional(S.NullOr(S.Number)), status: S.optional(S.NullOr(ListResultItemStatus)), suspended: S.optional(S.NullOr(S.Boolean)), tcpConfig: S.optional( S.NullOr(ListResultItemTcpConfig).pipe(T.Body("tcp_config")), ), timeout: S.optional(S.NullOr(S.Number)), type: S.optional(S.NullOr(S.String)), }), ).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 ListHealthchecksResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: ListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListHealthchecksResponse = /*@__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: "ListHealthchecksResponse", }) as any as S.Schema; export type EditRequestCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const EditRequestCheckRegionsItem = /*@__PURE__*/ S.String; export type EditRequestCheckRegionsList = Array< EditRequestCheckRegionsItem | (string & {}) >; export const EditRequestCheckRegionsList = /*@__PURE__*/ S.Array( EditRequestCheckRegionsItem, ) as any as S.Schema; export type EditRequestHttpConfigExpectedCodesList = Array; export const EditRequestHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type EditRequestHttpConfigHeaderValueList = Array; export const EditRequestHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type EditRequestHttpConfigHeaderMap = { [key: string]: EditRequestHttpConfigHeaderValueList | undefined; }; export const EditRequestHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, EditRequestHttpConfigHeaderValueList, ) as any as S.Schema; export type EditRequestHttpConfigMethod = "GET" | "HEAD"; export const EditRequestHttpConfigMethod = /*@__PURE__*/ S.String; export interface EditRequestHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: EditRequestHttpConfigExpectedCodesList; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: EditRequestHttpConfigHeaderMap; /** The HTTP method to use for the health check. */ method?: EditRequestHttpConfigMethod | (string & {}); /** The endpoint path to health check against. */ path?: string; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number; } export const EditRequestHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional(S.Boolean.pipe(T.Body("allow_insecure"))), expectedBody: S.optional(S.String.pipe(T.Body("expected_body"))), expectedCodes: S.optional( EditRequestHttpConfigExpectedCodesList.pipe(T.Body("expected_codes")), ), followRedirects: S.optional(S.Boolean.pipe(T.Body("follow_redirects"))), header: S.optional(EditRequestHttpConfigHeaderMap), method: S.optional(EditRequestHttpConfigMethod), path: S.optional(S.String), port: S.optional(S.Number), }), ).annotate({ identifier: "EditRequestHttpConfig", }) as any as S.Schema; export type EditRequestTcpConfigMethod = "connection_established"; export const EditRequestTcpConfigMethod = /*@__PURE__*/ S.String; export interface EditRequestTcpConfig { /** The TCP connection method to use for the health check. */ method?: EditRequestTcpConfigMethod | (string & {}); /** Port number to connect to for the health check. Defaults to 80. */ port?: number; } export const EditRequestTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(EditRequestTcpConfigMethod), port: S.optional(S.Number), }), ).annotate({ identifier: "EditRequestTcpConfig", }) as any as S.Schema; export interface PatchHealthcheckRequest { /** Identifier */ zoneId: string; /** Identifier */ healthcheckId: string; /** The hostname or IP address of the origin server to run health checks on. */ address: string; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name: string; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: EditRequestCheckRegionsList; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number; /** A human-readable description of the health check. */ description?: string; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: EditRequestHttpConfig; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean; /** Parameters specific to TCP health check. */ tcpConfig?: EditRequestTcpConfig; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string; } export const PatchHealthcheckRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), healthcheckId: S.String.pipe(T.Label("healthcheck_id")), address: S.String, name: S.String, checkRegions: S.optional( EditRequestCheckRegionsList.pipe(T.Body("check_regions")), ), consecutiveFails: S.optional(S.Number.pipe(T.Body("consecutive_fails"))), consecutiveSuccesses: S.optional( S.Number.pipe(T.Body("consecutive_successes")), ), description: S.optional(S.String), httpConfig: S.optional(EditRequestHttpConfig.pipe(T.Body("http_config"))), interval: S.optional(S.Number), retries: S.optional(S.Number), suspended: S.optional(S.Boolean), tcpConfig: S.optional(EditRequestTcpConfig.pipe(T.Body("tcp_config"))), timeout: S.optional(S.Number), type: S.optional(S.String), }) .pipe( T.Http({ method: "PATCH", uri: "/zones/{zone_id}/healthchecks/{healthcheck_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchHealthcheckRequest", }) as any as S.Schema; export type EditResponseCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const EditResponseCheckRegionsItem = /*@__PURE__*/ S.String; export type EditResponseCheckRegionsList = Array; export const EditResponseCheckRegionsList = /*@__PURE__*/ S.Array( EditResponseCheckRegionsItem, ) as any as S.Schema; export type EditResponseHttpConfigExpectedCodesList = Array; export const EditResponseHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type EditResponseHttpConfigHeaderValueList = Array; export const EditResponseHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type EditResponseHttpConfigHeaderMap = { [key: string]: EditResponseHttpConfigHeaderValueList | undefined; }; export const EditResponseHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, EditResponseHttpConfigHeaderValueList, ) as any as S.Schema; export type EditResponseHttpConfigMethod = "GET" | "HEAD"; export const EditResponseHttpConfigMethod = /*@__PURE__*/ S.String; export interface EditResponseHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean | null; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string | null; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: EditResponseHttpConfigExpectedCodesList | null; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean | null; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: EditResponseHttpConfigHeaderMap | null; /** The HTTP method to use for the health check. */ method?: EditResponseHttpConfigMethod | null; /** The endpoint path to health check against. */ path?: string | null; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number | null; } export const EditResponseHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional( S.NullOr(S.Boolean).pipe(T.Body("allow_insecure")), ), expectedBody: S.optional(S.NullOr(S.String).pipe(T.Body("expected_body"))), expectedCodes: S.optional( S.NullOr(EditResponseHttpConfigExpectedCodesList).pipe( T.Body("expected_codes"), ), ), followRedirects: S.optional( S.NullOr(S.Boolean).pipe(T.Body("follow_redirects")), ), header: S.optional(S.NullOr(EditResponseHttpConfigHeaderMap)), method: S.optional(S.NullOr(EditResponseHttpConfigMethod)), path: S.optional(S.NullOr(S.String)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "EditResponseHttpConfig", }) as any as S.Schema; export type EditResponseStatus = | "unknown" | "healthy" | "unhealthy" | "suspended"; export const EditResponseStatus = /*@__PURE__*/ S.String; export type EditResponseTcpConfigMethod = "connection_established"; export const EditResponseTcpConfigMethod = /*@__PURE__*/ S.String; export interface EditResponseTcpConfig { /** The TCP connection method to use for the health check. */ method?: EditResponseTcpConfigMethod | null; /** Port number to connect to for the health check. Defaults to 80. */ port?: number | null; } export const EditResponseTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(S.NullOr(EditResponseTcpConfigMethod)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "EditResponseTcpConfig", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface PatchHealthcheckResponse { /** Identifier */ id?: string | null; /** The hostname or IP address of the origin server to run health checks on. */ address?: string | null; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: EditResponseCheckRegionsList | null; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number | null; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number | null; createdOn?: string | null; /** A human-readable description of the health check. */ description?: string | null; /** The current failure reason if status is unhealthy. */ failureReason?: string | null; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: EditResponseHttpConfig | null; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number | null; modifiedOn?: string | null; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name?: string | null; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number | null; /** The current status of the origin server according to the health check. */ status?: EditResponseStatus | null; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean | null; /** Parameters specific to TCP health check. */ tcpConfig?: EditResponseTcpConfig | null; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number | null; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string | null; } export const PatchHealthcheckResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), address: S.optional(S.NullOr(S.String)), checkRegions: S.optional( S.NullOr(EditResponseCheckRegionsList).pipe(T.Body("check_regions")), ), consecutiveFails: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_fails")), ), consecutiveSuccesses: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_successes")), ), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), description: S.optional(S.NullOr(S.String)), failureReason: S.optional( S.NullOr(S.String).pipe(T.Body("failure_reason")), ), httpConfig: S.optional( S.NullOr(EditResponseHttpConfig).pipe(T.Body("http_config")), ), interval: S.optional(S.NullOr(S.Number)), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), name: S.optional(S.NullOr(S.String)), retries: S.optional(S.NullOr(S.Number)), status: S.optional(S.NullOr(EditResponseStatus)), suspended: S.optional(S.NullOr(S.Boolean)), tcpConfig: S.optional( S.NullOr(EditResponseTcpConfig).pipe(T.Body("tcp_config")), ), timeout: S.optional(S.NullOr(S.Number)), type: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PatchHealthcheckResponse", }) as any as S.Schema; export type UpdateRequestCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const UpdateRequestCheckRegionsItem = /*@__PURE__*/ S.String; export type UpdateRequestCheckRegionsList = Array< UpdateRequestCheckRegionsItem | (string & {}) >; export const UpdateRequestCheckRegionsList = /*@__PURE__*/ S.Array( UpdateRequestCheckRegionsItem, ) as any as S.Schema; export type UpdateRequestHttpConfigExpectedCodesList = Array; export const UpdateRequestHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type UpdateRequestHttpConfigHeaderValueList = Array; export const UpdateRequestHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type UpdateRequestHttpConfigHeaderMap = { [key: string]: UpdateRequestHttpConfigHeaderValueList | undefined; }; export const UpdateRequestHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, UpdateRequestHttpConfigHeaderValueList, ) as any as S.Schema; export type UpdateRequestHttpConfigMethod = "GET" | "HEAD"; export const UpdateRequestHttpConfigMethod = /*@__PURE__*/ S.String; export interface UpdateRequestHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: UpdateRequestHttpConfigExpectedCodesList; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: UpdateRequestHttpConfigHeaderMap; /** The HTTP method to use for the health check. */ method?: UpdateRequestHttpConfigMethod | (string & {}); /** The endpoint path to health check against. */ path?: string; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number; } export const UpdateRequestHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional(S.Boolean.pipe(T.Body("allow_insecure"))), expectedBody: S.optional(S.String.pipe(T.Body("expected_body"))), expectedCodes: S.optional( UpdateRequestHttpConfigExpectedCodesList.pipe(T.Body("expected_codes")), ), followRedirects: S.optional(S.Boolean.pipe(T.Body("follow_redirects"))), header: S.optional(UpdateRequestHttpConfigHeaderMap), method: S.optional(UpdateRequestHttpConfigMethod), path: S.optional(S.String), port: S.optional(S.Number), }), ).annotate({ identifier: "UpdateRequestHttpConfig", }) as any as S.Schema; export type UpdateRequestTcpConfigMethod = "connection_established"; export const UpdateRequestTcpConfigMethod = /*@__PURE__*/ S.String; export interface UpdateRequestTcpConfig { /** The TCP connection method to use for the health check. */ method?: UpdateRequestTcpConfigMethod | (string & {}); /** Port number to connect to for the health check. Defaults to 80. */ port?: number; } export const UpdateRequestTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(UpdateRequestTcpConfigMethod), port: S.optional(S.Number), }), ).annotate({ identifier: "UpdateRequestTcpConfig", }) as any as S.Schema; export interface UpdateHealthcheckRequest { /** Identifier */ zoneId: string; /** Identifier */ healthcheckId: string; /** The hostname or IP address of the origin server to run health checks on. */ address: string; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name: string; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: UpdateRequestCheckRegionsList; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number; /** A human-readable description of the health check. */ description?: string; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: UpdateRequestHttpConfig; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean; /** Parameters specific to TCP health check. */ tcpConfig?: UpdateRequestTcpConfig; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string; } export const UpdateHealthcheckRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ zoneId: S.String.pipe(T.Label("zone_id")), healthcheckId: S.String.pipe(T.Label("healthcheck_id")), address: S.String, name: S.String, checkRegions: S.optional( UpdateRequestCheckRegionsList.pipe(T.Body("check_regions")), ), consecutiveFails: S.optional(S.Number.pipe(T.Body("consecutive_fails"))), consecutiveSuccesses: S.optional( S.Number.pipe(T.Body("consecutive_successes")), ), description: S.optional(S.String), httpConfig: S.optional(UpdateRequestHttpConfig.pipe(T.Body("http_config"))), interval: S.optional(S.Number), retries: S.optional(S.Number), suspended: S.optional(S.Boolean), tcpConfig: S.optional(UpdateRequestTcpConfig.pipe(T.Body("tcp_config"))), timeout: S.optional(S.Number), type: S.optional(S.String), }) .pipe( T.Http({ method: "PUT", uri: "/zones/{zone_id}/healthchecks/{healthcheck_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateHealthcheckRequest", }) as any as S.Schema; export type UpdateResponseCheckRegionsItem = | "WNAM" | "ENAM" | "WEU" | "EEU" | "NSAM" | "SSAM" | "OC" | "ME" | "NAF" | "SAF" | "IN" | "SEAS" | "NEAS" | "ALL_REGIONS"; export const UpdateResponseCheckRegionsItem = /*@__PURE__*/ S.String; export type UpdateResponseCheckRegionsList = Array; export const UpdateResponseCheckRegionsList = /*@__PURE__*/ S.Array( UpdateResponseCheckRegionsItem, ) as any as S.Schema; export type UpdateResponseHttpConfigExpectedCodesList = Array; export const UpdateResponseHttpConfigExpectedCodesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type UpdateResponseHttpConfigHeaderValueList = Array; export const UpdateResponseHttpConfigHeaderValueList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type UpdateResponseHttpConfigHeaderMap = { [key: string]: UpdateResponseHttpConfigHeaderValueList | undefined; }; export const UpdateResponseHttpConfigHeaderMap = /*@__PURE__*/ S.Record( S.String, UpdateResponseHttpConfigHeaderValueList, ) as any as S.Schema; export type UpdateResponseHttpConfigMethod = "GET" | "HEAD"; export const UpdateResponseHttpConfigMethod = /*@__PURE__*/ S.String; export interface UpdateResponseHttpConfig { /** Do not validate the certificate when the health check uses HTTPS. */ allowInsecure?: boolean | null; /** A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. */ expectedBody?: string | null; /** The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check. */ expectedCodes?: UpdateResponseHttpConfigExpectedCodesList | null; /** Follow redirects if the origin returns a 3xx status code. */ followRedirects?: boolean | null; /** The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. */ header?: UpdateResponseHttpConfigHeaderMap | null; /** The HTTP method to use for the health check. */ method?: UpdateResponseHttpConfigMethod | null; /** The endpoint path to health check against. */ path?: string | null; /** Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS. */ port?: number | null; } export const UpdateResponseHttpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ allowInsecure: S.optional( S.NullOr(S.Boolean).pipe(T.Body("allow_insecure")), ), expectedBody: S.optional(S.NullOr(S.String).pipe(T.Body("expected_body"))), expectedCodes: S.optional( S.NullOr(UpdateResponseHttpConfigExpectedCodesList).pipe( T.Body("expected_codes"), ), ), followRedirects: S.optional( S.NullOr(S.Boolean).pipe(T.Body("follow_redirects")), ), header: S.optional(S.NullOr(UpdateResponseHttpConfigHeaderMap)), method: S.optional(S.NullOr(UpdateResponseHttpConfigMethod)), path: S.optional(S.NullOr(S.String)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "UpdateResponseHttpConfig", }) as any as S.Schema; export type UpdateResponseStatus = | "unknown" | "healthy" | "unhealthy" | "suspended"; export const UpdateResponseStatus = /*@__PURE__*/ S.String; export type UpdateResponseTcpConfigMethod = "connection_established"; export const UpdateResponseTcpConfigMethod = /*@__PURE__*/ S.String; export interface UpdateResponseTcpConfig { /** The TCP connection method to use for the health check. */ method?: UpdateResponseTcpConfigMethod | null; /** Port number to connect to for the health check. Defaults to 80. */ port?: number | null; } export const UpdateResponseTcpConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ method: S.optional(S.NullOr(UpdateResponseTcpConfigMethod)), port: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "UpdateResponseTcpConfig", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateHealthcheckResponse { /** Identifier */ id?: string | null; /** The hostname or IP address of the origin server to run health checks on. */ address?: string | null; /** A list of regions from which to run health checks. Null means Cloudflare will pick a default region. */ checkRegions?: UpdateResponseCheckRegionsList | null; /** The number of consecutive fails required from a health check before changing the health to unhealthy. */ consecutiveFails?: number | null; /** The number of consecutive successes required from a health check before changing the health to healthy. */ consecutiveSuccesses?: number | null; createdOn?: string | null; /** A human-readable description of the health check. */ description?: string | null; /** The current failure reason if status is unhealthy. */ failureReason?: string | null; /** Parameters specific to an HTTP or HTTPS health check. */ httpConfig?: UpdateResponseHttpConfig | null; /** The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. */ interval?: number | null; modifiedOn?: string | null; /** A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. */ name?: string | null; /** The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. */ retries?: number | null; /** The current status of the origin server according to the health check. */ status?: UpdateResponseStatus | null; /** If suspended, no health checks are sent to the origin. */ suspended?: boolean | null; /** Parameters specific to TCP health check. */ tcpConfig?: UpdateResponseTcpConfig | null; /** The timeout (in seconds) before marking the health check as failed. */ timeout?: number | null; /** The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. */ type?: string | null; } export const UpdateHealthcheckResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), address: S.optional(S.NullOr(S.String)), checkRegions: S.optional( S.NullOr(UpdateResponseCheckRegionsList).pipe(T.Body("check_regions")), ), consecutiveFails: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_fails")), ), consecutiveSuccesses: S.optional( S.NullOr(S.Number).pipe(T.Body("consecutive_successes")), ), createdOn: S.optional(S.NullOr(S.String).pipe(T.Body("created_on"))), description: S.optional(S.NullOr(S.String)), failureReason: S.optional( S.NullOr(S.String).pipe(T.Body("failure_reason")), ), httpConfig: S.optional( S.NullOr(UpdateResponseHttpConfig).pipe(T.Body("http_config")), ), interval: S.optional(S.NullOr(S.Number)), modifiedOn: S.optional(S.NullOr(S.String).pipe(T.Body("modified_on"))), name: S.optional(S.NullOr(S.String)), retries: S.optional(S.NullOr(S.Number)), status: S.optional(S.NullOr(UpdateResponseStatus)), suspended: S.optional(S.NullOr(S.Boolean)), tcpConfig: S.optional( S.NullOr(UpdateResponseTcpConfig).pipe(T.Body("tcp_config")), ), timeout: S.optional(S.NullOr(S.Number)), type: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateHealthcheckResponse", }) as any as S.Schema; export type CreateHealthcheckError = | HealthcheckAlreadyExists | Forbidden | CloudflareOpError; /** Create a new health check. */ export const createHealthcheck: API.OperationMethod< CreateHealthcheckRequest, CreateHealthcheckResponse, CreateHealthcheckError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateHealthcheckRequest, output: CreateHealthcheckResponse, errors: [ HealthcheckAlreadyExists, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreatePreviewError = CloudflareOpError; /** Create a new preview health check. */ export const createPreview: API.OperationMethod< CreatePreviewRequest, CreatePreviewResponse, CreatePreviewError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreatePreviewRequest, output: CreatePreviewResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteHealthcheckError = | HealthcheckNotFound | Forbidden | CloudflareOpError; /** Delete a health check. */ export const deleteHealthcheck: API.OperationMethod< DeleteHealthcheckRequest, DeleteHealthcheckResponse, DeleteHealthcheckError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteHealthcheckRequest, output: DeleteHealthcheckResponse, errors: [ HealthcheckNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeletePreviewError = CloudflareOpError; /** Delete a health check. */ export const deletePreview: API.OperationMethod< DeletePreviewRequest, DeletePreviewResponse, DeletePreviewError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeletePreviewRequest, output: DeletePreviewResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetHealthcheckError = | HealthcheckNotFound | Forbidden | CloudflareOpError; /** Fetch a single configured health check. */ export const getHealthcheck: API.OperationMethod< GetHealthcheckRequest, GetHealthcheckResponse, GetHealthcheckError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetHealthcheckRequest, output: GetHealthcheckResponse, errors: [ HealthcheckNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetPreviewError = CloudflareOpError; /** Fetch a single configured health check preview. */ export const getPreview: API.OperationMethod< GetPreviewRequest, GetPreviewResponse, GetPreviewError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetPreviewRequest, output: GetPreviewResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListHealthchecksError = Forbidden | CloudflareOpError; /** List configured health checks. */ export const listHealthchecks: API.PaginatedOperationMethod< ListHealthchecksRequest, ListHealthchecksResponse, ListHealthchecksError, CloudflareOpContext, ListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListHealthchecksRequest, output: ListHealthchecksResponse, 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 PatchHealthcheckError = CloudflareOpError; /** Patch a configured health check. */ export const patchHealthcheck: API.OperationMethod< PatchHealthcheckRequest, PatchHealthcheckResponse, PatchHealthcheckError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PatchHealthcheckRequest, output: PatchHealthcheckResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type UpdateHealthcheckError = | HealthcheckNotFound | Forbidden | CloudflareOpError; /** Update a configured health check. */ export const updateHealthcheck: API.OperationMethod< UpdateHealthcheckRequest, UpdateHealthcheckResponse, UpdateHealthcheckError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateHealthcheckRequest, output: UpdateHealthcheckResponse, errors: [ HealthcheckNotFound, Forbidden, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, }));