From 3487c938cfcaecae5f877e5ea8c44d243045bc5d Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 19 Mar 2024 20:56:23 +0000
Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#174)
---
.stats.yml | 2 +-
api.md | 21 -
src/index.ts | 5 -
src/resources/healthchecks/healthchecks.ts | 578 ------------------
src/resources/healthchecks/index.ts | 12 +-
src/resources/healthchecks/previews.ts | 221 +------
src/resources/index.ts | 10 +-
.../healthchecks/healthchecks.test.ts | 211 -------
.../healthchecks/previews.test.ts | 97 ---
9 files changed, 5 insertions(+), 1152 deletions(-)
delete mode 100644 tests/api-resources/healthchecks/healthchecks.test.ts
delete mode 100644 tests/api-resources/healthchecks/previews.test.ts
diff --git a/.stats.yml b/.stats.yml
index cb53bc24e9..3336fc5549 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1 +1 @@
-configured_endpoints: 1244
+configured_endpoints: 1235
diff --git a/api.md b/api.md
index e588de99a2..344188dddb 100644
--- a/api.md
+++ b/api.md
@@ -1709,30 +1709,9 @@ Methods:
Types:
- HealthchecksHealthchecks
-- HealthcheckListResponse
-- HealthcheckDeleteResponse
-
-Methods:
-
-- client.healthchecks.create(zoneIdentifier, { ...params }) -> HealthchecksHealthchecks
-- client.healthchecks.update(zoneIdentifier, identifier, { ...params }) -> HealthchecksHealthchecks
-- client.healthchecks.list(zoneIdentifier) -> HealthcheckListResponse | null
-- client.healthchecks.delete(zoneIdentifier, identifier) -> HealthcheckDeleteResponse
-- client.healthchecks.edit(zoneIdentifier, identifier, { ...params }) -> HealthchecksHealthchecks
-- client.healthchecks.get(zoneIdentifier, identifier) -> HealthchecksHealthchecks
## Previews
-Types:
-
-- PreviewDeleteResponse
-
-Methods:
-
-- client.healthchecks.previews.create(zoneIdentifier, { ...params }) -> HealthchecksHealthchecks
-- client.healthchecks.previews.delete(zoneIdentifier, identifier) -> PreviewDeleteResponse
-- client.healthchecks.previews.get(zoneIdentifier, identifier) -> HealthchecksHealthchecks
-
# KeylessCertificates
Types:
diff --git a/src/index.ts b/src/index.ts
index 870488d50f..d0906dc7e2 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -552,11 +552,6 @@ export namespace Cloudflare {
export import Healthchecks = API.Healthchecks;
export import HealthchecksHealthchecks = API.HealthchecksHealthchecks;
- export import HealthcheckListResponse = API.HealthcheckListResponse;
- export import HealthcheckDeleteResponse = API.HealthcheckDeleteResponse;
- export import HealthcheckCreateParams = API.HealthcheckCreateParams;
- export import HealthcheckUpdateParams = API.HealthcheckUpdateParams;
- export import HealthcheckEditParams = API.HealthcheckEditParams;
export import KeylessCertificates = API.KeylessCertificates;
export import TLSCertificatesAndHostnamesBase = API.TLSCertificatesAndHostnamesBase;
diff --git a/src/resources/healthchecks/healthchecks.ts b/src/resources/healthchecks/healthchecks.ts
index 72b37d54e8..0b61db7184 100644
--- a/src/resources/healthchecks/healthchecks.ts
+++ b/src/resources/healthchecks/healthchecks.ts
@@ -1,105 +1,11 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as HealthchecksAPI from 'cloudflare/resources/healthchecks/healthchecks';
import * as PreviewsAPI from 'cloudflare/resources/healthchecks/previews';
export class Healthchecks extends APIResource {
previews: PreviewsAPI.Previews = new PreviewsAPI.Previews(this._client);
-
- /**
- * Create a new health check.
- */
- create(
- zoneIdentifier: string,
- body: HealthcheckCreateParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return (
- this._client.post(`/zones/${zoneIdentifier}/healthchecks`, { body, ...options }) as Core.APIPromise<{
- result: HealthchecksHealthchecks;
- }>
- )._thenUnwrap((obj) => obj.result);
- }
-
- /**
- * Update a configured health check.
- */
- update(
- zoneIdentifier: string,
- identifier: string,
- body: HealthcheckUpdateParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return (
- this._client.put(`/zones/${zoneIdentifier}/healthchecks/${identifier}`, {
- body,
- ...options,
- }) as Core.APIPromise<{ result: HealthchecksHealthchecks }>
- )._thenUnwrap((obj) => obj.result);
- }
-
- /**
- * List configured health checks.
- */
- list(
- zoneIdentifier: string,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return (
- this._client.get(`/zones/${zoneIdentifier}/healthchecks`, options) as Core.APIPromise<{
- result: HealthcheckListResponse | null;
- }>
- )._thenUnwrap((obj) => obj.result);
- }
-
- /**
- * Delete a health check.
- */
- delete(
- zoneIdentifier: string,
- identifier: string,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return (
- this._client.delete(`/zones/${zoneIdentifier}/healthchecks/${identifier}`, options) as Core.APIPromise<{
- result: HealthcheckDeleteResponse;
- }>
- )._thenUnwrap((obj) => obj.result);
- }
-
- /**
- * Patch a configured health check.
- */
- edit(
- zoneIdentifier: string,
- identifier: string,
- body: HealthcheckEditParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return (
- this._client.patch(`/zones/${zoneIdentifier}/healthchecks/${identifier}`, {
- body,
- ...options,
- }) as Core.APIPromise<{ result: HealthchecksHealthchecks }>
- )._thenUnwrap((obj) => obj.result);
- }
-
- /**
- * Fetch a single configured health check.
- */
- get(
- zoneIdentifier: string,
- identifier: string,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return (
- this._client.get(`/zones/${zoneIdentifier}/healthchecks/${identifier}`, options) as Core.APIPromise<{
- result: HealthchecksHealthchecks;
- }>
- )._thenUnwrap((obj) => obj.result);
- }
}
export interface HealthchecksHealthchecks {
@@ -277,491 +183,7 @@ export namespace HealthchecksHealthchecks {
}
}
-export type HealthcheckListResponse = Array;
-
-export interface HealthcheckDeleteResponse {
- /**
- * Identifier
- */
- id?: string;
-}
-
-export interface HealthcheckCreateParams {
- /**
- * 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.
- */
- check_regions?: Array<
- | 'WNAM'
- | 'ENAM'
- | 'WEU'
- | 'EEU'
- | 'NSAM'
- | 'SSAM'
- | 'OC'
- | 'ME'
- | 'NAF'
- | 'SAF'
- | 'IN'
- | 'SEAS'
- | 'NEAS'
- | 'ALL_REGIONS'
- > | null;
-
- /**
- * The number of consecutive fails required from a health check before changing the
- * health to unhealthy.
- */
- consecutive_fails?: number;
-
- /**
- * The number of consecutive successes required from a health check before changing
- * the health to healthy.
- */
- consecutive_successes?: number;
-
- /**
- * A human-readable description of the health check.
- */
- description?: string;
-
- /**
- * Parameters specific to an HTTP or HTTPS health check.
- */
- http_config?: HealthcheckCreateParams.HTTPConfig | 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;
-
- /**
- * 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.
- */
- tcp_config?: HealthcheckCreateParams.TcpConfig | null;
-
- /**
- * 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 namespace HealthcheckCreateParams {
- /**
- * Parameters specific to an HTTP or HTTPS health check.
- */
- export interface HTTPConfig {
- /**
- * Do not validate the certificate when the health check uses HTTPS.
- */
- allow_insecure?: 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.
- */
- expected_body?: 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.
- */
- expected_codes?: Array | null;
-
- /**
- * Follow redirects if the origin returns a 3xx status code.
- */
- follow_redirects?: 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?: unknown | null;
-
- /**
- * The HTTP method to use for the health check.
- */
- method?: 'GET' | 'HEAD';
-
- /**
- * 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;
- }
-
- /**
- * Parameters specific to TCP health check.
- */
- export interface TcpConfig {
- /**
- * The TCP connection method to use for the health check.
- */
- method?: 'connection_established';
-
- /**
- * Port number to connect to for the health check. Defaults to 80.
- */
- port?: number;
- }
-}
-
-export interface HealthcheckUpdateParams {
- /**
- * 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.
- */
- check_regions?: Array<
- | 'WNAM'
- | 'ENAM'
- | 'WEU'
- | 'EEU'
- | 'NSAM'
- | 'SSAM'
- | 'OC'
- | 'ME'
- | 'NAF'
- | 'SAF'
- | 'IN'
- | 'SEAS'
- | 'NEAS'
- | 'ALL_REGIONS'
- > | null;
-
- /**
- * The number of consecutive fails required from a health check before changing the
- * health to unhealthy.
- */
- consecutive_fails?: number;
-
- /**
- * The number of consecutive successes required from a health check before changing
- * the health to healthy.
- */
- consecutive_successes?: number;
-
- /**
- * A human-readable description of the health check.
- */
- description?: string;
-
- /**
- * Parameters specific to an HTTP or HTTPS health check.
- */
- http_config?: HealthcheckUpdateParams.HTTPConfig | 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;
-
- /**
- * 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.
- */
- tcp_config?: HealthcheckUpdateParams.TcpConfig | null;
-
- /**
- * 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 namespace HealthcheckUpdateParams {
- /**
- * Parameters specific to an HTTP or HTTPS health check.
- */
- export interface HTTPConfig {
- /**
- * Do not validate the certificate when the health check uses HTTPS.
- */
- allow_insecure?: 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.
- */
- expected_body?: 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.
- */
- expected_codes?: Array | null;
-
- /**
- * Follow redirects if the origin returns a 3xx status code.
- */
- follow_redirects?: 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?: unknown | null;
-
- /**
- * The HTTP method to use for the health check.
- */
- method?: 'GET' | 'HEAD';
-
- /**
- * 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;
- }
-
- /**
- * Parameters specific to TCP health check.
- */
- export interface TcpConfig {
- /**
- * The TCP connection method to use for the health check.
- */
- method?: 'connection_established';
-
- /**
- * Port number to connect to for the health check. Defaults to 80.
- */
- port?: number;
- }
-}
-
-export interface HealthcheckEditParams {
- /**
- * 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.
- */
- check_regions?: Array<
- | 'WNAM'
- | 'ENAM'
- | 'WEU'
- | 'EEU'
- | 'NSAM'
- | 'SSAM'
- | 'OC'
- | 'ME'
- | 'NAF'
- | 'SAF'
- | 'IN'
- | 'SEAS'
- | 'NEAS'
- | 'ALL_REGIONS'
- > | null;
-
- /**
- * The number of consecutive fails required from a health check before changing the
- * health to unhealthy.
- */
- consecutive_fails?: number;
-
- /**
- * The number of consecutive successes required from a health check before changing
- * the health to healthy.
- */
- consecutive_successes?: number;
-
- /**
- * A human-readable description of the health check.
- */
- description?: string;
-
- /**
- * Parameters specific to an HTTP or HTTPS health check.
- */
- http_config?: HealthcheckEditParams.HTTPConfig | 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;
-
- /**
- * 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.
- */
- tcp_config?: HealthcheckEditParams.TcpConfig | null;
-
- /**
- * 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 namespace HealthcheckEditParams {
- /**
- * Parameters specific to an HTTP or HTTPS health check.
- */
- export interface HTTPConfig {
- /**
- * Do not validate the certificate when the health check uses HTTPS.
- */
- allow_insecure?: 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.
- */
- expected_body?: 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.
- */
- expected_codes?: Array | null;
-
- /**
- * Follow redirects if the origin returns a 3xx status code.
- */
- follow_redirects?: 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?: unknown | null;
-
- /**
- * The HTTP method to use for the health check.
- */
- method?: 'GET' | 'HEAD';
-
- /**
- * 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;
- }
-
- /**
- * Parameters specific to TCP health check.
- */
- export interface TcpConfig {
- /**
- * The TCP connection method to use for the health check.
- */
- method?: 'connection_established';
-
- /**
- * Port number to connect to for the health check. Defaults to 80.
- */
- port?: number;
- }
-}
-
export namespace Healthchecks {
export import HealthchecksHealthchecks = HealthchecksAPI.HealthchecksHealthchecks;
- export import HealthcheckListResponse = HealthchecksAPI.HealthcheckListResponse;
- export import HealthcheckDeleteResponse = HealthchecksAPI.HealthcheckDeleteResponse;
- export import HealthcheckCreateParams = HealthchecksAPI.HealthcheckCreateParams;
- export import HealthcheckUpdateParams = HealthchecksAPI.HealthcheckUpdateParams;
- export import HealthcheckEditParams = HealthchecksAPI.HealthcheckEditParams;
export import Previews = PreviewsAPI.Previews;
- export import PreviewDeleteResponse = PreviewsAPI.PreviewDeleteResponse;
- export import PreviewCreateParams = PreviewsAPI.PreviewCreateParams;
}
diff --git a/src/resources/healthchecks/index.ts b/src/resources/healthchecks/index.ts
index 08ae5d7c90..3fdfa48007 100644
--- a/src/resources/healthchecks/index.ts
+++ b/src/resources/healthchecks/index.ts
@@ -1,12 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export {
- HealthchecksHealthchecks,
- HealthcheckListResponse,
- HealthcheckDeleteResponse,
- HealthcheckCreateParams,
- HealthcheckUpdateParams,
- HealthcheckEditParams,
- Healthchecks,
-} from './healthchecks';
-export { PreviewDeleteResponse, PreviewCreateParams, Previews } from './previews';
+export { HealthchecksHealthchecks, Healthchecks } from './healthchecks';
+export { Previews } from './previews';
diff --git a/src/resources/healthchecks/previews.ts b/src/resources/healthchecks/previews.ts
index 827b7cd111..96cffac022 100644
--- a/src/resources/healthchecks/previews.ts
+++ b/src/resources/healthchecks/previews.ts
@@ -1,224 +1,5 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
-import * as PreviewsAPI from 'cloudflare/resources/healthchecks/previews';
-import * as HealthchecksAPI from 'cloudflare/resources/healthchecks/healthchecks';
-export class Previews extends APIResource {
- /**
- * Create a new preview health check.
- */
- create(
- zoneIdentifier: string,
- body: PreviewCreateParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return (
- this._client.post(`/zones/${zoneIdentifier}/healthchecks/preview`, {
- body,
- ...options,
- }) as Core.APIPromise<{ result: HealthchecksAPI.HealthchecksHealthchecks }>
- )._thenUnwrap((obj) => obj.result);
- }
-
- /**
- * Delete a health check.
- */
- delete(
- zoneIdentifier: string,
- identifier: string,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return (
- this._client.delete(
- `/zones/${zoneIdentifier}/healthchecks/preview/${identifier}`,
- options,
- ) as Core.APIPromise<{ result: PreviewDeleteResponse }>
- )._thenUnwrap((obj) => obj.result);
- }
-
- /**
- * Fetch a single configured health check preview.
- */
- get(
- zoneIdentifier: string,
- identifier: string,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return (
- this._client.get(
- `/zones/${zoneIdentifier}/healthchecks/preview/${identifier}`,
- options,
- ) as Core.APIPromise<{ result: HealthchecksAPI.HealthchecksHealthchecks }>
- )._thenUnwrap((obj) => obj.result);
- }
-}
-
-export interface PreviewDeleteResponse {
- /**
- * Identifier
- */
- id?: string;
-}
-
-export interface PreviewCreateParams {
- /**
- * 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.
- */
- check_regions?: Array<
- | 'WNAM'
- | 'ENAM'
- | 'WEU'
- | 'EEU'
- | 'NSAM'
- | 'SSAM'
- | 'OC'
- | 'ME'
- | 'NAF'
- | 'SAF'
- | 'IN'
- | 'SEAS'
- | 'NEAS'
- | 'ALL_REGIONS'
- > | null;
-
- /**
- * The number of consecutive fails required from a health check before changing the
- * health to unhealthy.
- */
- consecutive_fails?: number;
-
- /**
- * The number of consecutive successes required from a health check before changing
- * the health to healthy.
- */
- consecutive_successes?: number;
-
- /**
- * A human-readable description of the health check.
- */
- description?: string;
-
- /**
- * Parameters specific to an HTTP or HTTPS health check.
- */
- http_config?: PreviewCreateParams.HTTPConfig | 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;
-
- /**
- * 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.
- */
- tcp_config?: PreviewCreateParams.TcpConfig | null;
-
- /**
- * 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 namespace PreviewCreateParams {
- /**
- * Parameters specific to an HTTP or HTTPS health check.
- */
- export interface HTTPConfig {
- /**
- * Do not validate the certificate when the health check uses HTTPS.
- */
- allow_insecure?: 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.
- */
- expected_body?: 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.
- */
- expected_codes?: Array | null;
-
- /**
- * Follow redirects if the origin returns a 3xx status code.
- */
- follow_redirects?: 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?: unknown | null;
-
- /**
- * The HTTP method to use for the health check.
- */
- method?: 'GET' | 'HEAD';
-
- /**
- * 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;
- }
-
- /**
- * Parameters specific to TCP health check.
- */
- export interface TcpConfig {
- /**
- * The TCP connection method to use for the health check.
- */
- method?: 'connection_established';
-
- /**
- * Port number to connect to for the health check. Defaults to 80.
- */
- port?: number;
- }
-}
-
-export namespace Previews {
- export import PreviewDeleteResponse = PreviewsAPI.PreviewDeleteResponse;
- export import PreviewCreateParams = PreviewsAPI.PreviewCreateParams;
-}
+export class Previews extends APIResource {}
diff --git a/src/resources/index.ts b/src/resources/index.ts
index 2a3a5c999b..1c129fcc73 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -74,15 +74,7 @@ export { Diagnostics } from './diagnostics/diagnostics';
export { DurableObjects } from './durable-objects/durable-objects';
export { EmailRouting } from './email-routing/email-routing';
export { Firewall } from './firewall/firewall';
-export {
- HealthchecksHealthchecks,
- HealthcheckListResponse,
- HealthcheckDeleteResponse,
- HealthcheckCreateParams,
- HealthcheckUpdateParams,
- HealthcheckEditParams,
- Healthchecks,
-} from './healthchecks/healthchecks';
+export { HealthchecksHealthchecks, Healthchecks } from './healthchecks/healthchecks';
export { Hostnames } from './hostnames/hostnames';
export { Hyperdrive } from './hyperdrive/hyperdrive';
export { IPs, JDCloudIPs, IPListResponse, IPListParams } from './ips';
diff --git a/tests/api-resources/healthchecks/healthchecks.test.ts b/tests/api-resources/healthchecks/healthchecks.test.ts
deleted file mode 100644
index 827c853112..0000000000
--- a/tests/api-resources/healthchecks/healthchecks.test.ts
+++ /dev/null
@@ -1,211 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-import Cloudflare from 'cloudflare';
-import { Response } from 'node-fetch';
-
-const cloudflare = new Cloudflare({
- apiKey: '144c9defac04969c7bfad8efaa8ea194',
- apiEmail: 'user@example.com',
- baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
-});
-
-describe('resource healthchecks', () => {
- // skipped: tests are disabled for the time being
- test.skip('create: only required params', async () => {
- const responsePromise = cloudflare.healthchecks.create('023e105f4ecef8ad9ca31a8372d0c353', {
- address: 'www.example.com',
- name: 'server-1',
- });
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('create: required and optional params', async () => {
- const response = await cloudflare.healthchecks.create('023e105f4ecef8ad9ca31a8372d0c353', {
- address: 'www.example.com',
- name: 'server-1',
- check_regions: ['WEU', 'ENAM'],
- consecutive_fails: 0,
- consecutive_successes: 0,
- description: 'Health check for www.example.com',
- http_config: {
- allow_insecure: true,
- expected_body: 'success',
- expected_codes: ['2xx', '302'],
- follow_redirects: true,
- header: { Host: ['example.com'], 'X-App-ID': ['abc123'] },
- method: 'GET',
- path: '/health',
- port: 0,
- },
- interval: 0,
- retries: 0,
- suspended: true,
- tcp_config: { method: 'connection_established', port: 0 },
- timeout: 0,
- type: 'HTTPS',
- });
- });
-
- // skipped: tests are disabled for the time being
- test.skip('update: only required params', async () => {
- const responsePromise = cloudflare.healthchecks.update(
- '023e105f4ecef8ad9ca31a8372d0c353',
- '023e105f4ecef8ad9ca31a8372d0c353',
- { address: 'www.example.com', name: 'server-1' },
- );
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('update: required and optional params', async () => {
- const response = await cloudflare.healthchecks.update(
- '023e105f4ecef8ad9ca31a8372d0c353',
- '023e105f4ecef8ad9ca31a8372d0c353',
- {
- address: 'www.example.com',
- name: 'server-1',
- check_regions: ['WEU', 'ENAM'],
- consecutive_fails: 0,
- consecutive_successes: 0,
- description: 'Health check for www.example.com',
- http_config: {
- allow_insecure: true,
- expected_body: 'success',
- expected_codes: ['2xx', '302'],
- follow_redirects: true,
- header: { Host: ['example.com'], 'X-App-ID': ['abc123'] },
- method: 'GET',
- path: '/health',
- port: 0,
- },
- interval: 0,
- retries: 0,
- suspended: true,
- tcp_config: { method: 'connection_established', port: 0 },
- timeout: 0,
- type: 'HTTPS',
- },
- );
- });
-
- // skipped: tests are disabled for the time being
- test.skip('list', async () => {
- const responsePromise = cloudflare.healthchecks.list('023e105f4ecef8ad9ca31a8372d0c353');
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('list: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- cloudflare.healthchecks.list('023e105f4ecef8ad9ca31a8372d0c353', { path: '/_stainless_unknown_path' }),
- ).rejects.toThrow(Cloudflare.NotFoundError);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('delete', async () => {
- const responsePromise = cloudflare.healthchecks.delete(
- '023e105f4ecef8ad9ca31a8372d0c353',
- '023e105f4ecef8ad9ca31a8372d0c353',
- );
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('edit: only required params', async () => {
- const responsePromise = cloudflare.healthchecks.edit(
- '023e105f4ecef8ad9ca31a8372d0c353',
- '023e105f4ecef8ad9ca31a8372d0c353',
- { address: 'www.example.com', name: 'server-1' },
- );
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('edit: required and optional params', async () => {
- const response = await cloudflare.healthchecks.edit(
- '023e105f4ecef8ad9ca31a8372d0c353',
- '023e105f4ecef8ad9ca31a8372d0c353',
- {
- address: 'www.example.com',
- name: 'server-1',
- check_regions: ['WEU', 'ENAM'],
- consecutive_fails: 0,
- consecutive_successes: 0,
- description: 'Health check for www.example.com',
- http_config: {
- allow_insecure: true,
- expected_body: 'success',
- expected_codes: ['2xx', '302'],
- follow_redirects: true,
- header: { Host: ['example.com'], 'X-App-ID': ['abc123'] },
- method: 'GET',
- path: '/health',
- port: 0,
- },
- interval: 0,
- retries: 0,
- suspended: true,
- tcp_config: { method: 'connection_established', port: 0 },
- timeout: 0,
- type: 'HTTPS',
- },
- );
- });
-
- // skipped: tests are disabled for the time being
- test.skip('get', async () => {
- const responsePromise = cloudflare.healthchecks.get(
- '023e105f4ecef8ad9ca31a8372d0c353',
- '023e105f4ecef8ad9ca31a8372d0c353',
- );
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('get: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- cloudflare.healthchecks.get('023e105f4ecef8ad9ca31a8372d0c353', '023e105f4ecef8ad9ca31a8372d0c353', {
- path: '/_stainless_unknown_path',
- }),
- ).rejects.toThrow(Cloudflare.NotFoundError);
- });
-});
diff --git a/tests/api-resources/healthchecks/previews.test.ts b/tests/api-resources/healthchecks/previews.test.ts
deleted file mode 100644
index 8065c6a3e8..0000000000
--- a/tests/api-resources/healthchecks/previews.test.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-import Cloudflare from 'cloudflare';
-import { Response } from 'node-fetch';
-
-const cloudflare = new Cloudflare({
- apiKey: '144c9defac04969c7bfad8efaa8ea194',
- apiEmail: 'user@example.com',
- baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
-});
-
-describe('resource previews', () => {
- // skipped: tests are disabled for the time being
- test.skip('create: only required params', async () => {
- const responsePromise = cloudflare.healthchecks.previews.create('023e105f4ecef8ad9ca31a8372d0c353', {
- address: 'www.example.com',
- name: 'server-1',
- });
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('create: required and optional params', async () => {
- const response = await cloudflare.healthchecks.previews.create('023e105f4ecef8ad9ca31a8372d0c353', {
- address: 'www.example.com',
- name: 'server-1',
- check_regions: ['WEU', 'ENAM'],
- consecutive_fails: 0,
- consecutive_successes: 0,
- description: 'Health check for www.example.com',
- http_config: {
- allow_insecure: true,
- expected_body: 'success',
- expected_codes: ['2xx', '302'],
- follow_redirects: true,
- header: { Host: ['example.com'], 'X-App-ID': ['abc123'] },
- method: 'GET',
- path: '/health',
- port: 0,
- },
- interval: 0,
- retries: 0,
- suspended: true,
- tcp_config: { method: 'connection_established', port: 0 },
- timeout: 0,
- type: 'HTTPS',
- });
- });
-
- // skipped: tests are disabled for the time being
- test.skip('delete', async () => {
- const responsePromise = cloudflare.healthchecks.previews.delete(
- '023e105f4ecef8ad9ca31a8372d0c353',
- '023e105f4ecef8ad9ca31a8372d0c353',
- );
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('get', async () => {
- const responsePromise = cloudflare.healthchecks.previews.get(
- '023e105f4ecef8ad9ca31a8372d0c353',
- '023e105f4ecef8ad9ca31a8372d0c353',
- );
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('get: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- cloudflare.healthchecks.previews.get(
- '023e105f4ecef8ad9ca31a8372d0c353',
- '023e105f4ecef8ad9ca31a8372d0c353',
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Cloudflare.NotFoundError);
- });
-});