feat(api): OpenAPI spec update via Stainless API (#150)

This commit is contained in:
stainless-app[bot] 2024-03-19 20:58:10 +00:00 committed by stainless-bot
parent 626d7c354c
commit 452f5678f4
19 changed files with 2 additions and 3869 deletions

View file

@ -1 +1 @@
configured_endpoints: 1244
configured_endpoints: 1235

29
api.md
View file

@ -1976,36 +1976,9 @@ Methods:
Types:
```python
from cloudflare.types import (
HealthchecksHealthchecks,
HealthcheckListResponse,
HealthcheckDeleteResponse,
)
from cloudflare.types import HealthchecksHealthchecks
```
Methods:
- <code title="post /zones/{zone_identifier}/healthchecks">client.healthchecks.<a href="./src/cloudflare/resources/healthchecks/healthchecks.py">create</a>(zone_identifier, \*\*<a href="src/cloudflare/types/healthcheck_create_params.py">params</a>) -> <a href="./src/cloudflare/types/healthchecks_healthchecks.py">HealthchecksHealthchecks</a></code>
- <code title="put /zones/{zone_identifier}/healthchecks/{identifier}">client.healthchecks.<a href="./src/cloudflare/resources/healthchecks/healthchecks.py">update</a>(identifier, \*, zone_identifier, \*\*<a href="src/cloudflare/types/healthcheck_update_params.py">params</a>) -> <a href="./src/cloudflare/types/healthchecks_healthchecks.py">HealthchecksHealthchecks</a></code>
- <code title="get /zones/{zone_identifier}/healthchecks">client.healthchecks.<a href="./src/cloudflare/resources/healthchecks/healthchecks.py">list</a>(zone_identifier) -> <a href="./src/cloudflare/types/healthcheck_list_response.py">Optional</a></code>
- <code title="delete /zones/{zone_identifier}/healthchecks/{identifier}">client.healthchecks.<a href="./src/cloudflare/resources/healthchecks/healthchecks.py">delete</a>(identifier, \*, zone_identifier) -> <a href="./src/cloudflare/types/healthcheck_delete_response.py">HealthcheckDeleteResponse</a></code>
- <code title="patch /zones/{zone_identifier}/healthchecks/{identifier}">client.healthchecks.<a href="./src/cloudflare/resources/healthchecks/healthchecks.py">edit</a>(identifier, \*, zone_identifier, \*\*<a href="src/cloudflare/types/healthcheck_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/healthchecks_healthchecks.py">HealthchecksHealthchecks</a></code>
- <code title="get /zones/{zone_identifier}/healthchecks/{identifier}">client.healthchecks.<a href="./src/cloudflare/resources/healthchecks/healthchecks.py">get</a>(identifier, \*, zone_identifier) -> <a href="./src/cloudflare/types/healthchecks_healthchecks.py">HealthchecksHealthchecks</a></code>
## Previews
Types:
```python
from cloudflare.types.healthchecks import PreviewDeleteResponse
```
Methods:
- <code title="post /zones/{zone_identifier}/healthchecks/preview">client.healthchecks.previews.<a href="./src/cloudflare/resources/healthchecks/previews.py">create</a>(zone_identifier, \*\*<a href="src/cloudflare/types/healthchecks/preview_create_params.py">params</a>) -> <a href="./src/cloudflare/types/healthchecks_healthchecks.py">HealthchecksHealthchecks</a></code>
- <code title="delete /zones/{zone_identifier}/healthchecks/preview/{identifier}">client.healthchecks.previews.<a href="./src/cloudflare/resources/healthchecks/previews.py">delete</a>(identifier, \*, zone_identifier) -> <a href="./src/cloudflare/types/healthchecks/preview_delete_response.py">PreviewDeleteResponse</a></code>
- <code title="get /zones/{zone_identifier}/healthchecks/preview/{identifier}">client.healthchecks.previews.<a href="./src/cloudflare/resources/healthchecks/previews.py">get</a>(identifier, \*, zone_identifier) -> <a href="./src/cloudflare/types/healthchecks_healthchecks.py">HealthchecksHealthchecks</a></code>
# KeylessCertificates
Types:

View file

@ -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 @@ class Cloudflare(SyncAPIClient):
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 @@ class AsyncCloudflare(AsyncAPIClient):
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 @@ class CloudflareWithRawResponse:
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 @@ class AsyncCloudflareWithRawResponse:
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 @@ class CloudflareWithStreamedResponse:
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 @@ class AsyncCloudflareWithStreamedResponse:
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)

View file

@ -400,14 +400,6 @@ from .url_scanner import (
URLScannerWithStreamingResponse,
AsyncURLScannerWithStreamingResponse,
)
from .healthchecks import (
Healthchecks,
AsyncHealthchecks,
HealthchecksWithRawResponse,
AsyncHealthchecksWithRawResponse,
HealthchecksWithStreamingResponse,
AsyncHealthchecksWithStreamingResponse,
)
from .email_routing import (
EmailRouting,
AsyncEmailRouting,
@ -778,12 +770,6 @@ __all__ = [
"AsyncFirewallWithRawResponse",
"FirewallWithStreamingResponse",
"AsyncFirewallWithStreamingResponse",
"Healthchecks",
"AsyncHealthchecks",
"HealthchecksWithRawResponse",
"AsyncHealthchecksWithRawResponse",
"HealthchecksWithStreamingResponse",
"AsyncHealthchecksWithStreamingResponse",
"KeylessCertificates",
"AsyncKeylessCertificates",
"KeylessCertificatesWithRawResponse",

View file

@ -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",
]

File diff suppressed because it is too large Load diff

View file

@ -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,
)

View file

@ -76,7 +76,6 @@ from .rate_limit_edit_params import RateLimitEditParams as RateLimitEditParams
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_edit_response import RateLimitEditResponse as RateLimitEditResp
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 .warp_connector_list_params import WARPConnectorListParams as WARPConnector
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

View file

@ -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."""

View file

@ -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"""

View file

@ -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."""

View file

@ -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]

View file

@ -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."""

View file

@ -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

View file

@ -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."""

View file

@ -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"""

View file

@ -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'.
"""

View file

@ -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",
)

View file

@ -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",
)