From 2a69f2a84b9574b42c509d2717122c9b5d963329 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 19 Mar 2024 20:58:03 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API --- .stats.yml | 2 +- api.md | 29 +- src/cloudflare/_client.py | 8 - src/cloudflare/resources/__init__.py | 14 - .../resources/healthchecks/__init__.py | 33 - .../resources/healthchecks/healthchecks.py | 1202 ----------------- .../resources/healthchecks/previews.py | 534 -------- src/cloudflare/types/__init__.py | 6 - .../types/healthcheck_create_params.py | 140 -- .../types/healthcheck_delete_response.py | 12 - .../types/healthcheck_edit_params.py | 143 -- .../types/healthcheck_list_response.py | 9 - .../types/healthcheck_update_params.py | 143 -- src/cloudflare/types/healthchecks/__init__.py | 3 - .../healthchecks/preview_create_params.py | 140 -- .../healthchecks/preview_delete_response.py | 12 - .../types/healthchecks_healthchecks.py | 152 --- .../healthchecks/test_previews.py | 403 ------ tests/api_resources/test_healthchecks.py | 886 ------------ 19 files changed, 2 insertions(+), 3869 deletions(-) delete mode 100644 src/cloudflare/resources/healthchecks/__init__.py delete mode 100644 src/cloudflare/resources/healthchecks/healthchecks.py delete mode 100644 src/cloudflare/resources/healthchecks/previews.py delete mode 100644 src/cloudflare/types/healthcheck_create_params.py delete mode 100644 src/cloudflare/types/healthcheck_delete_response.py delete mode 100644 src/cloudflare/types/healthcheck_edit_params.py delete mode 100644 src/cloudflare/types/healthcheck_list_response.py delete mode 100644 src/cloudflare/types/healthcheck_update_params.py delete mode 100644 src/cloudflare/types/healthchecks/preview_create_params.py delete mode 100644 src/cloudflare/types/healthchecks/preview_delete_response.py delete mode 100644 src/cloudflare/types/healthchecks_healthchecks.py delete mode 100644 tests/api_resources/healthchecks/test_previews.py delete mode 100644 tests/api_resources/test_healthchecks.py diff --git a/.stats.yml b/.stats.yml index cb53bc24e9b..3336fc55499 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1244 +configured_endpoints: 1235 diff --git a/api.md b/api.md index 7f5e80d64d0..0ec24a20e31 100644 --- a/api.md +++ b/api.md @@ -1976,36 +1976,9 @@ Methods: Types: ```python -from cloudflare.types import ( - HealthchecksHealthchecks, - HealthcheckListResponse, - HealthcheckDeleteResponse, -) +from cloudflare.types import HealthchecksHealthchecks ``` -Methods: - -- client.healthchecks.create(zone_identifier, \*\*params) -> HealthchecksHealthchecks -- client.healthchecks.update(identifier, \*, zone_identifier, \*\*params) -> HealthchecksHealthchecks -- client.healthchecks.list(zone_identifier) -> Optional -- client.healthchecks.delete(identifier, \*, zone_identifier) -> HealthcheckDeleteResponse -- client.healthchecks.edit(identifier, \*, zone_identifier, \*\*params) -> HealthchecksHealthchecks -- client.healthchecks.get(identifier, \*, zone_identifier) -> HealthchecksHealthchecks - -## Previews - -Types: - -```python -from cloudflare.types.healthchecks import PreviewDeleteResponse -``` - -Methods: - -- client.healthchecks.previews.create(zone_identifier, \*\*params) -> HealthchecksHealthchecks -- client.healthchecks.previews.delete(identifier, \*, zone_identifier) -> PreviewDeleteResponse -- client.healthchecks.previews.get(identifier, \*, zone_identifier) -> HealthchecksHealthchecks - # KeylessCertificates Types: diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index 147853998b1..a6e8a11427a 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -71,7 +71,6 @@ class Cloudflare(SyncAPIClient): email_routing: resources.EmailRouting filters: resources.Filters firewall: resources.Firewall - healthchecks: resources.Healthchecks keyless_certificates: resources.KeylessCertificates logpush: resources.Logpush logs: resources.Logs @@ -223,7 +222,6 @@ def __init__( self.email_routing = resources.EmailRouting(self) self.filters = resources.Filters(self) self.firewall = resources.Firewall(self) - self.healthchecks = resources.Healthchecks(self) self.keyless_certificates = resources.KeylessCertificates(self) self.logpush = resources.Logpush(self) self.logs = resources.Logs(self) @@ -480,7 +478,6 @@ class AsyncCloudflare(AsyncAPIClient): email_routing: resources.AsyncEmailRouting filters: resources.AsyncFilters firewall: resources.AsyncFirewall - healthchecks: resources.AsyncHealthchecks keyless_certificates: resources.AsyncKeylessCertificates logpush: resources.AsyncLogpush logs: resources.AsyncLogs @@ -632,7 +629,6 @@ def __init__( self.email_routing = resources.AsyncEmailRouting(self) self.filters = resources.AsyncFilters(self) self.firewall = resources.AsyncFirewall(self) - self.healthchecks = resources.AsyncHealthchecks(self) self.keyless_certificates = resources.AsyncKeylessCertificates(self) self.logpush = resources.AsyncLogpush(self) self.logs = resources.AsyncLogs(self) @@ -890,7 +886,6 @@ def __init__(self, client: Cloudflare) -> None: self.email_routing = resources.EmailRoutingWithRawResponse(client.email_routing) self.filters = resources.FiltersWithRawResponse(client.filters) self.firewall = resources.FirewallWithRawResponse(client.firewall) - self.healthchecks = resources.HealthchecksWithRawResponse(client.healthchecks) self.keyless_certificates = resources.KeylessCertificatesWithRawResponse(client.keyless_certificates) self.logpush = resources.LogpushWithRawResponse(client.logpush) self.logs = resources.LogsWithRawResponse(client.logs) @@ -977,7 +972,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.email_routing = resources.AsyncEmailRoutingWithRawResponse(client.email_routing) self.filters = resources.AsyncFiltersWithRawResponse(client.filters) self.firewall = resources.AsyncFirewallWithRawResponse(client.firewall) - self.healthchecks = resources.AsyncHealthchecksWithRawResponse(client.healthchecks) self.keyless_certificates = resources.AsyncKeylessCertificatesWithRawResponse(client.keyless_certificates) self.logpush = resources.AsyncLogpushWithRawResponse(client.logpush) self.logs = resources.AsyncLogsWithRawResponse(client.logs) @@ -1066,7 +1060,6 @@ def __init__(self, client: Cloudflare) -> None: self.email_routing = resources.EmailRoutingWithStreamingResponse(client.email_routing) self.filters = resources.FiltersWithStreamingResponse(client.filters) self.firewall = resources.FirewallWithStreamingResponse(client.firewall) - self.healthchecks = resources.HealthchecksWithStreamingResponse(client.healthchecks) self.keyless_certificates = resources.KeylessCertificatesWithStreamingResponse(client.keyless_certificates) self.logpush = resources.LogpushWithStreamingResponse(client.logpush) self.logs = resources.LogsWithStreamingResponse(client.logs) @@ -1157,7 +1150,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.email_routing = resources.AsyncEmailRoutingWithStreamingResponse(client.email_routing) self.filters = resources.AsyncFiltersWithStreamingResponse(client.filters) self.firewall = resources.AsyncFirewallWithStreamingResponse(client.firewall) - self.healthchecks = resources.AsyncHealthchecksWithStreamingResponse(client.healthchecks) self.keyless_certificates = resources.AsyncKeylessCertificatesWithStreamingResponse(client.keyless_certificates) self.logpush = resources.AsyncLogpushWithStreamingResponse(client.logpush) self.logs = resources.AsyncLogsWithStreamingResponse(client.logs) diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index 37a8b91ff8e..f6f88f731bf 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -400,14 +400,6 @@ URLScannerWithStreamingResponse, AsyncURLScannerWithStreamingResponse, ) -from .healthchecks import ( - Healthchecks, - AsyncHealthchecks, - HealthchecksWithRawResponse, - AsyncHealthchecksWithRawResponse, - HealthchecksWithStreamingResponse, - AsyncHealthchecksWithStreamingResponse, -) from .email_routing import ( EmailRouting, AsyncEmailRouting, @@ -778,12 +770,6 @@ "AsyncFirewallWithRawResponse", "FirewallWithStreamingResponse", "AsyncFirewallWithStreamingResponse", - "Healthchecks", - "AsyncHealthchecks", - "HealthchecksWithRawResponse", - "AsyncHealthchecksWithRawResponse", - "HealthchecksWithStreamingResponse", - "AsyncHealthchecksWithStreamingResponse", "KeylessCertificates", "AsyncKeylessCertificates", "KeylessCertificatesWithRawResponse", diff --git a/src/cloudflare/resources/healthchecks/__init__.py b/src/cloudflare/resources/healthchecks/__init__.py deleted file mode 100644 index 3587bef8b68..00000000000 --- a/src/cloudflare/resources/healthchecks/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .previews import ( - Previews, - AsyncPreviews, - PreviewsWithRawResponse, - AsyncPreviewsWithRawResponse, - PreviewsWithStreamingResponse, - AsyncPreviewsWithStreamingResponse, -) -from .healthchecks import ( - Healthchecks, - AsyncHealthchecks, - HealthchecksWithRawResponse, - AsyncHealthchecksWithRawResponse, - HealthchecksWithStreamingResponse, - AsyncHealthchecksWithStreamingResponse, -) - -__all__ = [ - "Previews", - "AsyncPreviews", - "PreviewsWithRawResponse", - "AsyncPreviewsWithRawResponse", - "PreviewsWithStreamingResponse", - "AsyncPreviewsWithStreamingResponse", - "Healthchecks", - "AsyncHealthchecks", - "HealthchecksWithRawResponse", - "AsyncHealthchecksWithRawResponse", - "HealthchecksWithStreamingResponse", - "AsyncHealthchecksWithStreamingResponse", -] diff --git a/src/cloudflare/resources/healthchecks/healthchecks.py b/src/cloudflare/resources/healthchecks/healthchecks.py deleted file mode 100644 index 73f68280f72..00000000000 --- a/src/cloudflare/resources/healthchecks/healthchecks.py +++ /dev/null @@ -1,1202 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Type, Optional, cast -from typing_extensions import Literal - -import httpx - -from ...types import ( - HealthcheckListResponse, - HealthchecksHealthchecks, - HealthcheckDeleteResponse, - healthcheck_edit_params, - healthcheck_create_params, - healthcheck_update_params, -) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from .previews import ( - Previews, - AsyncPreviews, - PreviewsWithRawResponse, - AsyncPreviewsWithRawResponse, - PreviewsWithStreamingResponse, - AsyncPreviewsWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ..._base_client import ( - make_request_options, -) - -__all__ = ["Healthchecks", "AsyncHealthchecks"] - - -class Healthchecks(SyncAPIResource): - @cached_property - def previews(self) -> Previews: - return Previews(self._client) - - @cached_property - def with_raw_response(self) -> HealthchecksWithRawResponse: - return HealthchecksWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> HealthchecksWithStreamingResponse: - return HealthchecksWithStreamingResponse(self) - - def create( - self, - zone_identifier: str, - *, - address: str, - name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - consecutive_fails: int | NotGiven = NOT_GIVEN, - consecutive_successes: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_create_params.HTTPConfig] | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_create_params.TcpConfig] | NotGiven = NOT_GIVEN, - healthcheck_timeout: int | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Create a new health check. - - Args: - zone_identifier: Identifier - - address: The hostname or IP address of the origin server to run health checks on. - - name: A short name to identify the health check. Only alphanumeric characters, hyphens - and underscores are allowed. - - check_regions: A list of regions from which to run health checks. Null means Cloudflare will - pick a default region. - - consecutive_fails: The number of consecutive fails required from a health check before changing the - health to unhealthy. - - consecutive_successes: The number of consecutive successes required from a health check before changing - the health to healthy. - - description: A human-readable description of the health check. - - http_config: Parameters specific to an HTTP or HTTPS health check. - - interval: 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. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - suspended: If suspended, no health checks are sent to the origin. - - tcp_config: Parameters specific to TCP health check. - - healthcheck_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP', 'HTTPS' and 'TCP'. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._post( - f"/zones/{zone_identifier}/healthchecks", - body=maybe_transform( - { - "address": address, - "name": name, - "check_regions": check_regions, - "consecutive_fails": consecutive_fails, - "consecutive_successes": consecutive_successes, - "description": description, - "http_config": http_config, - "interval": interval, - "retries": retries, - "suspended": suspended, - "tcp_config": tcp_config, - "timeout": healthcheck_timeout, - "type": type, - }, - healthcheck_create_params.HealthcheckCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - def update( - self, - identifier: str, - *, - zone_identifier: str, - address: str, - name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - consecutive_fails: int | NotGiven = NOT_GIVEN, - consecutive_successes: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_update_params.HTTPConfig] | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_update_params.TcpConfig] | NotGiven = NOT_GIVEN, - healthcheck_timeout: int | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Update a configured health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - address: The hostname or IP address of the origin server to run health checks on. - - name: A short name to identify the health check. Only alphanumeric characters, hyphens - and underscores are allowed. - - check_regions: A list of regions from which to run health checks. Null means Cloudflare will - pick a default region. - - consecutive_fails: The number of consecutive fails required from a health check before changing the - health to unhealthy. - - consecutive_successes: The number of consecutive successes required from a health check before changing - the health to healthy. - - description: A human-readable description of the health check. - - http_config: Parameters specific to an HTTP or HTTPS health check. - - interval: 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. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - suspended: If suspended, no health checks are sent to the origin. - - tcp_config: Parameters specific to TCP health check. - - healthcheck_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP', 'HTTPS' and 'TCP'. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._put( - f"/zones/{zone_identifier}/healthchecks/{identifier}", - body=maybe_transform( - { - "address": address, - "name": name, - "check_regions": check_regions, - "consecutive_fails": consecutive_fails, - "consecutive_successes": consecutive_successes, - "description": description, - "http_config": http_config, - "interval": interval, - "retries": retries, - "suspended": suspended, - "tcp_config": tcp_config, - "timeout": healthcheck_timeout, - "type": type, - }, - healthcheck_update_params.HealthcheckUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - def list( - self, - zone_identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HealthcheckListResponse]: - """ - List configured health checks. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._get( - f"/zones/{zone_identifier}/healthchecks", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[HealthcheckListResponse]], ResultWrapper[HealthcheckListResponse]), - ) - - def delete( - self, - identifier: str, - *, - zone_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthcheckDeleteResponse: - """ - Delete a health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._delete( - f"/zones/{zone_identifier}/healthchecks/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthcheckDeleteResponse], ResultWrapper[HealthcheckDeleteResponse]), - ) - - def edit( - self, - identifier: str, - *, - zone_identifier: str, - address: str, - name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - consecutive_fails: int | NotGiven = NOT_GIVEN, - consecutive_successes: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_edit_params.HTTPConfig] | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_edit_params.TcpConfig] | NotGiven = NOT_GIVEN, - healthcheck_timeout: int | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Patch a configured health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - address: The hostname or IP address of the origin server to run health checks on. - - name: A short name to identify the health check. Only alphanumeric characters, hyphens - and underscores are allowed. - - check_regions: A list of regions from which to run health checks. Null means Cloudflare will - pick a default region. - - consecutive_fails: The number of consecutive fails required from a health check before changing the - health to unhealthy. - - consecutive_successes: The number of consecutive successes required from a health check before changing - the health to healthy. - - description: A human-readable description of the health check. - - http_config: Parameters specific to an HTTP or HTTPS health check. - - interval: 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. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - suspended: If suspended, no health checks are sent to the origin. - - tcp_config: Parameters specific to TCP health check. - - healthcheck_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP', 'HTTPS' and 'TCP'. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._patch( - f"/zones/{zone_identifier}/healthchecks/{identifier}", - body=maybe_transform( - { - "address": address, - "name": name, - "check_regions": check_regions, - "consecutive_fails": consecutive_fails, - "consecutive_successes": consecutive_successes, - "description": description, - "http_config": http_config, - "interval": interval, - "retries": retries, - "suspended": suspended, - "tcp_config": tcp_config, - "timeout": healthcheck_timeout, - "type": type, - }, - healthcheck_edit_params.HealthcheckEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - def get( - self, - identifier: str, - *, - zone_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Fetch a single configured health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( - f"/zones/{zone_identifier}/healthchecks/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - -class AsyncHealthchecks(AsyncAPIResource): - @cached_property - def previews(self) -> AsyncPreviews: - return AsyncPreviews(self._client) - - @cached_property - def with_raw_response(self) -> AsyncHealthchecksWithRawResponse: - return AsyncHealthchecksWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncHealthchecksWithStreamingResponse: - return AsyncHealthchecksWithStreamingResponse(self) - - async def create( - self, - zone_identifier: str, - *, - address: str, - name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - consecutive_fails: int | NotGiven = NOT_GIVEN, - consecutive_successes: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_create_params.HTTPConfig] | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_create_params.TcpConfig] | NotGiven = NOT_GIVEN, - healthcheck_timeout: int | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Create a new health check. - - Args: - zone_identifier: Identifier - - address: The hostname or IP address of the origin server to run health checks on. - - name: A short name to identify the health check. Only alphanumeric characters, hyphens - and underscores are allowed. - - check_regions: A list of regions from which to run health checks. Null means Cloudflare will - pick a default region. - - consecutive_fails: The number of consecutive fails required from a health check before changing the - health to unhealthy. - - consecutive_successes: The number of consecutive successes required from a health check before changing - the health to healthy. - - description: A human-readable description of the health check. - - http_config: Parameters specific to an HTTP or HTTPS health check. - - interval: 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. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - suspended: If suspended, no health checks are sent to the origin. - - tcp_config: Parameters specific to TCP health check. - - healthcheck_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP', 'HTTPS' and 'TCP'. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._post( - f"/zones/{zone_identifier}/healthchecks", - body=await async_maybe_transform( - { - "address": address, - "name": name, - "check_regions": check_regions, - "consecutive_fails": consecutive_fails, - "consecutive_successes": consecutive_successes, - "description": description, - "http_config": http_config, - "interval": interval, - "retries": retries, - "suspended": suspended, - "tcp_config": tcp_config, - "timeout": healthcheck_timeout, - "type": type, - }, - healthcheck_create_params.HealthcheckCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - async def update( - self, - identifier: str, - *, - zone_identifier: str, - address: str, - name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - consecutive_fails: int | NotGiven = NOT_GIVEN, - consecutive_successes: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_update_params.HTTPConfig] | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_update_params.TcpConfig] | NotGiven = NOT_GIVEN, - healthcheck_timeout: int | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Update a configured health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - address: The hostname or IP address of the origin server to run health checks on. - - name: A short name to identify the health check. Only alphanumeric characters, hyphens - and underscores are allowed. - - check_regions: A list of regions from which to run health checks. Null means Cloudflare will - pick a default region. - - consecutive_fails: The number of consecutive fails required from a health check before changing the - health to unhealthy. - - consecutive_successes: The number of consecutive successes required from a health check before changing - the health to healthy. - - description: A human-readable description of the health check. - - http_config: Parameters specific to an HTTP or HTTPS health check. - - interval: 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. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - suspended: If suspended, no health checks are sent to the origin. - - tcp_config: Parameters specific to TCP health check. - - healthcheck_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP', 'HTTPS' and 'TCP'. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._put( - f"/zones/{zone_identifier}/healthchecks/{identifier}", - body=await async_maybe_transform( - { - "address": address, - "name": name, - "check_regions": check_regions, - "consecutive_fails": consecutive_fails, - "consecutive_successes": consecutive_successes, - "description": description, - "http_config": http_config, - "interval": interval, - "retries": retries, - "suspended": suspended, - "tcp_config": tcp_config, - "timeout": healthcheck_timeout, - "type": type, - }, - healthcheck_update_params.HealthcheckUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - async def list( - self, - zone_identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HealthcheckListResponse]: - """ - List configured health checks. - - Args: - zone_identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._get( - f"/zones/{zone_identifier}/healthchecks", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[Optional[HealthcheckListResponse]], ResultWrapper[HealthcheckListResponse]), - ) - - async def delete( - self, - identifier: str, - *, - zone_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthcheckDeleteResponse: - """ - Delete a health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._delete( - f"/zones/{zone_identifier}/healthchecks/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthcheckDeleteResponse], ResultWrapper[HealthcheckDeleteResponse]), - ) - - async def edit( - self, - identifier: str, - *, - zone_identifier: str, - address: str, - name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - consecutive_fails: int | NotGiven = NOT_GIVEN, - consecutive_successes: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - http_config: Optional[healthcheck_edit_params.HTTPConfig] | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[healthcheck_edit_params.TcpConfig] | NotGiven = NOT_GIVEN, - healthcheck_timeout: int | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Patch a configured health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - address: The hostname or IP address of the origin server to run health checks on. - - name: A short name to identify the health check. Only alphanumeric characters, hyphens - and underscores are allowed. - - check_regions: A list of regions from which to run health checks. Null means Cloudflare will - pick a default region. - - consecutive_fails: The number of consecutive fails required from a health check before changing the - health to unhealthy. - - consecutive_successes: The number of consecutive successes required from a health check before changing - the health to healthy. - - description: A human-readable description of the health check. - - http_config: Parameters specific to an HTTP or HTTPS health check. - - interval: 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. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - suspended: If suspended, no health checks are sent to the origin. - - tcp_config: Parameters specific to TCP health check. - - healthcheck_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP', 'HTTPS' and 'TCP'. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._patch( - f"/zones/{zone_identifier}/healthchecks/{identifier}", - body=await async_maybe_transform( - { - "address": address, - "name": name, - "check_regions": check_regions, - "consecutive_fails": consecutive_fails, - "consecutive_successes": consecutive_successes, - "description": description, - "http_config": http_config, - "interval": interval, - "retries": retries, - "suspended": suspended, - "tcp_config": tcp_config, - "timeout": healthcheck_timeout, - "type": type, - }, - healthcheck_edit_params.HealthcheckEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - async def get( - self, - identifier: str, - *, - zone_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Fetch a single configured health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( - f"/zones/{zone_identifier}/healthchecks/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - -class HealthchecksWithRawResponse: - def __init__(self, healthchecks: Healthchecks) -> None: - self._healthchecks = healthchecks - - self.create = to_raw_response_wrapper( - healthchecks.create, - ) - self.update = to_raw_response_wrapper( - healthchecks.update, - ) - self.list = to_raw_response_wrapper( - healthchecks.list, - ) - self.delete = to_raw_response_wrapper( - healthchecks.delete, - ) - self.edit = to_raw_response_wrapper( - healthchecks.edit, - ) - self.get = to_raw_response_wrapper( - healthchecks.get, - ) - - @cached_property - def previews(self) -> PreviewsWithRawResponse: - return PreviewsWithRawResponse(self._healthchecks.previews) - - -class AsyncHealthchecksWithRawResponse: - def __init__(self, healthchecks: AsyncHealthchecks) -> None: - self._healthchecks = healthchecks - - self.create = async_to_raw_response_wrapper( - healthchecks.create, - ) - self.update = async_to_raw_response_wrapper( - healthchecks.update, - ) - self.list = async_to_raw_response_wrapper( - healthchecks.list, - ) - self.delete = async_to_raw_response_wrapper( - healthchecks.delete, - ) - self.edit = async_to_raw_response_wrapper( - healthchecks.edit, - ) - self.get = async_to_raw_response_wrapper( - healthchecks.get, - ) - - @cached_property - def previews(self) -> AsyncPreviewsWithRawResponse: - return AsyncPreviewsWithRawResponse(self._healthchecks.previews) - - -class HealthchecksWithStreamingResponse: - def __init__(self, healthchecks: Healthchecks) -> None: - self._healthchecks = healthchecks - - self.create = to_streamed_response_wrapper( - healthchecks.create, - ) - self.update = to_streamed_response_wrapper( - healthchecks.update, - ) - self.list = to_streamed_response_wrapper( - healthchecks.list, - ) - self.delete = to_streamed_response_wrapper( - healthchecks.delete, - ) - self.edit = to_streamed_response_wrapper( - healthchecks.edit, - ) - self.get = to_streamed_response_wrapper( - healthchecks.get, - ) - - @cached_property - def previews(self) -> PreviewsWithStreamingResponse: - return PreviewsWithStreamingResponse(self._healthchecks.previews) - - -class AsyncHealthchecksWithStreamingResponse: - def __init__(self, healthchecks: AsyncHealthchecks) -> None: - self._healthchecks = healthchecks - - self.create = async_to_streamed_response_wrapper( - healthchecks.create, - ) - self.update = async_to_streamed_response_wrapper( - healthchecks.update, - ) - self.list = async_to_streamed_response_wrapper( - healthchecks.list, - ) - self.delete = async_to_streamed_response_wrapper( - healthchecks.delete, - ) - self.edit = async_to_streamed_response_wrapper( - healthchecks.edit, - ) - self.get = async_to_streamed_response_wrapper( - healthchecks.get, - ) - - @cached_property - def previews(self) -> AsyncPreviewsWithStreamingResponse: - return AsyncPreviewsWithStreamingResponse(self._healthchecks.previews) diff --git a/src/cloudflare/resources/healthchecks/previews.py b/src/cloudflare/resources/healthchecks/previews.py deleted file mode 100644 index 778fd6efcad..00000000000 --- a/src/cloudflare/resources/healthchecks/previews.py +++ /dev/null @@ -1,534 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Type, Optional, cast -from typing_extensions import Literal - -import httpx - -from ...types import HealthchecksHealthchecks -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ..._base_client import ( - make_request_options, -) -from ...types.healthchecks import PreviewDeleteResponse, preview_create_params - -__all__ = ["Previews", "AsyncPreviews"] - - -class Previews(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PreviewsWithRawResponse: - return PreviewsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PreviewsWithStreamingResponse: - return PreviewsWithStreamingResponse(self) - - def create( - self, - zone_identifier: str, - *, - address: str, - name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - consecutive_fails: int | NotGiven = NOT_GIVEN, - consecutive_successes: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - http_config: Optional[preview_create_params.HTTPConfig] | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[preview_create_params.TcpConfig] | NotGiven = NOT_GIVEN, - healthcheck_timeout: int | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Create a new preview health check. - - Args: - zone_identifier: Identifier - - address: The hostname or IP address of the origin server to run health checks on. - - name: A short name to identify the health check. Only alphanumeric characters, hyphens - and underscores are allowed. - - check_regions: A list of regions from which to run health checks. Null means Cloudflare will - pick a default region. - - consecutive_fails: The number of consecutive fails required from a health check before changing the - health to unhealthy. - - consecutive_successes: The number of consecutive successes required from a health check before changing - the health to healthy. - - description: A human-readable description of the health check. - - http_config: Parameters specific to an HTTP or HTTPS health check. - - interval: 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. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - suspended: If suspended, no health checks are sent to the origin. - - tcp_config: Parameters specific to TCP health check. - - healthcheck_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP', 'HTTPS' and 'TCP'. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._post( - f"/zones/{zone_identifier}/healthchecks/preview", - body=maybe_transform( - { - "address": address, - "name": name, - "check_regions": check_regions, - "consecutive_fails": consecutive_fails, - "consecutive_successes": consecutive_successes, - "description": description, - "http_config": http_config, - "interval": interval, - "retries": retries, - "suspended": suspended, - "tcp_config": tcp_config, - "timeout": healthcheck_timeout, - "type": type, - }, - preview_create_params.PreviewCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - def delete( - self, - identifier: str, - *, - zone_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PreviewDeleteResponse: - """ - Delete a health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._delete( - f"/zones/{zone_identifier}/healthchecks/preview/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[PreviewDeleteResponse], ResultWrapper[PreviewDeleteResponse]), - ) - - def get( - self, - identifier: str, - *, - zone_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Fetch a single configured health check preview. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( - f"/zones/{zone_identifier}/healthchecks/preview/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - -class AsyncPreviews(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPreviewsWithRawResponse: - return AsyncPreviewsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPreviewsWithStreamingResponse: - return AsyncPreviewsWithStreamingResponse(self) - - async def create( - self, - zone_identifier: str, - *, - address: str, - name: str, - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - | NotGiven = NOT_GIVEN, - consecutive_fails: int | NotGiven = NOT_GIVEN, - consecutive_successes: int | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - http_config: Optional[preview_create_params.HTTPConfig] | NotGiven = NOT_GIVEN, - interval: int | NotGiven = NOT_GIVEN, - retries: int | NotGiven = NOT_GIVEN, - suspended: bool | NotGiven = NOT_GIVEN, - tcp_config: Optional[preview_create_params.TcpConfig] | NotGiven = NOT_GIVEN, - healthcheck_timeout: int | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Create a new preview health check. - - Args: - zone_identifier: Identifier - - address: The hostname or IP address of the origin server to run health checks on. - - name: A short name to identify the health check. Only alphanumeric characters, hyphens - and underscores are allowed. - - check_regions: A list of regions from which to run health checks. Null means Cloudflare will - pick a default region. - - consecutive_fails: The number of consecutive fails required from a health check before changing the - health to unhealthy. - - consecutive_successes: The number of consecutive successes required from a health check before changing - the health to healthy. - - description: A human-readable description of the health check. - - http_config: Parameters specific to an HTTP or HTTPS health check. - - interval: 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. - - retries: The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - - suspended: If suspended, no health checks are sent to the origin. - - tcp_config: Parameters specific to TCP health check. - - healthcheck_timeout: The timeout (in seconds) before marking the health check as failed. - - type: The protocol to use for the health check. Currently supported protocols are - 'HTTP', 'HTTPS' and 'TCP'. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._post( - f"/zones/{zone_identifier}/healthchecks/preview", - body=await async_maybe_transform( - { - "address": address, - "name": name, - "check_regions": check_regions, - "consecutive_fails": consecutive_fails, - "consecutive_successes": consecutive_successes, - "description": description, - "http_config": http_config, - "interval": interval, - "retries": retries, - "suspended": suspended, - "tcp_config": tcp_config, - "timeout": healthcheck_timeout, - "type": type, - }, - preview_create_params.PreviewCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - async def delete( - self, - identifier: str, - *, - zone_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PreviewDeleteResponse: - """ - Delete a health check. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._delete( - f"/zones/{zone_identifier}/healthchecks/preview/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[PreviewDeleteResponse], ResultWrapper[PreviewDeleteResponse]), - ) - - async def get( - self, - identifier: str, - *, - zone_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HealthchecksHealthchecks: - """ - Fetch a single configured health check preview. - - Args: - zone_identifier: Identifier - - identifier: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_identifier: - raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( - f"/zones/{zone_identifier}/healthchecks/preview/{identifier}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[HealthchecksHealthchecks], ResultWrapper[HealthchecksHealthchecks]), - ) - - -class PreviewsWithRawResponse: - def __init__(self, previews: Previews) -> None: - self._previews = previews - - self.create = to_raw_response_wrapper( - previews.create, - ) - self.delete = to_raw_response_wrapper( - previews.delete, - ) - self.get = to_raw_response_wrapper( - previews.get, - ) - - -class AsyncPreviewsWithRawResponse: - def __init__(self, previews: AsyncPreviews) -> None: - self._previews = previews - - self.create = async_to_raw_response_wrapper( - previews.create, - ) - self.delete = async_to_raw_response_wrapper( - previews.delete, - ) - self.get = async_to_raw_response_wrapper( - previews.get, - ) - - -class PreviewsWithStreamingResponse: - def __init__(self, previews: Previews) -> None: - self._previews = previews - - self.create = to_streamed_response_wrapper( - previews.create, - ) - self.delete = to_streamed_response_wrapper( - previews.delete, - ) - self.get = to_streamed_response_wrapper( - previews.get, - ) - - -class AsyncPreviewsWithStreamingResponse: - def __init__(self, previews: AsyncPreviews) -> None: - self._previews = previews - - self.create = async_to_streamed_response_wrapper( - previews.create, - ) - self.delete = async_to_streamed_response_wrapper( - previews.delete, - ) - self.get = async_to_streamed_response_wrapper( - previews.get, - ) diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index e835374b94d..ec5b173cc33 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -76,7 +76,6 @@ from .rate_limit_list_params import RateLimitListParams as RateLimitListParams from .account_update_response import AccountUpdateResponse as AccountUpdateResponse from .audit_log_list_response import AuditLogListResponse as AuditLogListResponse -from .healthcheck_edit_params import HealthcheckEditParams as HealthcheckEditParams from .intel_phishing_url_info import IntelPhishingURLInfo as IntelPhishingURLInfo from .membership_get_response import MembershipGetResponse as MembershipGetResponse from .rate_limit_get_response import RateLimitGetResponse as RateLimitGetResponse @@ -92,10 +91,6 @@ from .rate_limit_list_response import RateLimitListResponse as RateLimitListResponse from .speed_trends_list_params import SpeedTrendsListParams as SpeedTrendsListParams from .waiting_room_edit_params import WaitingRoomEditParams as WaitingRoomEditParams -from .healthcheck_create_params import HealthcheckCreateParams as HealthcheckCreateParams -from .healthcheck_list_response import HealthcheckListResponse as HealthcheckListResponse -from .healthcheck_update_params import HealthcheckUpdateParams as HealthcheckUpdateParams -from .healthchecks_healthchecks import HealthchecksHealthchecks as HealthchecksHealthchecks from .intel_phishing_url_submit import IntelPhishingURLSubmit as IntelPhishingURLSubmit from .load_balancer_edit_params import LoadBalancerEditParams as LoadBalancerEditParams from .page_shield_update_params import PageShieldUpdateParams as PageShieldUpdateParams @@ -120,7 +115,6 @@ from .bot_management_get_response import BotManagementGetResponse as BotManagementGetResponse from .custom_hostname_edit_params import CustomHostnameEditParams as CustomHostnameEditParams from .custom_hostname_list_params import CustomHostnameListParams as CustomHostnameListParams -from .healthcheck_delete_response import HealthcheckDeleteResponse as HealthcheckDeleteResponse from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams from .load_balancer_list_response import LoadBalancerListResponse as LoadBalancerListResponse from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams diff --git a/src/cloudflare/types/healthcheck_create_params.py b/src/cloudflare/types/healthcheck_create_params.py deleted file mode 100644 index 735b076163f..00000000000 --- a/src/cloudflare/types/healthcheck_create_params.py +++ /dev/null @@ -1,140 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["HealthcheckCreateParams", "HTTPConfig", "TcpConfig"] - - -class HealthcheckCreateParams(TypedDict, total=False): - address: Required[str] - """The hostname or IP address of the origin server to run health checks on.""" - - name: Required[str] - """A short name to identify the health check. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means Cloudflare will pick a default region. - """ - - consecutive_fails: int - """ - The number of consecutive fails required from a health check before changing the - health to unhealthy. - """ - - consecutive_successes: int - """ - The number of consecutive successes required from a health check before changing - the health to healthy. - """ - - description: str - """A human-readable description of the health check.""" - - http_config: Optional[HTTPConfig] - """Parameters specific to an HTTP or HTTPS health check.""" - - interval: int - """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. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - suspended: bool - """If suspended, no health checks are sent to the origin.""" - - tcp_config: Optional[TcpConfig] - """Parameters specific to TCP health check.""" - - healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: str - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. - """ - - -class HTTPConfig(TypedDict, total=False): - allow_insecure: bool - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: str - """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_codes: Optional[List[str]] - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: bool - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] - """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. - """ - - method: Literal["GET", "HEAD"] - """The HTTP method to use for the health check.""" - - path: str - """The endpoint path to health check against.""" - - port: int - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(TypedDict, total=False): - method: Literal["connection_established"] - """The TCP connection method to use for the health check.""" - - port: int - """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/healthcheck_delete_response.py b/src/cloudflare/types/healthcheck_delete_response.py deleted file mode 100644 index 6bbe40c8819..00000000000 --- a/src/cloudflare/types/healthcheck_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .._models import BaseModel - -__all__ = ["HealthcheckDeleteResponse"] - - -class HealthcheckDeleteResponse(BaseModel): - id: Optional[str] = None - """Identifier""" diff --git a/src/cloudflare/types/healthcheck_edit_params.py b/src/cloudflare/types/healthcheck_edit_params.py deleted file mode 100644 index 23ebf69b0d3..00000000000 --- a/src/cloudflare/types/healthcheck_edit_params.py +++ /dev/null @@ -1,143 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["HealthcheckEditParams", "HTTPConfig", "TcpConfig"] - - -class HealthcheckEditParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - address: Required[str] - """The hostname or IP address of the origin server to run health checks on.""" - - name: Required[str] - """A short name to identify the health check. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means Cloudflare will pick a default region. - """ - - consecutive_fails: int - """ - The number of consecutive fails required from a health check before changing the - health to unhealthy. - """ - - consecutive_successes: int - """ - The number of consecutive successes required from a health check before changing - the health to healthy. - """ - - description: str - """A human-readable description of the health check.""" - - http_config: Optional[HTTPConfig] - """Parameters specific to an HTTP or HTTPS health check.""" - - interval: int - """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. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - suspended: bool - """If suspended, no health checks are sent to the origin.""" - - tcp_config: Optional[TcpConfig] - """Parameters specific to TCP health check.""" - - healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: str - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. - """ - - -class HTTPConfig(TypedDict, total=False): - allow_insecure: bool - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: str - """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_codes: Optional[List[str]] - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: bool - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] - """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. - """ - - method: Literal["GET", "HEAD"] - """The HTTP method to use for the health check.""" - - path: str - """The endpoint path to health check against.""" - - port: int - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(TypedDict, total=False): - method: Literal["connection_established"] - """The TCP connection method to use for the health check.""" - - port: int - """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/healthcheck_list_response.py b/src/cloudflare/types/healthcheck_list_response.py deleted file mode 100644 index d2bd7b377c0..00000000000 --- a/src/cloudflare/types/healthcheck_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .healthchecks_healthchecks import HealthchecksHealthchecks - -__all__ = ["HealthcheckListResponse"] - -HealthcheckListResponse = List[HealthchecksHealthchecks] diff --git a/src/cloudflare/types/healthcheck_update_params.py b/src/cloudflare/types/healthcheck_update_params.py deleted file mode 100644 index 7f4d8bbc7e8..00000000000 --- a/src/cloudflare/types/healthcheck_update_params.py +++ /dev/null @@ -1,143 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["HealthcheckUpdateParams", "HTTPConfig", "TcpConfig"] - - -class HealthcheckUpdateParams(TypedDict, total=False): - zone_identifier: Required[str] - """Identifier""" - - address: Required[str] - """The hostname or IP address of the origin server to run health checks on.""" - - name: Required[str] - """A short name to identify the health check. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means Cloudflare will pick a default region. - """ - - consecutive_fails: int - """ - The number of consecutive fails required from a health check before changing the - health to unhealthy. - """ - - consecutive_successes: int - """ - The number of consecutive successes required from a health check before changing - the health to healthy. - """ - - description: str - """A human-readable description of the health check.""" - - http_config: Optional[HTTPConfig] - """Parameters specific to an HTTP or HTTPS health check.""" - - interval: int - """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. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - suspended: bool - """If suspended, no health checks are sent to the origin.""" - - tcp_config: Optional[TcpConfig] - """Parameters specific to TCP health check.""" - - healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: str - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. - """ - - -class HTTPConfig(TypedDict, total=False): - allow_insecure: bool - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: str - """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_codes: Optional[List[str]] - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: bool - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] - """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. - """ - - method: Literal["GET", "HEAD"] - """The HTTP method to use for the health check.""" - - path: str - """The endpoint path to health check against.""" - - port: int - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(TypedDict, total=False): - method: Literal["connection_established"] - """The TCP connection method to use for the health check.""" - - port: int - """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/healthchecks/__init__.py b/src/cloudflare/types/healthchecks/__init__.py index 176d1de0dd3..f8ee8b14b1c 100644 --- a/src/cloudflare/types/healthchecks/__init__.py +++ b/src/cloudflare/types/healthchecks/__init__.py @@ -1,6 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .preview_create_params import PreviewCreateParams as PreviewCreateParams -from .preview_delete_response import PreviewDeleteResponse as PreviewDeleteResponse diff --git a/src/cloudflare/types/healthchecks/preview_create_params.py b/src/cloudflare/types/healthchecks/preview_create_params.py deleted file mode 100644 index ba7abf61fe4..00000000000 --- a/src/cloudflare/types/healthchecks/preview_create_params.py +++ /dev/null @@ -1,140 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["PreviewCreateParams", "HTTPConfig", "TcpConfig"] - - -class PreviewCreateParams(TypedDict, total=False): - address: Required[str] - """The hostname or IP address of the origin server to run health checks on.""" - - name: Required[str] - """A short name to identify the health check. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] - """A list of regions from which to run health checks. - - Null means Cloudflare will pick a default region. - """ - - consecutive_fails: int - """ - The number of consecutive fails required from a health check before changing the - health to unhealthy. - """ - - consecutive_successes: int - """ - The number of consecutive successes required from a health check before changing - the health to healthy. - """ - - description: str - """A human-readable description of the health check.""" - - http_config: Optional[HTTPConfig] - """Parameters specific to an HTTP or HTTPS health check.""" - - interval: int - """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. - """ - - retries: int - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - suspended: bool - """If suspended, no health checks are sent to the origin.""" - - tcp_config: Optional[TcpConfig] - """Parameters specific to TCP health check.""" - - healthcheck_timeout: Annotated[int, PropertyInfo(alias="timeout")] - """The timeout (in seconds) before marking the health check as failed.""" - - type: str - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. - """ - - -class HTTPConfig(TypedDict, total=False): - allow_insecure: bool - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: str - """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_codes: Optional[List[str]] - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: bool - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] - """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. - """ - - method: Literal["GET", "HEAD"] - """The HTTP method to use for the health check.""" - - path: str - """The endpoint path to health check against.""" - - port: int - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(TypedDict, total=False): - method: Literal["connection_established"] - """The TCP connection method to use for the health check.""" - - port: int - """Port number to connect to for the health check. Defaults to 80.""" diff --git a/src/cloudflare/types/healthchecks/preview_delete_response.py b/src/cloudflare/types/healthchecks/preview_delete_response.py deleted file mode 100644 index 6aad74a6a3e..00000000000 --- a/src/cloudflare/types/healthchecks/preview_delete_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["PreviewDeleteResponse"] - - -class PreviewDeleteResponse(BaseModel): - id: Optional[str] = None - """Identifier""" diff --git a/src/cloudflare/types/healthchecks_healthchecks.py b/src/cloudflare/types/healthchecks_healthchecks.py deleted file mode 100644 index e7b80ce0dfd..00000000000 --- a/src/cloudflare/types/healthchecks_healthchecks.py +++ /dev/null @@ -1,152 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["HealthchecksHealthchecks", "HTTPConfig", "TcpConfig"] - - -class HTTPConfig(BaseModel): - allow_insecure: Optional[bool] = None - """Do not validate the certificate when the health check uses HTTPS.""" - - expected_body: Optional[str] = None - """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_codes: Optional[List[str]] = None - """The expected HTTP response codes (e.g. - - "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health - check. - """ - - follow_redirects: Optional[bool] = None - """Follow redirects if the origin returns a 3xx status code.""" - - header: Optional[object] = None - """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. - """ - - method: Optional[Literal["GET", "HEAD"]] = None - """The HTTP method to use for the health check.""" - - path: Optional[str] = None - """The endpoint path to health check against.""" - - port: Optional[int] = None - """Port number to connect to for the health check. - - Defaults to 80 if type is HTTP or 443 if type is HTTPS. - """ - - -class TcpConfig(BaseModel): - method: Optional[Literal["connection_established"]] = None - """The TCP connection method to use for the health check.""" - - port: Optional[int] = None - """Port number to connect to for the health check. Defaults to 80.""" - - -class HealthchecksHealthchecks(BaseModel): - id: Optional[str] = None - """Identifier""" - - address: Optional[str] = None - """The hostname or IP address of the origin server to run health checks on.""" - - check_regions: Optional[ - List[ - Literal[ - "WNAM", - "ENAM", - "WEU", - "EEU", - "NSAM", - "SSAM", - "OC", - "ME", - "NAF", - "SAF", - "IN", - "SEAS", - "NEAS", - "ALL_REGIONS", - ] - ] - ] = None - """A list of regions from which to run health checks. - - Null means Cloudflare will pick a default region. - """ - - consecutive_fails: Optional[int] = None - """ - The number of consecutive fails required from a health check before changing the - health to unhealthy. - """ - - consecutive_successes: Optional[int] = None - """ - The number of consecutive successes required from a health check before changing - the health to healthy. - """ - - created_on: Optional[datetime] = None - - description: Optional[str] = None - """A human-readable description of the health check.""" - - failure_reason: Optional[str] = None - """The current failure reason if status is unhealthy.""" - - http_config: Optional[HTTPConfig] = None - """Parameters specific to an HTTP or HTTPS health check.""" - - interval: Optional[int] = None - """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. - """ - - modified_on: Optional[datetime] = None - - name: Optional[str] = None - """A short name to identify the health check. - - Only alphanumeric characters, hyphens and underscores are allowed. - """ - - retries: Optional[int] = None - """ - The number of retries to attempt in case of a timeout before marking the origin - as unhealthy. Retries are attempted immediately. - """ - - status: Optional[Literal["unknown", "healthy", "unhealthy", "suspended"]] = None - """The current status of the origin server according to the health check.""" - - suspended: Optional[bool] = None - """If suspended, no health checks are sent to the origin.""" - - tcp_config: Optional[TcpConfig] = None - """Parameters specific to TCP health check.""" - - timeout: Optional[int] = None - """The timeout (in seconds) before marking the health check as failed.""" - - type: Optional[str] = None - """The protocol to use for the health check. - - Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. - """ diff --git a/tests/api_resources/healthchecks/test_previews.py b/tests/api_resources/healthchecks/test_previews.py deleted file mode 100644 index 03444bf2417..00000000000 --- a/tests/api_resources/healthchecks/test_previews.py +++ /dev/null @@ -1,403 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types import HealthchecksHealthchecks -from cloudflare.types.healthchecks import PreviewDeleteResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPreviews: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - preview = client.healthchecks.previews.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - preview = client.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, - }, - healthcheck_timeout=0, - type="HTTPS", - ) - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.healthchecks.previews.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preview = response.parse() - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.healthchecks.previews.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - preview = response.parse() - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.healthchecks.previews.with_raw_response.create( - "", - address="www.example.com", - name="server-1", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - preview = client.healthchecks.previews.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(PreviewDeleteResponse, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.healthchecks.previews.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preview = response.parse() - assert_matches_type(PreviewDeleteResponse, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.healthchecks.previews.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - preview = response.parse() - assert_matches_type(PreviewDeleteResponse, preview, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.healthchecks.previews.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.healthchecks.previews.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - preview = client.healthchecks.previews.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.healthchecks.previews.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preview = response.parse() - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.healthchecks.previews.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - preview = response.parse() - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.healthchecks.previews.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.healthchecks.previews.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncPreviews: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - preview = await async_client.healthchecks.previews.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - preview = await async_client.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, - }, - healthcheck_timeout=0, - type="HTTPS", - ) - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.healthchecks.previews.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preview = await response.parse() - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.healthchecks.previews.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - preview = await response.parse() - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.healthchecks.previews.with_raw_response.create( - "", - address="www.example.com", - name="server-1", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - preview = await async_client.healthchecks.previews.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(PreviewDeleteResponse, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.healthchecks.previews.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preview = await response.parse() - assert_matches_type(PreviewDeleteResponse, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.healthchecks.previews.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - preview = await response.parse() - assert_matches_type(PreviewDeleteResponse, preview, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.healthchecks.previews.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.healthchecks.previews.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - preview = await async_client.healthchecks.previews.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.healthchecks.previews.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preview = await response.parse() - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.healthchecks.previews.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - preview = await response.parse() - assert_matches_type(HealthchecksHealthchecks, preview, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.healthchecks.previews.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.healthchecks.previews.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/test_healthchecks.py b/tests/api_resources/test_healthchecks.py deleted file mode 100644 index 3defa2351be..00000000000 --- a/tests/api_resources/test_healthchecks.py +++ /dev/null @@ -1,886 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types import ( - HealthcheckListResponse, - HealthchecksHealthchecks, - HealthcheckDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestHealthchecks: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - healthcheck = client.healthchecks.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - healthcheck = client.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, - }, - healthcheck_timeout=0, - type="HTTPS", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.healthchecks.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.healthchecks.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.healthchecks.with_raw_response.create( - "", - address="www.example.com", - name="server-1", - ) - - @pytest.mark.skip() - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - healthcheck = client.healthchecks.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - healthcheck = client.healthchecks.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="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, - }, - healthcheck_timeout=0, - type="HTTPS", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.healthchecks.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.healthchecks.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.healthchecks.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - address="www.example.com", - name="server-1", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.healthchecks.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - @pytest.mark.skip() - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - healthcheck = client.healthchecks.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.healthchecks.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = response.parse() - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.healthchecks.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = response.parse() - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.healthchecks.with_raw_response.list( - "", - ) - - @pytest.mark.skip() - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - healthcheck = client.healthchecks.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(HealthcheckDeleteResponse, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.healthchecks.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = response.parse() - assert_matches_type(HealthcheckDeleteResponse, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.healthchecks.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = response.parse() - assert_matches_type(HealthcheckDeleteResponse, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.healthchecks.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.healthchecks.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - healthcheck = client.healthchecks.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - healthcheck = client.healthchecks.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="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, - }, - healthcheck_timeout=0, - type="HTTPS", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.healthchecks.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.healthchecks.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.healthchecks.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - address="www.example.com", - name="server-1", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.healthchecks.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - healthcheck = client.healthchecks.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.healthchecks.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.healthchecks.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.healthchecks.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.healthchecks.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncHealthchecks: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - healthcheck = await async_client.healthchecks.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - healthcheck = await async_client.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, - }, - healthcheck_timeout=0, - type="HTTPS", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.healthchecks.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = await response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.healthchecks.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = await response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.healthchecks.with_raw_response.create( - "", - address="www.example.com", - name="server-1", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - healthcheck = await async_client.healthchecks.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - healthcheck = await async_client.healthchecks.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="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, - }, - healthcheck_timeout=0, - type="HTTPS", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.healthchecks.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = await response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.healthchecks.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = await response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.healthchecks.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - address="www.example.com", - name="server-1", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.healthchecks.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - healthcheck = await async_client.healthchecks.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.healthchecks.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = await response.parse() - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.healthchecks.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = await response.parse() - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.healthchecks.with_raw_response.list( - "", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - healthcheck = await async_client.healthchecks.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(HealthcheckDeleteResponse, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.healthchecks.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = await response.parse() - assert_matches_type(HealthcheckDeleteResponse, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.healthchecks.with_streaming_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = await response.parse() - assert_matches_type(HealthcheckDeleteResponse, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.healthchecks.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.healthchecks.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - healthcheck = await async_client.healthchecks.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - healthcheck = await async_client.healthchecks.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="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, - }, - healthcheck_timeout=0, - type="HTTPS", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.healthchecks.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = await response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.healthchecks.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = await response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.healthchecks.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - address="www.example.com", - name="server-1", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.healthchecks.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - address="www.example.com", - name="server-1", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - healthcheck = await async_client.healthchecks.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.healthchecks.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - healthcheck = await response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.healthchecks.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - healthcheck = await response.parse() - assert_matches_type(HealthchecksHealthchecks, healthcheck, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.healthchecks.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.healthchecks.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - )