diff --git a/.stats.yml b/.stats.yml index aad43adc2..d574cb547 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 1739 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3bcbff61e51911a9f7dc10e8d468a0848ecc706a1694d3b49433dd6b739b3665.yml -openapi_spec_hash: 2fa4d4a482c9f2612ab00e57b9bad971 +configured_endpoints: 1734 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f54e9bb9f184af84af3654c0e3477d481beabb3d2abf4b25645012d8a6597605.yml +openapi_spec_hash: d124b128eb080ed85f6ff18ee34e8fc3 config_hash: 7e270b3449efce600e3469937a344c2d diff --git a/api.md b/api.md index 272e53abd..84288fb94 100644 --- a/api.md +++ b/api.md @@ -5329,25 +5329,9 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.devices import ( - SchemaData, - SchemaHTTP, - DEXTestCreateResponse, - DEXTestUpdateResponse, - DEXTestListResponse, - DEXTestDeleteResponse, - DEXTestGetResponse, -) +from cloudflare.types.zero_trust.devices import SchemaData, SchemaHTTP ``` -Methods: - -- client.zero_trust.devices.dex_tests.create(\*, account_id, \*\*params) -> Optional[DEXTestCreateResponse] -- client.zero_trust.devices.dex_tests.update(dex_test_id, \*, account_id, \*\*params) -> Optional[DEXTestUpdateResponse] -- client.zero_trust.devices.dex_tests.list(\*, account_id) -> SyncSinglePage[DEXTestListResponse] -- client.zero_trust.devices.dex_tests.delete(dex_test_id, \*, account_id) -> Optional[DEXTestDeleteResponse] -- client.zero_trust.devices.dex_tests.get(dex_test_id, \*, account_id) -> Optional[DEXTestGetResponse] - ### Networks Types: diff --git a/src/cloudflare/resources/zero_trust/devices/__init__.py b/src/cloudflare/resources/zero_trust/devices/__init__.py index b3bd5980c..81e637a02 100644 --- a/src/cloudflare/resources/zero_trust/devices/__init__.py +++ b/src/cloudflare/resources/zero_trust/devices/__init__.py @@ -56,14 +56,6 @@ from .unrevoke import ( UnrevokeResourceWithStreamingResponse, AsyncUnrevokeResourceWithStreamingResponse, ) -from .dex_tests import ( - DEXTestsResource, - AsyncDEXTestsResource, - DEXTestsResourceWithRawResponse, - AsyncDEXTestsResourceWithRawResponse, - DEXTestsResourceWithStreamingResponse, - AsyncDEXTestsResourceWithStreamingResponse, -) from .resilience import ( ResilienceResource, AsyncResilienceResource, @@ -110,12 +102,6 @@ __all__ = [ "AsyncRegistrationsResourceWithRawResponse", "RegistrationsResourceWithStreamingResponse", "AsyncRegistrationsResourceWithStreamingResponse", - "DEXTestsResource", - "AsyncDEXTestsResource", - "DEXTestsResourceWithRawResponse", - "AsyncDEXTestsResourceWithRawResponse", - "DEXTestsResourceWithStreamingResponse", - "AsyncDEXTestsResourceWithStreamingResponse", "NetworksResource", "AsyncNetworksResource", "NetworksResourceWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/devices/devices.py b/src/cloudflare/resources/zero_trust/devices/devices.py index 14dcea905..4b64981df 100644 --- a/src/cloudflare/resources/zero_trust/devices/devices.py +++ b/src/cloudflare/resources/zero_trust/devices/devices.py @@ -40,14 +40,6 @@ from .unrevoke import ( AsyncUnrevokeResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .dex_tests import ( - DEXTestsResource, - AsyncDEXTestsResource, - DEXTestsResourceWithRawResponse, - AsyncDEXTestsResourceWithRawResponse, - DEXTestsResourceWithStreamingResponse, - AsyncDEXTestsResourceWithStreamingResponse, -) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -126,10 +118,6 @@ class DevicesResource(SyncAPIResource): def registrations(self) -> RegistrationsResource: return RegistrationsResource(self._client) - @cached_property - def dex_tests(self) -> DEXTestsResource: - return DEXTestsResource(self._client) - @cached_property def networks(self) -> NetworksResource: return NetworksResource(self._client) @@ -282,10 +270,6 @@ class AsyncDevicesResource(AsyncAPIResource): def registrations(self) -> AsyncRegistrationsResource: return AsyncRegistrationsResource(self._client) - @cached_property - def dex_tests(self) -> AsyncDEXTestsResource: - return AsyncDEXTestsResource(self._client) - @cached_property def networks(self) -> AsyncNetworksResource: return AsyncNetworksResource(self._client) @@ -448,10 +432,6 @@ class DevicesResourceWithRawResponse: def registrations(self) -> RegistrationsResourceWithRawResponse: return RegistrationsResourceWithRawResponse(self._devices.registrations) - @cached_property - def dex_tests(self) -> DEXTestsResourceWithRawResponse: - return DEXTestsResourceWithRawResponse(self._devices.dex_tests) - @cached_property def networks(self) -> NetworksResourceWithRawResponse: return NetworksResourceWithRawResponse(self._devices.networks) @@ -508,10 +488,6 @@ class AsyncDevicesResourceWithRawResponse: def registrations(self) -> AsyncRegistrationsResourceWithRawResponse: return AsyncRegistrationsResourceWithRawResponse(self._devices.registrations) - @cached_property - def dex_tests(self) -> AsyncDEXTestsResourceWithRawResponse: - return AsyncDEXTestsResourceWithRawResponse(self._devices.dex_tests) - @cached_property def networks(self) -> AsyncNetworksResourceWithRawResponse: return AsyncNetworksResourceWithRawResponse(self._devices.networks) @@ -568,10 +544,6 @@ class DevicesResourceWithStreamingResponse: def registrations(self) -> RegistrationsResourceWithStreamingResponse: return RegistrationsResourceWithStreamingResponse(self._devices.registrations) - @cached_property - def dex_tests(self) -> DEXTestsResourceWithStreamingResponse: - return DEXTestsResourceWithStreamingResponse(self._devices.dex_tests) - @cached_property def networks(self) -> NetworksResourceWithStreamingResponse: return NetworksResourceWithStreamingResponse(self._devices.networks) @@ -628,10 +600,6 @@ class AsyncDevicesResourceWithStreamingResponse: def registrations(self) -> AsyncRegistrationsResourceWithStreamingResponse: return AsyncRegistrationsResourceWithStreamingResponse(self._devices.registrations) - @cached_property - def dex_tests(self) -> AsyncDEXTestsResourceWithStreamingResponse: - return AsyncDEXTestsResourceWithStreamingResponse(self._devices.dex_tests) - @cached_property def networks(self) -> AsyncNetworksResourceWithStreamingResponse: return AsyncNetworksResourceWithStreamingResponse(self._devices.networks) diff --git a/src/cloudflare/resources/zero_trust/devices/dex_tests.py b/src/cloudflare/resources/zero_trust/devices/dex_tests.py deleted file mode 100644 index 65b9b7aed..000000000 --- a/src/cloudflare/resources/zero_trust/devices/dex_tests.py +++ /dev/null @@ -1,681 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Iterable, Optional, cast - -import httpx - -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 ....pagination import SyncSinglePage, AsyncSinglePage -from ...._base_client import AsyncPaginator, make_request_options -from ....types.zero_trust.devices import dex_test_create_params, dex_test_update_params -from ....types.zero_trust.devices.dex_test_get_response import DEXTestGetResponse -from ....types.zero_trust.devices.dex_test_list_response import DEXTestListResponse -from ....types.zero_trust.devices.dex_test_create_response import DEXTestCreateResponse -from ....types.zero_trust.devices.dex_test_delete_response import DEXTestDeleteResponse -from ....types.zero_trust.devices.dex_test_update_response import DEXTestUpdateResponse - -__all__ = ["DEXTestsResource", "AsyncDEXTestsResource"] - - -class DEXTestsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> DEXTestsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return DEXTestsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DEXTestsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return DEXTestsResourceWithStreamingResponse(self) - - def create( - self, - *, - account_id: str, - data: dex_test_create_params.Data, - enabled: bool, - interval: str, - name: str, - description: str | NotGiven = NOT_GIVEN, - target_policies: Iterable[dex_test_create_params.TargetPolicy] | NotGiven = NOT_GIVEN, - targeted: bool | 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, - ) -> Optional[DEXTestCreateResponse]: - """ - Create a DEX test. - - Args: - data: The configuration object which contains the details for the WARP client to - conduct the test. - - enabled: Determines whether or not the test is active. - - interval: How often the test will run. - - name: The name of the DEX test. Must be unique. - - description: Additional details about the test. - - target_policies: DEX rules targeted by this test - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._post( - f"/accounts/{account_id}/devices/dex_tests", - body=maybe_transform( - { - "data": data, - "enabled": enabled, - "interval": interval, - "name": name, - "description": description, - "target_policies": target_policies, - "targeted": targeted, - }, - dex_test_create_params.DEXTestCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DEXTestCreateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[DEXTestCreateResponse]], ResultWrapper[DEXTestCreateResponse]), - ) - - def update( - self, - dex_test_id: str, - *, - account_id: str, - data: dex_test_update_params.Data, - enabled: bool, - interval: str, - name: str, - description: str | NotGiven = NOT_GIVEN, - target_policies: Iterable[dex_test_update_params.TargetPolicy] | NotGiven = NOT_GIVEN, - targeted: bool | 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, - ) -> Optional[DEXTestUpdateResponse]: - """ - Update a DEX test. - - Args: - dex_test_id: API Resource UUID tag. - - data: The configuration object which contains the details for the WARP client to - conduct the test. - - enabled: Determines whether or not the test is active. - - interval: How often the test will run. - - name: The name of the DEX test. Must be unique. - - description: Additional details about the test. - - target_policies: DEX rules targeted by this test - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not dex_test_id: - raise ValueError(f"Expected a non-empty value for `dex_test_id` but received {dex_test_id!r}") - return self._put( - f"/accounts/{account_id}/devices/dex_tests/{dex_test_id}", - body=maybe_transform( - { - "data": data, - "enabled": enabled, - "interval": interval, - "name": name, - "description": description, - "target_policies": target_policies, - "targeted": targeted, - }, - dex_test_update_params.DEXTestUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DEXTestUpdateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[DEXTestUpdateResponse]], ResultWrapper[DEXTestUpdateResponse]), - ) - - def list( - self, - *, - account_id: 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, - ) -> SyncSinglePage[DEXTestListResponse]: - """ - Fetch all DEX tests. - - Args: - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get_api_list( - f"/accounts/{account_id}/devices/dex_tests", - page=SyncSinglePage[DEXTestListResponse], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=DEXTestListResponse, - ) - - def delete( - self, - dex_test_id: str, - *, - account_id: 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[DEXTestDeleteResponse]: - """Delete a Device DEX test. - - Returns the remaining device dex tests for the - account. - - Args: - dex_test_id: API Resource UUID tag. - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not dex_test_id: - raise ValueError(f"Expected a non-empty value for `dex_test_id` but received {dex_test_id!r}") - return self._delete( - f"/accounts/{account_id}/devices/dex_tests/{dex_test_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DEXTestDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[DEXTestDeleteResponse]], ResultWrapper[DEXTestDeleteResponse]), - ) - - def get( - self, - dex_test_id: str, - *, - account_id: 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[DEXTestGetResponse]: - """ - Fetch a single DEX test. - - Args: - dex_test_id: The unique identifier for the test. - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not dex_test_id: - raise ValueError(f"Expected a non-empty value for `dex_test_id` but received {dex_test_id!r}") - return self._get( - f"/accounts/{account_id}/devices/dex_tests/{dex_test_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DEXTestGetResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[DEXTestGetResponse]], ResultWrapper[DEXTestGetResponse]), - ) - - -class AsyncDEXTestsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncDEXTestsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return AsyncDEXTestsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDEXTestsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return AsyncDEXTestsResourceWithStreamingResponse(self) - - async def create( - self, - *, - account_id: str, - data: dex_test_create_params.Data, - enabled: bool, - interval: str, - name: str, - description: str | NotGiven = NOT_GIVEN, - target_policies: Iterable[dex_test_create_params.TargetPolicy] | NotGiven = NOT_GIVEN, - targeted: bool | 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, - ) -> Optional[DEXTestCreateResponse]: - """ - Create a DEX test. - - Args: - data: The configuration object which contains the details for the WARP client to - conduct the test. - - enabled: Determines whether or not the test is active. - - interval: How often the test will run. - - name: The name of the DEX test. Must be unique. - - description: Additional details about the test. - - target_policies: DEX rules targeted by this test - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._post( - f"/accounts/{account_id}/devices/dex_tests", - body=await async_maybe_transform( - { - "data": data, - "enabled": enabled, - "interval": interval, - "name": name, - "description": description, - "target_policies": target_policies, - "targeted": targeted, - }, - dex_test_create_params.DEXTestCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DEXTestCreateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[DEXTestCreateResponse]], ResultWrapper[DEXTestCreateResponse]), - ) - - async def update( - self, - dex_test_id: str, - *, - account_id: str, - data: dex_test_update_params.Data, - enabled: bool, - interval: str, - name: str, - description: str | NotGiven = NOT_GIVEN, - target_policies: Iterable[dex_test_update_params.TargetPolicy] | NotGiven = NOT_GIVEN, - targeted: bool | 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, - ) -> Optional[DEXTestUpdateResponse]: - """ - Update a DEX test. - - Args: - dex_test_id: API Resource UUID tag. - - data: The configuration object which contains the details for the WARP client to - conduct the test. - - enabled: Determines whether or not the test is active. - - interval: How often the test will run. - - name: The name of the DEX test. Must be unique. - - description: Additional details about the test. - - target_policies: DEX rules targeted by this test - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not dex_test_id: - raise ValueError(f"Expected a non-empty value for `dex_test_id` but received {dex_test_id!r}") - return await self._put( - f"/accounts/{account_id}/devices/dex_tests/{dex_test_id}", - body=await async_maybe_transform( - { - "data": data, - "enabled": enabled, - "interval": interval, - "name": name, - "description": description, - "target_policies": target_policies, - "targeted": targeted, - }, - dex_test_update_params.DEXTestUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DEXTestUpdateResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[DEXTestUpdateResponse]], ResultWrapper[DEXTestUpdateResponse]), - ) - - def list( - self, - *, - account_id: 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, - ) -> AsyncPaginator[DEXTestListResponse, AsyncSinglePage[DEXTestListResponse]]: - """ - Fetch all DEX tests. - - Args: - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get_api_list( - f"/accounts/{account_id}/devices/dex_tests", - page=AsyncSinglePage[DEXTestListResponse], - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - model=DEXTestListResponse, - ) - - async def delete( - self, - dex_test_id: str, - *, - account_id: 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[DEXTestDeleteResponse]: - """Delete a Device DEX test. - - Returns the remaining device dex tests for the - account. - - Args: - dex_test_id: API Resource UUID tag. - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not dex_test_id: - raise ValueError(f"Expected a non-empty value for `dex_test_id` but received {dex_test_id!r}") - return await self._delete( - f"/accounts/{account_id}/devices/dex_tests/{dex_test_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DEXTestDeleteResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[DEXTestDeleteResponse]], ResultWrapper[DEXTestDeleteResponse]), - ) - - async def get( - self, - dex_test_id: str, - *, - account_id: 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[DEXTestGetResponse]: - """ - Fetch a single DEX test. - - Args: - dex_test_id: The unique identifier for the test. - - 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 account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - if not dex_test_id: - raise ValueError(f"Expected a non-empty value for `dex_test_id` but received {dex_test_id!r}") - return await self._get( - f"/accounts/{account_id}/devices/dex_tests/{dex_test_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DEXTestGetResponse]]._unwrapper, - ), - cast_to=cast(Type[Optional[DEXTestGetResponse]], ResultWrapper[DEXTestGetResponse]), - ) - - -class DEXTestsResourceWithRawResponse: - def __init__(self, dex_tests: DEXTestsResource) -> None: - self._dex_tests = dex_tests - - self.create = to_raw_response_wrapper( - dex_tests.create, - ) - self.update = to_raw_response_wrapper( - dex_tests.update, - ) - self.list = to_raw_response_wrapper( - dex_tests.list, - ) - self.delete = to_raw_response_wrapper( - dex_tests.delete, - ) - self.get = to_raw_response_wrapper( - dex_tests.get, - ) - - -class AsyncDEXTestsResourceWithRawResponse: - def __init__(self, dex_tests: AsyncDEXTestsResource) -> None: - self._dex_tests = dex_tests - - self.create = async_to_raw_response_wrapper( - dex_tests.create, - ) - self.update = async_to_raw_response_wrapper( - dex_tests.update, - ) - self.list = async_to_raw_response_wrapper( - dex_tests.list, - ) - self.delete = async_to_raw_response_wrapper( - dex_tests.delete, - ) - self.get = async_to_raw_response_wrapper( - dex_tests.get, - ) - - -class DEXTestsResourceWithStreamingResponse: - def __init__(self, dex_tests: DEXTestsResource) -> None: - self._dex_tests = dex_tests - - self.create = to_streamed_response_wrapper( - dex_tests.create, - ) - self.update = to_streamed_response_wrapper( - dex_tests.update, - ) - self.list = to_streamed_response_wrapper( - dex_tests.list, - ) - self.delete = to_streamed_response_wrapper( - dex_tests.delete, - ) - self.get = to_streamed_response_wrapper( - dex_tests.get, - ) - - -class AsyncDEXTestsResourceWithStreamingResponse: - def __init__(self, dex_tests: AsyncDEXTestsResource) -> None: - self._dex_tests = dex_tests - - self.create = async_to_streamed_response_wrapper( - dex_tests.create, - ) - self.update = async_to_streamed_response_wrapper( - dex_tests.update, - ) - self.list = async_to_streamed_response_wrapper( - dex_tests.list, - ) - self.delete = async_to_streamed_response_wrapper( - dex_tests.delete, - ) - self.get = async_to_streamed_response_wrapper( - dex_tests.get, - ) diff --git a/src/cloudflare/types/zero_trust/devices/__init__.py b/src/cloudflare/types/zero_trust/devices/__init__.py index 68769f0f0..1d3fe9294 100644 --- a/src/cloudflare/types/zero_trust/devices/__init__.py +++ b/src/cloudflare/types/zero_trust/devices/__init__.py @@ -34,7 +34,6 @@ from .firewall_input_param import FirewallInputParam as FirewallInputParam from .revoke_create_params import RevokeCreateParams as RevokeCreateParams from .split_tunnel_exclude import SplitTunnelExclude as SplitTunnelExclude from .split_tunnel_include import SplitTunnelInclude as SplitTunnelInclude -from .dex_test_get_response import DEXTestGetResponse as DEXTestGetResponse from .disk_encryption_input import DiskEncryptionInput as DiskEncryptionInput from .fallback_domain_param import FallbackDomainParam as FallbackDomainParam from .network_create_params import NetworkCreateParams as NetworkCreateParams @@ -43,9 +42,6 @@ from .posture_create_params import PostureCreateParams as PostureCreateParams from .posture_update_params import PostureUpdateParams as PostureUpdateParams from .sentinelone_s2s_input import SentineloneS2sInput as SentineloneS2sInput from .setting_update_params import SettingUpdateParams as SettingUpdateParams -from .dex_test_create_params import DEXTestCreateParams as DEXTestCreateParams -from .dex_test_list_response import DEXTestListResponse as DEXTestListResponse -from .dex_test_update_params import DEXTestUpdateParams as DEXTestUpdateParams from .os_version_input_param import OSVersionInputParam as OSVersionInputParam from .revoke_create_response import RevokeCreateResponse as RevokeCreateResponse from .unique_client_id_input import UniqueClientIDInput as UniqueClientIDInput @@ -55,9 +51,6 @@ from .fleet_status_get_params import FleetStatusGetParams as FleetStatusGetParam from .posture_delete_response import PostureDeleteResponse as PostureDeleteResponse from .sentinelone_input_param import SentineloneInputParam as SentineloneInputParam from .client_certificate_input import ClientCertificateInput as ClientCertificateInput -from .dex_test_create_response import DEXTestCreateResponse as DEXTestCreateResponse -from .dex_test_delete_response import DEXTestDeleteResponse as DEXTestDeleteResponse -from .dex_test_update_response import DEXTestUpdateResponse as DEXTestUpdateResponse from .registration_list_params import RegistrationListParams as RegistrationListParams from .unrevoke_create_response import UnrevokeCreateResponse as UnrevokeCreateResponse from .domain_joined_input_param import DomainJoinedInputParam as DomainJoinedInputParam diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_create_params.py b/src/cloudflare/types/zero_trust/devices/dex_test_create_params.py deleted file mode 100644 index 99c48d581..000000000 --- a/src/cloudflare/types/zero_trust/devices/dex_test_create_params.py +++ /dev/null @@ -1,57 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Required, TypedDict - -__all__ = ["DEXTestCreateParams", "Data", "TargetPolicy"] - - -class DEXTestCreateParams(TypedDict, total=False): - account_id: Required[str] - - data: Required[Data] - """ - The configuration object which contains the details for the WARP client to - conduct the test. - """ - - enabled: Required[bool] - """Determines whether or not the test is active.""" - - interval: Required[str] - """How often the test will run.""" - - name: Required[str] - """The name of the DEX test. Must be unique.""" - - description: str - """Additional details about the test.""" - - target_policies: Iterable[TargetPolicy] - """DEX rules targeted by this test""" - - targeted: bool - - -class Data(TypedDict, total=False): - host: str - """The desired endpoint to test.""" - - kind: str - """The type of test.""" - - method: str - """The HTTP request method type.""" - - -class TargetPolicy(TypedDict, total=False): - id: str - """The id of the DEX rule""" - - default: bool - """Whether the DEX rule is the account default""" - - name: str - """The name of the DEX rule""" diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_create_response.py b/src/cloudflare/types/zero_trust/devices/dex_test_create_response.py deleted file mode 100644 index d8931a56c..000000000 --- a/src/cloudflare/types/zero_trust/devices/dex_test_create_response.py +++ /dev/null @@ -1,57 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["DEXTestCreateResponse", "Data", "TargetPolicy"] - - -class Data(BaseModel): - host: Optional[str] = None - """The desired endpoint to test.""" - - kind: Optional[str] = None - """The type of test.""" - - method: Optional[str] = None - """The HTTP request method type.""" - - -class TargetPolicy(BaseModel): - id: Optional[str] = None - """The id of the DEX rule""" - - default: Optional[bool] = None - """Whether the DEX rule is the account default""" - - name: Optional[str] = None - """The name of the DEX rule""" - - -class DEXTestCreateResponse(BaseModel): - data: Data - """ - The configuration object which contains the details for the WARP client to - conduct the test. - """ - - enabled: bool - """Determines whether or not the test is active.""" - - interval: str - """How often the test will run.""" - - name: str - """The name of the DEX test. Must be unique.""" - - description: Optional[str] = None - """Additional details about the test.""" - - target_policies: Optional[List[TargetPolicy]] = None - """DEX rules targeted by this test""" - - targeted: Optional[bool] = None - - test_id: Optional[str] = None - """The unique identifier for the test.""" diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_delete_response.py b/src/cloudflare/types/zero_trust/devices/dex_test_delete_response.py deleted file mode 100644 index 91dc2d74c..000000000 --- a/src/cloudflare/types/zero_trust/devices/dex_test_delete_response.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["DEXTestDeleteResponse", "DEXTest", "DEXTestData", "DEXTestTargetPolicy"] - - -class DEXTestData(BaseModel): - host: Optional[str] = None - """The desired endpoint to test.""" - - kind: Optional[str] = None - """The type of test.""" - - method: Optional[str] = None - """The HTTP request method type.""" - - -class DEXTestTargetPolicy(BaseModel): - id: Optional[str] = None - """The id of the DEX rule""" - - default: Optional[bool] = None - """Whether the DEX rule is the account default""" - - name: Optional[str] = None - """The name of the DEX rule""" - - -class DEXTest(BaseModel): - data: DEXTestData - """ - The configuration object which contains the details for the WARP client to - conduct the test. - """ - - enabled: bool - """Determines whether or not the test is active.""" - - interval: str - """How often the test will run.""" - - name: str - """The name of the DEX test. Must be unique.""" - - description: Optional[str] = None - """Additional details about the test.""" - - target_policies: Optional[List[DEXTestTargetPolicy]] = None - """DEX rules targeted by this test""" - - targeted: Optional[bool] = None - - test_id: Optional[str] = None - """The unique identifier for the test.""" - - -class DEXTestDeleteResponse(BaseModel): - dex_tests: Optional[List[DEXTest]] = None diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_get_response.py b/src/cloudflare/types/zero_trust/devices/dex_test_get_response.py deleted file mode 100644 index 3b159f70b..000000000 --- a/src/cloudflare/types/zero_trust/devices/dex_test_get_response.py +++ /dev/null @@ -1,57 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["DEXTestGetResponse", "Data", "TargetPolicy"] - - -class Data(BaseModel): - host: Optional[str] = None - """The desired endpoint to test.""" - - kind: Optional[str] = None - """The type of test.""" - - method: Optional[str] = None - """The HTTP request method type.""" - - -class TargetPolicy(BaseModel): - id: Optional[str] = None - """The id of the DEX rule""" - - default: Optional[bool] = None - """Whether the DEX rule is the account default""" - - name: Optional[str] = None - """The name of the DEX rule""" - - -class DEXTestGetResponse(BaseModel): - data: Data - """ - The configuration object which contains the details for the WARP client to - conduct the test. - """ - - enabled: bool - """Determines whether or not the test is active.""" - - interval: str - """How often the test will run.""" - - name: str - """The name of the DEX test. Must be unique.""" - - description: Optional[str] = None - """Additional details about the test.""" - - target_policies: Optional[List[TargetPolicy]] = None - """DEX rules targeted by this test""" - - targeted: Optional[bool] = None - - test_id: Optional[str] = None - """The unique identifier for the test.""" diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_list_response.py b/src/cloudflare/types/zero_trust/devices/dex_test_list_response.py deleted file mode 100644 index 32353cdd0..000000000 --- a/src/cloudflare/types/zero_trust/devices/dex_test_list_response.py +++ /dev/null @@ -1,57 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["DEXTestListResponse", "Data", "TargetPolicy"] - - -class Data(BaseModel): - host: Optional[str] = None - """The desired endpoint to test.""" - - kind: Optional[str] = None - """The type of test.""" - - method: Optional[str] = None - """The HTTP request method type.""" - - -class TargetPolicy(BaseModel): - id: Optional[str] = None - """The id of the DEX rule""" - - default: Optional[bool] = None - """Whether the DEX rule is the account default""" - - name: Optional[str] = None - """The name of the DEX rule""" - - -class DEXTestListResponse(BaseModel): - data: Data - """ - The configuration object which contains the details for the WARP client to - conduct the test. - """ - - enabled: bool - """Determines whether or not the test is active.""" - - interval: str - """How often the test will run.""" - - name: str - """The name of the DEX test. Must be unique.""" - - description: Optional[str] = None - """Additional details about the test.""" - - target_policies: Optional[List[TargetPolicy]] = None - """DEX rules targeted by this test""" - - targeted: Optional[bool] = None - - test_id: Optional[str] = None - """The unique identifier for the test.""" diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_update_params.py b/src/cloudflare/types/zero_trust/devices/dex_test_update_params.py deleted file mode 100644 index 562affbc0..000000000 --- a/src/cloudflare/types/zero_trust/devices/dex_test_update_params.py +++ /dev/null @@ -1,57 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Required, TypedDict - -__all__ = ["DEXTestUpdateParams", "Data", "TargetPolicy"] - - -class DEXTestUpdateParams(TypedDict, total=False): - account_id: Required[str] - - data: Required[Data] - """ - The configuration object which contains the details for the WARP client to - conduct the test. - """ - - enabled: Required[bool] - """Determines whether or not the test is active.""" - - interval: Required[str] - """How often the test will run.""" - - name: Required[str] - """The name of the DEX test. Must be unique.""" - - description: str - """Additional details about the test.""" - - target_policies: Iterable[TargetPolicy] - """DEX rules targeted by this test""" - - targeted: bool - - -class Data(TypedDict, total=False): - host: str - """The desired endpoint to test.""" - - kind: str - """The type of test.""" - - method: str - """The HTTP request method type.""" - - -class TargetPolicy(TypedDict, total=False): - id: str - """The id of the DEX rule""" - - default: bool - """Whether the DEX rule is the account default""" - - name: str - """The name of the DEX rule""" diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_update_response.py b/src/cloudflare/types/zero_trust/devices/dex_test_update_response.py deleted file mode 100644 index 478d96d46..000000000 --- a/src/cloudflare/types/zero_trust/devices/dex_test_update_response.py +++ /dev/null @@ -1,57 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["DEXTestUpdateResponse", "Data", "TargetPolicy"] - - -class Data(BaseModel): - host: Optional[str] = None - """The desired endpoint to test.""" - - kind: Optional[str] = None - """The type of test.""" - - method: Optional[str] = None - """The HTTP request method type.""" - - -class TargetPolicy(BaseModel): - id: Optional[str] = None - """The id of the DEX rule""" - - default: Optional[bool] = None - """Whether the DEX rule is the account default""" - - name: Optional[str] = None - """The name of the DEX rule""" - - -class DEXTestUpdateResponse(BaseModel): - data: Data - """ - The configuration object which contains the details for the WARP client to - conduct the test. - """ - - enabled: bool - """Determines whether or not the test is active.""" - - interval: str - """How often the test will run.""" - - name: str - """The name of the DEX test. Must be unique.""" - - description: Optional[str] = None - """Additional details about the test.""" - - target_policies: Optional[List[TargetPolicy]] = None - """DEX rules targeted by this test""" - - targeted: Optional[bool] = None - - test_id: Optional[str] = None - """The unique identifier for the test.""" diff --git a/tests/api_resources/zero_trust/devices/test_dex_tests.py b/tests/api_resources/zero_trust/devices/test_dex_tests.py deleted file mode 100644 index 7198475bd..000000000 --- a/tests/api_resources/zero_trust/devices/test_dex_tests.py +++ /dev/null @@ -1,639 +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.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.zero_trust.devices import ( - DEXTestGetResponse, - DEXTestListResponse, - DEXTestCreateResponse, - DEXTestDeleteResponse, - DEXTestUpdateResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestDEXTests: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - dex_test = client.zero_trust.devices.dex_tests.create( - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - assert_matches_type(Optional[DEXTestCreateResponse], dex_test, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - dex_test = client.zero_trust.devices.dex_tests.create( - account_id="01a7362d577a6c3019a474fd6f485823", - data={ - "host": "https://dash.cloudflare.com", - "kind": "http", - "method": "GET", - }, - enabled=True, - interval="30m", - name="HTTP dash health check", - description="Checks the dash endpoint every 30 minutes", - target_policies=[ - { - "id": "id", - "default": True, - "name": "name", - } - ], - targeted=True, - ) - assert_matches_type(Optional[DEXTestCreateResponse], dex_test, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.zero_trust.devices.dex_tests.with_raw_response.create( - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = response.parse() - assert_matches_type(Optional[DEXTestCreateResponse], dex_test, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.zero_trust.devices.dex_tests.with_streaming_response.create( - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = response.parse() - assert_matches_type(Optional[DEXTestCreateResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.devices.dex_tests.with_raw_response.create( - account_id="", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - dex_test = client.zero_trust.devices.dex_tests.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - assert_matches_type(Optional[DEXTestUpdateResponse], dex_test, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - dex_test = client.zero_trust.devices.dex_tests.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - data={ - "host": "https://dash.cloudflare.com", - "kind": "http", - "method": "GET", - }, - enabled=True, - interval="30m", - name="HTTP dash health check", - description="Checks the dash endpoint every 30 minutes", - target_policies=[ - { - "id": "id", - "default": True, - "name": "name", - } - ], - targeted=True, - ) - assert_matches_type(Optional[DEXTestUpdateResponse], dex_test, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.zero_trust.devices.dex_tests.with_raw_response.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = response.parse() - assert_matches_type(Optional[DEXTestUpdateResponse], dex_test, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.zero_trust.devices.dex_tests.with_streaming_response.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = response.parse() - assert_matches_type(Optional[DEXTestUpdateResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.devices.dex_tests.with_raw_response.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `dex_test_id` but received ''"): - client.zero_trust.devices.dex_tests.with_raw_response.update( - dex_test_id="", - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - @parametrize - def test_method_list(self, client: Cloudflare) -> None: - dex_test = client.zero_trust.devices.dex_tests.list( - account_id="01a7362d577a6c3019a474fd6f485823", - ) - assert_matches_type(SyncSinglePage[DEXTestListResponse], dex_test, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.zero_trust.devices.dex_tests.with_raw_response.list( - account_id="01a7362d577a6c3019a474fd6f485823", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = response.parse() - assert_matches_type(SyncSinglePage[DEXTestListResponse], dex_test, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.zero_trust.devices.dex_tests.with_streaming_response.list( - account_id="01a7362d577a6c3019a474fd6f485823", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = response.parse() - assert_matches_type(SyncSinglePage[DEXTestListResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.devices.dex_tests.with_raw_response.list( - account_id="", - ) - - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - dex_test = client.zero_trust.devices.dex_tests.delete( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - assert_matches_type(Optional[DEXTestDeleteResponse], dex_test, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.zero_trust.devices.dex_tests.with_raw_response.delete( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = response.parse() - assert_matches_type(Optional[DEXTestDeleteResponse], dex_test, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.zero_trust.devices.dex_tests.with_streaming_response.delete( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = response.parse() - assert_matches_type(Optional[DEXTestDeleteResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.devices.dex_tests.with_raw_response.delete( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `dex_test_id` but received ''"): - client.zero_trust.devices.dex_tests.with_raw_response.delete( - dex_test_id="", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - dex_test = client.zero_trust.devices.dex_tests.get( - dex_test_id="372e67954025e0ba6aaa6d586b9e0b59", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - assert_matches_type(Optional[DEXTestGetResponse], dex_test, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zero_trust.devices.dex_tests.with_raw_response.get( - dex_test_id="372e67954025e0ba6aaa6d586b9e0b59", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = response.parse() - assert_matches_type(Optional[DEXTestGetResponse], dex_test, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zero_trust.devices.dex_tests.with_streaming_response.get( - dex_test_id="372e67954025e0ba6aaa6d586b9e0b59", - account_id="01a7362d577a6c3019a474fd6f485823", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = response.parse() - assert_matches_type(Optional[DEXTestGetResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.zero_trust.devices.dex_tests.with_raw_response.get( - dex_test_id="372e67954025e0ba6aaa6d586b9e0b59", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `dex_test_id` but received ''"): - client.zero_trust.devices.dex_tests.with_raw_response.get( - dex_test_id="", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - - -class TestAsyncDEXTests: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - dex_test = await async_client.zero_trust.devices.dex_tests.create( - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - assert_matches_type(Optional[DEXTestCreateResponse], dex_test, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - dex_test = await async_client.zero_trust.devices.dex_tests.create( - account_id="01a7362d577a6c3019a474fd6f485823", - data={ - "host": "https://dash.cloudflare.com", - "kind": "http", - "method": "GET", - }, - enabled=True, - interval="30m", - name="HTTP dash health check", - description="Checks the dash endpoint every 30 minutes", - target_policies=[ - { - "id": "id", - "default": True, - "name": "name", - } - ], - targeted=True, - ) - assert_matches_type(Optional[DEXTestCreateResponse], dex_test, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.devices.dex_tests.with_raw_response.create( - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = await response.parse() - assert_matches_type(Optional[DEXTestCreateResponse], dex_test, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.devices.dex_tests.with_streaming_response.create( - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = await response.parse() - assert_matches_type(Optional[DEXTestCreateResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.devices.dex_tests.with_raw_response.create( - account_id="", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - dex_test = await async_client.zero_trust.devices.dex_tests.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - assert_matches_type(Optional[DEXTestUpdateResponse], dex_test, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - dex_test = await async_client.zero_trust.devices.dex_tests.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - data={ - "host": "https://dash.cloudflare.com", - "kind": "http", - "method": "GET", - }, - enabled=True, - interval="30m", - name="HTTP dash health check", - description="Checks the dash endpoint every 30 minutes", - target_policies=[ - { - "id": "id", - "default": True, - "name": "name", - } - ], - targeted=True, - ) - assert_matches_type(Optional[DEXTestUpdateResponse], dex_test, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.devices.dex_tests.with_raw_response.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = await response.parse() - assert_matches_type(Optional[DEXTestUpdateResponse], dex_test, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.devices.dex_tests.with_streaming_response.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = await response.parse() - assert_matches_type(Optional[DEXTestUpdateResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.devices.dex_tests.with_raw_response.update( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `dex_test_id` but received ''"): - await async_client.zero_trust.devices.dex_tests.with_raw_response.update( - dex_test_id="", - account_id="01a7362d577a6c3019a474fd6f485823", - data={}, - enabled=True, - interval="30m", - name="HTTP dash health check", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncCloudflare) -> None: - dex_test = await async_client.zero_trust.devices.dex_tests.list( - account_id="01a7362d577a6c3019a474fd6f485823", - ) - assert_matches_type(AsyncSinglePage[DEXTestListResponse], dex_test, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.devices.dex_tests.with_raw_response.list( - account_id="01a7362d577a6c3019a474fd6f485823", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = await response.parse() - assert_matches_type(AsyncSinglePage[DEXTestListResponse], dex_test, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.devices.dex_tests.with_streaming_response.list( - account_id="01a7362d577a6c3019a474fd6f485823", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = await response.parse() - assert_matches_type(AsyncSinglePage[DEXTestListResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.devices.dex_tests.with_raw_response.list( - account_id="", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - dex_test = await async_client.zero_trust.devices.dex_tests.delete( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - assert_matches_type(Optional[DEXTestDeleteResponse], dex_test, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.devices.dex_tests.with_raw_response.delete( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = await response.parse() - assert_matches_type(Optional[DEXTestDeleteResponse], dex_test, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.devices.dex_tests.with_streaming_response.delete( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="01a7362d577a6c3019a474fd6f485823", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = await response.parse() - assert_matches_type(Optional[DEXTestDeleteResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.devices.dex_tests.with_raw_response.delete( - dex_test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `dex_test_id` but received ''"): - await async_client.zero_trust.devices.dex_tests.with_raw_response.delete( - dex_test_id="", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - dex_test = await async_client.zero_trust.devices.dex_tests.get( - dex_test_id="372e67954025e0ba6aaa6d586b9e0b59", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - assert_matches_type(Optional[DEXTestGetResponse], dex_test, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zero_trust.devices.dex_tests.with_raw_response.get( - dex_test_id="372e67954025e0ba6aaa6d586b9e0b59", - account_id="01a7362d577a6c3019a474fd6f485823", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dex_test = await response.parse() - assert_matches_type(Optional[DEXTestGetResponse], dex_test, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zero_trust.devices.dex_tests.with_streaming_response.get( - dex_test_id="372e67954025e0ba6aaa6d586b9e0b59", - account_id="01a7362d577a6c3019a474fd6f485823", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dex_test = await response.parse() - assert_matches_type(Optional[DEXTestGetResponse], dex_test, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.zero_trust.devices.dex_tests.with_raw_response.get( - dex_test_id="372e67954025e0ba6aaa6d586b9e0b59", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `dex_test_id` but received ''"): - await async_client.zero_trust.devices.dex_tests.with_raw_response.get( - dex_test_id="", - account_id="01a7362d577a6c3019a474fd6f485823", - )