feat(dex): map endpoints into namespaces

This commit is contained in:
stainless-app[bot] 2025-05-23 02:47:44 +00:00
parent 19c43b9f32
commit 89cf966cf7
23 changed files with 2586 additions and 3 deletions

View file

@ -1,4 +1,4 @@
configured_endpoints: 1734
configured_endpoints: 1741
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-fb111a0086c40e2051f762a27180c017d30a7e71f13b5a883f6109c205e53603.yml
openapi_spec_hash: de05b9c2b538d5175ca561373016af91
config_hash: 79edb087a15ab7daa5cb062a88889242
config_hash: d72c4fd125f1a13d55b0929439ad8189

31
api.md
View file

@ -5329,9 +5329,25 @@ Methods:
Types:
```python
from cloudflare.types.zero_trust.devices import SchemaData, SchemaHTTP
from cloudflare.types.zero_trust.devices import (
SchemaData,
SchemaHTTP,
DEXTestCreateResponse,
DEXTestUpdateResponse,
DEXTestListResponse,
DEXTestDeleteResponse,
DEXTestGetResponse,
)
```
Methods:
- <code title="post /accounts/{account_id}/dex/devices/dex_tests">client.zero_trust.devices.dex_tests.<a href="./src/cloudflare/resources/zero_trust/devices/dex_tests.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/devices/dex_test_create_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/devices/dex_test_create_response.py">Optional[DEXTestCreateResponse]</a></code>
- <code title="put /accounts/{account_id}/dex/devices/dex_tests/{dex_test_id}">client.zero_trust.devices.dex_tests.<a href="./src/cloudflare/resources/zero_trust/devices/dex_tests.py">update</a>(dex_test_id, \*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/devices/dex_test_update_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/devices/dex_test_update_response.py">Optional[DEXTestUpdateResponse]</a></code>
- <code title="get /accounts/{account_id}/dex/devices/dex_tests">client.zero_trust.devices.dex_tests.<a href="./src/cloudflare/resources/zero_trust/devices/dex_tests.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/devices/dex_test_list_response.py">SyncSinglePage[DEXTestListResponse]</a></code>
- <code title="delete /accounts/{account_id}/dex/devices/dex_tests/{dex_test_id}">client.zero_trust.devices.dex_tests.<a href="./src/cloudflare/resources/zero_trust/devices/dex_tests.py">delete</a>(dex_test_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/devices/dex_test_delete_response.py">Optional[DEXTestDeleteResponse]</a></code>
- <code title="get /accounts/{account_id}/dex/devices/dex_tests/{dex_test_id}">client.zero_trust.devices.dex_tests.<a href="./src/cloudflare/resources/zero_trust/devices/dex_tests.py">get</a>(dex_test_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/devices/dex_test_get_response.py">Optional[DEXTestGetResponse]</a></code>
### Networks
Types:
@ -5522,6 +5538,7 @@ from cloudflare.types.zero_trust.devices import DeviceSettings
Methods:
- <code title="put /accounts/{account_id}/devices/settings">client.zero_trust.devices.settings.<a href="./src/cloudflare/resources/zero_trust/devices/settings.py">update</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/devices/setting_update_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/devices/device_settings.py">Optional[DeviceSettings]</a></code>
- <code title="delete /accounts/{account_id}/devices/settings">client.zero_trust.devices.settings.<a href="./src/cloudflare/resources/zero_trust/devices/settings.py">delete</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/devices/device_settings.py">Optional[DeviceSettings]</a></code>
- <code title="patch /accounts/{account_id}/devices/settings">client.zero_trust.devices.settings.<a href="./src/cloudflare/resources/zero_trust/devices/settings.py">edit</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/devices/setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/devices/device_settings.py">Optional[DeviceSettings]</a></code>
- <code title="get /accounts/{account_id}/devices/settings">client.zero_trust.devices.settings.<a href="./src/cloudflare/resources/zero_trust/devices/settings.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/zero_trust/devices/device_settings.py">Optional[DeviceSettings]</a></code>
@ -6100,6 +6117,18 @@ from cloudflare.types.zero_trust import (
)
```
### WARPChangeEvents
Types:
```python
from cloudflare.types.zero_trust.dex import WARPChangeEventGetResponse
```
Methods:
- <code title="get /accounts/{account_id}/dex/warp-change-events">client.zero_trust.dex.warp_change_events.<a href="./src/cloudflare/resources/zero_trust/dex/warp_change_events.py">get</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/dex/warp_change_event_get_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/dex/warp_change_event_get_response.py">Optional[WARPChangeEventGetResponse]</a></code>
### Commands
Types:

View file

@ -56,6 +56,14 @@ from .unrevoke import (
UnrevokeResourceWithStreamingResponse,
AsyncUnrevokeResourceWithStreamingResponse,
)
from .dex_tests import (
DEXTestsResource,
AsyncDEXTestsResource,
DEXTestsResourceWithRawResponse,
AsyncDEXTestsResourceWithRawResponse,
DEXTestsResourceWithStreamingResponse,
AsyncDEXTestsResourceWithStreamingResponse,
)
from .resilience import (
ResilienceResource,
AsyncResilienceResource,
@ -102,6 +110,12 @@ __all__ = [
"AsyncRegistrationsResourceWithRawResponse",
"RegistrationsResourceWithStreamingResponse",
"AsyncRegistrationsResourceWithStreamingResponse",
"DEXTestsResource",
"AsyncDEXTestsResource",
"DEXTestsResourceWithRawResponse",
"AsyncDEXTestsResourceWithRawResponse",
"DEXTestsResourceWithStreamingResponse",
"AsyncDEXTestsResourceWithStreamingResponse",
"NetworksResource",
"AsyncNetworksResource",
"NetworksResourceWithRawResponse",

View file

@ -40,6 +40,14 @@ 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 (
@ -118,6 +126,10 @@ 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)
@ -270,6 +282,10 @@ 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)
@ -432,6 +448,10 @@ 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)
@ -488,6 +508,10 @@ 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)
@ -544,6 +568,10 @@ 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)
@ -600,6 +628,10 @@ 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)

View file

@ -0,0 +1,681 @@
# 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}/dex/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}/dex/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}/dex/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}/dex/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}/dex/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}/dex/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}/dex/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}/dex/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}/dex/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}/dex/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,
)

View file

@ -107,6 +107,43 @@ class SettingsResource(SyncAPIResource):
cast_to=cast(Type[Optional[DeviceSettings]], ResultWrapper[DeviceSettings]),
)
def delete(
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,
) -> Optional[DeviceSettings]:
"""
Resets the current device settings for a Zero Trust account.
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._delete(
f"/accounts/{account_id}/devices/settings",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[DeviceSettings]]._unwrapper,
),
cast_to=cast(Type[Optional[DeviceSettings]], ResultWrapper[DeviceSettings]),
)
def edit(
self,
*,
@ -291,6 +328,43 @@ class AsyncSettingsResource(AsyncAPIResource):
cast_to=cast(Type[Optional[DeviceSettings]], ResultWrapper[DeviceSettings]),
)
async def delete(
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,
) -> Optional[DeviceSettings]:
"""
Resets the current device settings for a Zero Trust account.
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 await self._delete(
f"/accounts/{account_id}/devices/settings",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[DeviceSettings]]._unwrapper,
),
cast_to=cast(Type[Optional[DeviceSettings]], ResultWrapper[DeviceSettings]),
)
async def edit(
self,
*,
@ -399,6 +473,9 @@ class SettingsResourceWithRawResponse:
self.update = to_raw_response_wrapper(
settings.update,
)
self.delete = to_raw_response_wrapper(
settings.delete,
)
self.edit = to_raw_response_wrapper(
settings.edit,
)
@ -414,6 +491,9 @@ class AsyncSettingsResourceWithRawResponse:
self.update = async_to_raw_response_wrapper(
settings.update,
)
self.delete = async_to_raw_response_wrapper(
settings.delete,
)
self.edit = async_to_raw_response_wrapper(
settings.edit,
)
@ -429,6 +509,9 @@ class SettingsResourceWithStreamingResponse:
self.update = to_streamed_response_wrapper(
settings.update,
)
self.delete = to_streamed_response_wrapper(
settings.delete,
)
self.edit = to_streamed_response_wrapper(
settings.edit,
)
@ -444,6 +527,9 @@ class AsyncSettingsResourceWithStreamingResponse:
self.update = async_to_streamed_response_wrapper(
settings.update,
)
self.delete = async_to_streamed_response_wrapper(
settings.delete,
)
self.edit = async_to_streamed_response_wrapper(
settings.edit,
)

View file

@ -56,6 +56,14 @@ from .traceroute_tests import (
TracerouteTestsResourceWithStreamingResponse,
AsyncTracerouteTestsResourceWithStreamingResponse,
)
from .warp_change_events import (
WARPChangeEventsResource,
AsyncWARPChangeEventsResource,
WARPChangeEventsResourceWithRawResponse,
AsyncWARPChangeEventsResourceWithRawResponse,
WARPChangeEventsResourceWithStreamingResponse,
AsyncWARPChangeEventsResourceWithStreamingResponse,
)
from .traceroute_test_results import (
TracerouteTestResultsResource,
AsyncTracerouteTestResultsResource,
@ -66,6 +74,12 @@ from .traceroute_test_results import (
)
__all__ = [
"WARPChangeEventsResource",
"AsyncWARPChangeEventsResource",
"WARPChangeEventsResourceWithRawResponse",
"AsyncWARPChangeEventsResourceWithRawResponse",
"WARPChangeEventsResourceWithStreamingResponse",
"AsyncWARPChangeEventsResourceWithStreamingResponse",
"CommandsResource",
"AsyncCommandsResource",
"CommandsResourceWithRawResponse",

View file

@ -36,6 +36,14 @@ from .commands.commands import (
CommandsResourceWithStreamingResponse,
AsyncCommandsResourceWithStreamingResponse,
)
from .warp_change_events import (
WARPChangeEventsResource,
AsyncWARPChangeEventsResource,
WARPChangeEventsResourceWithRawResponse,
AsyncWARPChangeEventsResourceWithRawResponse,
WARPChangeEventsResourceWithStreamingResponse,
AsyncWARPChangeEventsResourceWithStreamingResponse,
)
from .http_tests.http_tests import (
HTTPTestsResource,
AsyncHTTPTestsResource,
@ -65,6 +73,10 @@ __all__ = ["DEXResource", "AsyncDEXResource"]
class DEXResource(SyncAPIResource):
@cached_property
def warp_change_events(self) -> WARPChangeEventsResource:
return WARPChangeEventsResource(self._client)
@cached_property
def commands(self) -> CommandsResource:
return CommandsResource(self._client)
@ -114,6 +126,10 @@ class DEXResource(SyncAPIResource):
class AsyncDEXResource(AsyncAPIResource):
@cached_property
def warp_change_events(self) -> AsyncWARPChangeEventsResource:
return AsyncWARPChangeEventsResource(self._client)
@cached_property
def commands(self) -> AsyncCommandsResource:
return AsyncCommandsResource(self._client)
@ -166,6 +182,10 @@ class DEXResourceWithRawResponse:
def __init__(self, dex: DEXResource) -> None:
self._dex = dex
@cached_property
def warp_change_events(self) -> WARPChangeEventsResourceWithRawResponse:
return WARPChangeEventsResourceWithRawResponse(self._dex.warp_change_events)
@cached_property
def commands(self) -> CommandsResourceWithRawResponse:
return CommandsResourceWithRawResponse(self._dex.commands)
@ -199,6 +219,10 @@ class AsyncDEXResourceWithRawResponse:
def __init__(self, dex: AsyncDEXResource) -> None:
self._dex = dex
@cached_property
def warp_change_events(self) -> AsyncWARPChangeEventsResourceWithRawResponse:
return AsyncWARPChangeEventsResourceWithRawResponse(self._dex.warp_change_events)
@cached_property
def commands(self) -> AsyncCommandsResourceWithRawResponse:
return AsyncCommandsResourceWithRawResponse(self._dex.commands)
@ -232,6 +256,10 @@ class DEXResourceWithStreamingResponse:
def __init__(self, dex: DEXResource) -> None:
self._dex = dex
@cached_property
def warp_change_events(self) -> WARPChangeEventsResourceWithStreamingResponse:
return WARPChangeEventsResourceWithStreamingResponse(self._dex.warp_change_events)
@cached_property
def commands(self) -> CommandsResourceWithStreamingResponse:
return CommandsResourceWithStreamingResponse(self._dex.commands)
@ -265,6 +293,10 @@ class AsyncDEXResourceWithStreamingResponse:
def __init__(self, dex: AsyncDEXResource) -> None:
self._dex = dex
@cached_property
def warp_change_events(self) -> AsyncWARPChangeEventsResourceWithStreamingResponse:
return AsyncWARPChangeEventsResourceWithStreamingResponse(self._dex.warp_change_events)
@cached_property
def commands(self) -> AsyncCommandsResourceWithStreamingResponse:
return AsyncCommandsResourceWithStreamingResponse(self._dex.commands)

View file

@ -0,0 +1,261 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing import Type, Optional, cast
from typing_extensions import Literal
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 ...._base_client import make_request_options
from ....types.zero_trust.dex import warp_change_event_get_params
from ....types.zero_trust.dex.warp_change_event_get_response import WARPChangeEventGetResponse
__all__ = ["WARPChangeEventsResource", "AsyncWARPChangeEventsResource"]
class WARPChangeEventsResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> WARPChangeEventsResourceWithRawResponse:
"""
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 WARPChangeEventsResourceWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> WARPChangeEventsResourceWithStreamingResponse:
"""
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 WARPChangeEventsResourceWithStreamingResponse(self)
def get(
self,
*,
account_id: str,
from_: str,
page: float,
per_page: float,
to: str,
account_name: str | NotGiven = NOT_GIVEN,
config_name: str | NotGiven = NOT_GIVEN,
sort_order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN,
toggle: Literal["on", "off"] | NotGiven = NOT_GIVEN,
type: Literal["config", "toggle"] | 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[WARPChangeEventGetResponse]:
"""
List WARP configuration and enablement toggle change events by device.
Args:
from_: Start time for the query in ISO (RFC3339 - ISO 8601) format
page: Page number of paginated results
per_page: Number of items per page
to: End time for the query in ISO (RFC3339 - ISO 8601) format
account_name: Filter events by account name.
config_name: Filter events by WARP configuration name changed from or to. Applicable to
type='config' events only.
sort_order: Sort response by event timestamp.
toggle: Filter events by type toggle value. Applicable to type='toggle' events only.
type: Filter events by type 'config' or 'toggle'
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(
f"/accounts/{account_id}/dex/warp-change-events",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"from_": from_,
"page": page,
"per_page": per_page,
"to": to,
"account_name": account_name,
"config_name": config_name,
"sort_order": sort_order,
"toggle": toggle,
"type": type,
},
warp_change_event_get_params.WARPChangeEventGetParams,
),
post_parser=ResultWrapper[Optional[WARPChangeEventGetResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[WARPChangeEventGetResponse]], ResultWrapper[WARPChangeEventGetResponse]),
)
class AsyncWARPChangeEventsResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncWARPChangeEventsResourceWithRawResponse:
"""
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 AsyncWARPChangeEventsResourceWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> AsyncWARPChangeEventsResourceWithStreamingResponse:
"""
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 AsyncWARPChangeEventsResourceWithStreamingResponse(self)
async def get(
self,
*,
account_id: str,
from_: str,
page: float,
per_page: float,
to: str,
account_name: str | NotGiven = NOT_GIVEN,
config_name: str | NotGiven = NOT_GIVEN,
sort_order: Literal["ASC", "DESC"] | NotGiven = NOT_GIVEN,
toggle: Literal["on", "off"] | NotGiven = NOT_GIVEN,
type: Literal["config", "toggle"] | 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[WARPChangeEventGetResponse]:
"""
List WARP configuration and enablement toggle change events by device.
Args:
from_: Start time for the query in ISO (RFC3339 - ISO 8601) format
page: Page number of paginated results
per_page: Number of items per page
to: End time for the query in ISO (RFC3339 - ISO 8601) format
account_name: Filter events by account name.
config_name: Filter events by WARP configuration name changed from or to. Applicable to
type='config' events only.
sort_order: Sort response by event timestamp.
toggle: Filter events by type toggle value. Applicable to type='toggle' events only.
type: Filter events by type 'config' or 'toggle'
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._get(
f"/accounts/{account_id}/dex/warp-change-events",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{
"from_": from_,
"page": page,
"per_page": per_page,
"to": to,
"account_name": account_name,
"config_name": config_name,
"sort_order": sort_order,
"toggle": toggle,
"type": type,
},
warp_change_event_get_params.WARPChangeEventGetParams,
),
post_parser=ResultWrapper[Optional[WARPChangeEventGetResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[WARPChangeEventGetResponse]], ResultWrapper[WARPChangeEventGetResponse]),
)
class WARPChangeEventsResourceWithRawResponse:
def __init__(self, warp_change_events: WARPChangeEventsResource) -> None:
self._warp_change_events = warp_change_events
self.get = to_raw_response_wrapper(
warp_change_events.get,
)
class AsyncWARPChangeEventsResourceWithRawResponse:
def __init__(self, warp_change_events: AsyncWARPChangeEventsResource) -> None:
self._warp_change_events = warp_change_events
self.get = async_to_raw_response_wrapper(
warp_change_events.get,
)
class WARPChangeEventsResourceWithStreamingResponse:
def __init__(self, warp_change_events: WARPChangeEventsResource) -> None:
self._warp_change_events = warp_change_events
self.get = to_streamed_response_wrapper(
warp_change_events.get,
)
class AsyncWARPChangeEventsResourceWithStreamingResponse:
def __init__(self, warp_change_events: AsyncWARPChangeEventsResource) -> None:
self._warp_change_events = warp_change_events
self.get = async_to_streamed_response_wrapper(
warp_change_events.get,
)

View file

@ -34,6 +34,7 @@ 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
@ -42,6 +43,9 @@ 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
@ -51,6 +55,9 @@ 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

View file

@ -0,0 +1,57 @@
# 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"""

View file

@ -0,0 +1,57 @@
# 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."""

View file

@ -0,0 +1,61 @@
# 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

View file

@ -0,0 +1,57 @@
# 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."""

View file

@ -0,0 +1,57 @@
# 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."""

View file

@ -0,0 +1,57 @@
# 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"""

View file

@ -0,0 +1,57 @@
# 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."""

View file

@ -17,7 +17,9 @@ from .command_create_response import CommandCreateResponse as CommandCreateRespo
from .fleet_status_live_params import FleetStatusLiveParams as FleetStatusLiveParams
from .fleet_status_live_response import FleetStatusLiveResponse as FleetStatusLiveResponse
from .traceroute_test_get_params import TracerouteTestGetParams as TracerouteTestGetParams
from .warp_change_event_get_params import WARPChangeEventGetParams as WARPChangeEventGetParams
from .fleet_status_over_time_params import FleetStatusOverTimeParams as FleetStatusOverTimeParams
from .warp_change_event_get_response import WARPChangeEventGetResponse as WARPChangeEventGetResponse
from .traceroute_test_percentiles_params import TracerouteTestPercentilesParams as TracerouteTestPercentilesParams
from .traceroute_test_network_path_params import TracerouteTestNetworkPathParams as TracerouteTestNetworkPathParams
from .traceroute_test_percentiles_response import TracerouteTestPercentilesResponse as TracerouteTestPercentilesResponse

View file

@ -0,0 +1,43 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing_extensions import Literal, Required, Annotated, TypedDict
from ...._utils import PropertyInfo
__all__ = ["WARPChangeEventGetParams"]
class WARPChangeEventGetParams(TypedDict, total=False):
account_id: Required[str]
from_: Required[Annotated[str, PropertyInfo(alias="from")]]
"""Start time for the query in ISO (RFC3339 - ISO 8601) format"""
page: Required[float]
"""Page number of paginated results"""
per_page: Required[float]
"""Number of items per page"""
to: Required[str]
"""End time for the query in ISO (RFC3339 - ISO 8601) format"""
account_name: str
"""Filter events by account name."""
config_name: str
"""Filter events by WARP configuration name changed from or to.
Applicable to type='config' events only.
"""
sort_order: Literal["ASC", "DESC"]
"""Sort response by event timestamp."""
toggle: Literal["on", "off"]
"""Filter events by type toggle value. Applicable to type='toggle' events only."""
type: Literal["config", "toggle"]
"""Filter events by type 'config' or 'toggle'"""

View file

@ -0,0 +1,102 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import List, Union, Optional
from typing_extensions import Literal, TypeAlias
from pydantic import Field as FieldInfo
from ...._models import BaseModel
__all__ = [
"WARPChangeEventGetResponse",
"WARPChangeEventGetResponseItem",
"WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPToggleChangeEvent",
"WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEvent",
"WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventFrom",
"WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventTo",
]
class WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPToggleChangeEvent(BaseModel):
account_name: Optional[str] = None
"""The account name."""
account_tag: Optional[str] = None
"""The public account identifier."""
device_id: Optional[str] = None
"""API Resource UUID tag."""
device_registration: Optional[str] = None
"""API Resource UUID tag."""
hostname: Optional[str] = None
"""The hostname of the machine the event is from"""
serial_number: Optional[str] = None
"""The serial number of the machine the event is from"""
timestamp: Optional[str] = None
"""Timestamp in ISO format"""
toggle: Optional[Literal["on", "off"]] = None
"""The state of the WARP toggle."""
user_email: Optional[str] = None
"""Email tied to the device"""
class WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventFrom(BaseModel):
account_name: Optional[str] = None
"""The account name."""
account_tag: Optional[str] = None
"""API Resource UUID tag."""
config_name: Optional[str] = None
"""The name of the WARP configuration."""
class WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventTo(BaseModel):
account_name: Optional[str] = None
"""The account name."""
account_tag: Optional[str] = None
"""API Resource UUID tag."""
config_name: Optional[str] = None
"""The name of the WARP configuration."""
class WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEvent(BaseModel):
device_id: Optional[str] = None
"""API Resource UUID tag."""
device_registration: Optional[str] = None
"""API Resource UUID tag."""
from_: Optional[WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventFrom] = FieldInfo(
alias="from", default=None
)
hostname: Optional[str] = None
"""The hostname of the machine the event is from"""
serial_number: Optional[str] = None
"""The serial number of the machine the event is from"""
timestamp: Optional[str] = None
"""Timestamp in ISO format"""
to: Optional[WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventTo] = None
user_email: Optional[str] = None
"""Email tied to the device"""
WARPChangeEventGetResponseItem: TypeAlias = Union[
WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPToggleChangeEvent,
WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEvent,
]
WARPChangeEventGetResponse: TypeAlias = List[WARPChangeEventGetResponseItem]

View file

@ -0,0 +1,639 @@
# 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",
)

View file

@ -67,6 +67,44 @@ class TestSettings:
account_id="",
)
@parametrize
def test_method_delete(self, client: Cloudflare) -> None:
setting = client.zero_trust.devices.settings.delete(
account_id="699d98642c564d2e855e9661899b7252",
)
assert_matches_type(Optional[DeviceSettings], setting, path=["response"])
@parametrize
def test_raw_response_delete(self, client: Cloudflare) -> None:
response = client.zero_trust.devices.settings.with_raw_response.delete(
account_id="699d98642c564d2e855e9661899b7252",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = response.parse()
assert_matches_type(Optional[DeviceSettings], setting, path=["response"])
@parametrize
def test_streaming_response_delete(self, client: Cloudflare) -> None:
with client.zero_trust.devices.settings.with_streaming_response.delete(
account_id="699d98642c564d2e855e9661899b7252",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = response.parse()
assert_matches_type(Optional[DeviceSettings], setting, 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.settings.with_raw_response.delete(
account_id="",
)
@parametrize
def test_method_edit(self, client: Cloudflare) -> None:
setting = client.zero_trust.devices.settings.edit(
@ -209,6 +247,44 @@ class TestAsyncSettings:
account_id="",
)
@parametrize
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
setting = await async_client.zero_trust.devices.settings.delete(
account_id="699d98642c564d2e855e9661899b7252",
)
assert_matches_type(Optional[DeviceSettings], setting, path=["response"])
@parametrize
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
response = await async_client.zero_trust.devices.settings.with_raw_response.delete(
account_id="699d98642c564d2e855e9661899b7252",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = await response.parse()
assert_matches_type(Optional[DeviceSettings], setting, path=["response"])
@parametrize
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
async with async_client.zero_trust.devices.settings.with_streaming_response.delete(
account_id="699d98642c564d2e855e9661899b7252",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
setting = await response.parse()
assert_matches_type(Optional[DeviceSettings], setting, 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.settings.with_raw_response.delete(
account_id="",
)
@parametrize
async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
setting = await async_client.zero_trust.devices.settings.edit(

View file

@ -0,0 +1,162 @@
# 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.zero_trust.dex import WARPChangeEventGetResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
class TestWARPChangeEvents:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
def test_method_get(self, client: Cloudflare) -> None:
warp_change_event = client.zero_trust.dex.warp_change_events.get(
account_id="01a7362d577a6c3019a474fd6f485823",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
)
assert_matches_type(Optional[WARPChangeEventGetResponse], warp_change_event, path=["response"])
@parametrize
def test_method_get_with_all_params(self, client: Cloudflare) -> None:
warp_change_event = client.zero_trust.dex.warp_change_events.get(
account_id="01a7362d577a6c3019a474fd6f485823",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
account_name="Myorg",
config_name="MASQUE",
sort_order="ASC",
toggle="on",
type="config",
)
assert_matches_type(Optional[WARPChangeEventGetResponse], warp_change_event, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
response = client.zero_trust.dex.warp_change_events.with_raw_response.get(
account_id="01a7362d577a6c3019a474fd6f485823",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
warp_change_event = response.parse()
assert_matches_type(Optional[WARPChangeEventGetResponse], warp_change_event, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
with client.zero_trust.dex.warp_change_events.with_streaming_response.get(
account_id="01a7362d577a6c3019a474fd6f485823",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
warp_change_event = response.parse()
assert_matches_type(Optional[WARPChangeEventGetResponse], warp_change_event, 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.dex.warp_change_events.with_raw_response.get(
account_id="",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
)
class TestAsyncWARPChangeEvents:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
warp_change_event = await async_client.zero_trust.dex.warp_change_events.get(
account_id="01a7362d577a6c3019a474fd6f485823",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
)
assert_matches_type(Optional[WARPChangeEventGetResponse], warp_change_event, path=["response"])
@parametrize
async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None:
warp_change_event = await async_client.zero_trust.dex.warp_change_events.get(
account_id="01a7362d577a6c3019a474fd6f485823",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
account_name="Myorg",
config_name="MASQUE",
sort_order="ASC",
toggle="on",
type="config",
)
assert_matches_type(Optional[WARPChangeEventGetResponse], warp_change_event, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
response = await async_client.zero_trust.dex.warp_change_events.with_raw_response.get(
account_id="01a7362d577a6c3019a474fd6f485823",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
warp_change_event = await response.parse()
assert_matches_type(Optional[WARPChangeEventGetResponse], warp_change_event, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
async with async_client.zero_trust.dex.warp_change_events.with_streaming_response.get(
account_id="01a7362d577a6c3019a474fd6f485823",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
warp_change_event = await response.parse()
assert_matches_type(Optional[WARPChangeEventGetResponse], warp_change_event, 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.dex.warp_change_events.with_raw_response.get(
account_id="",
from_="2023-09-20T17:00:00Z",
page=1,
per_page=1,
to="2023-09-20T17:00:00Z",
)