From b6008f288434b60852c589aa55f511b132687ed6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 02:14:43 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#289) --- api.md | 27 ++-- src/cloudflare/_client.py | 16 +-- src/cloudflare/resources/__init__.py | 24 ++-- src/cloudflare/resources/warp_connector.py | 108 ++++++++-------- .../resources/zero_trust/tunnels/tunnels.py | 27 ++-- src/cloudflare/types/__init__.py | 6 +- .../types/warp_connector_create_response.py | 119 ++++++++++++++++++ .../types/warp_connector_delete_response.py | 119 ++++++++++++++++++ .../types/warp_connector_edit_response.py | 119 ++++++++++++++++++ ...ctor.py => warp_connector_get_response.py} | 4 +- .../types/warp_connector_list_response.py | 119 ++++++++++++++++++ src/cloudflare/types/zero_trust/__init__.py | 2 + .../types/zero_trust/tunnel_edit_response.py | 119 ++++++++++++++++++ .../types/zero_trust/tunnel_list_response.py | 119 ++++++++++++++++++ tests/api_resources/test_warp_connector.py | 76 +++++------ .../api_resources/zero_trust/test_tunnels.py | 35 +++--- 16 files changed, 891 insertions(+), 148 deletions(-) create mode 100644 src/cloudflare/types/warp_connector_create_response.py create mode 100644 src/cloudflare/types/warp_connector_delete_response.py create mode 100644 src/cloudflare/types/warp_connector_edit_response.py rename src/cloudflare/types/{warp_connector.py => warp_connector_get_response.py} (95%) create mode 100644 src/cloudflare/types/warp_connector_list_response.py create mode 100644 src/cloudflare/types/zero_trust/tunnel_edit_response.py create mode 100644 src/cloudflare/types/zero_trust/tunnel_list_response.py diff --git a/api.md b/api.md index df675871040..d924e3c3b1b 100644 --- a/api.md +++ b/api.md @@ -4619,21 +4619,28 @@ Methods: - client.r2.sippy.delete(bucket_name, \*, account_id) -> SippyDeleteResponse - client.r2.sippy.get(bucket_name, \*, account_id) -> Sippy -# WARPConnectorResource +# WARPConnector Types: ```python -from cloudflare.types import WARPConnector, WARPConnectorTokenResponse +from cloudflare.types import ( + WARPConnectorCreateResponse, + WARPConnectorListResponse, + WARPConnectorDeleteResponse, + WARPConnectorEditResponse, + WARPConnectorGetResponse, + WARPConnectorTokenResponse, +) ``` Methods: -- client.warp_connector.create(\*, account_id, \*\*params) -> WARPConnector -- client.warp_connector.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WARPConnector] -- client.warp_connector.delete(tunnel_id, \*, account_id, \*\*params) -> WARPConnector -- client.warp_connector.edit(tunnel_id, \*, account_id, \*\*params) -> WARPConnector -- client.warp_connector.get(tunnel_id, \*, account_id) -> WARPConnector +- client.warp_connector.create(\*, account_id, \*\*params) -> WARPConnectorCreateResponse +- client.warp_connector.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WARPConnectorListResponse] +- client.warp_connector.delete(tunnel_id, \*, account_id, \*\*params) -> WARPConnectorDeleteResponse +- client.warp_connector.edit(tunnel_id, \*, account_id, \*\*params) -> WARPConnectorEditResponse +- client.warp_connector.get(tunnel_id, \*, account_id) -> WARPConnectorGetResponse - client.warp_connector.token(tunnel_id, \*, account_id) -> WARPConnectorTokenResponse # WorkersForPlatforms @@ -5430,15 +5437,15 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import Connection, Tunnel, WARPConnectorTunnel +from cloudflare.types.zero_trust import Connection, Tunnel, TunnelListResponse, TunnelEditResponse ``` Methods: - client.zero_trust.tunnels.create(\*, account_id, \*\*params) -> Tunnel -- client.zero_trust.tunnels.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WARPConnector] +- client.zero_trust.tunnels.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[TunnelListResponse] - client.zero_trust.tunnels.delete(tunnel_id, \*, account_id, \*\*params) -> Tunnel -- client.zero_trust.tunnels.edit(tunnel_id, \*, account_id, \*\*params) -> WARPConnector +- client.zero_trust.tunnels.edit(tunnel_id, \*, account_id, \*\*params) -> TunnelEditResponse - client.zero_trust.tunnels.get(tunnel_id, \*, account_id) -> Tunnel ### Configurations diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index d85574035e0..000dc7fe45a 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -110,7 +110,7 @@ class Cloudflare(SyncAPIClient): alerting: resources.Alerting d1: resources.D1Resource r2: resources.R2 - warp_connector: resources.WARPConnectorResource + warp_connector: resources.WARPConnector workers_for_platforms: resources.WorkersForPlatforms zero_trust: resources.ZeroTrust challenges: resources.Challenges @@ -265,7 +265,7 @@ def __init__( self.alerting = resources.Alerting(self) self.d1 = resources.D1Resource(self) self.r2 = resources.R2(self) - self.warp_connector = resources.WARPConnectorResource(self) + self.warp_connector = resources.WARPConnector(self) self.workers_for_platforms = resources.WorkersForPlatforms(self) self.zero_trust = resources.ZeroTrust(self) self.challenges = resources.Challenges(self) @@ -523,7 +523,7 @@ class AsyncCloudflare(AsyncAPIClient): alerting: resources.AsyncAlerting d1: resources.AsyncD1Resource r2: resources.AsyncR2 - warp_connector: resources.AsyncWARPConnectorResource + warp_connector: resources.AsyncWARPConnector workers_for_platforms: resources.AsyncWorkersForPlatforms zero_trust: resources.AsyncZeroTrust challenges: resources.AsyncChallenges @@ -678,7 +678,7 @@ def __init__( self.alerting = resources.AsyncAlerting(self) self.d1 = resources.AsyncD1Resource(self) self.r2 = resources.AsyncR2(self) - self.warp_connector = resources.AsyncWARPConnectorResource(self) + self.warp_connector = resources.AsyncWARPConnector(self) self.workers_for_platforms = resources.AsyncWorkersForPlatforms(self) self.zero_trust = resources.AsyncZeroTrust(self) self.challenges = resources.AsyncChallenges(self) @@ -937,7 +937,7 @@ def __init__(self, client: Cloudflare) -> None: self.alerting = resources.AlertingWithRawResponse(client.alerting) self.d1 = resources.D1ResourceWithRawResponse(client.d1) self.r2 = resources.R2WithRawResponse(client.r2) - self.warp_connector = resources.WARPConnectorResourceWithRawResponse(client.warp_connector) + self.warp_connector = resources.WARPConnectorWithRawResponse(client.warp_connector) self.workers_for_platforms = resources.WorkersForPlatformsWithRawResponse(client.workers_for_platforms) self.zero_trust = resources.ZeroTrustWithRawResponse(client.zero_trust) self.challenges = resources.ChallengesWithRawResponse(client.challenges) @@ -1027,7 +1027,7 @@ def __init__(self, client: AsyncCloudflare) -> None: self.alerting = resources.AsyncAlertingWithRawResponse(client.alerting) self.d1 = resources.AsyncD1ResourceWithRawResponse(client.d1) self.r2 = resources.AsyncR2WithRawResponse(client.r2) - self.warp_connector = resources.AsyncWARPConnectorResourceWithRawResponse(client.warp_connector) + self.warp_connector = resources.AsyncWARPConnectorWithRawResponse(client.warp_connector) self.workers_for_platforms = resources.AsyncWorkersForPlatformsWithRawResponse(client.workers_for_platforms) self.zero_trust = resources.AsyncZeroTrustWithRawResponse(client.zero_trust) self.challenges = resources.AsyncChallengesWithRawResponse(client.challenges) @@ -1117,7 +1117,7 @@ def __init__(self, client: Cloudflare) -> None: self.alerting = resources.AlertingWithStreamingResponse(client.alerting) self.d1 = resources.D1ResourceWithStreamingResponse(client.d1) self.r2 = resources.R2WithStreamingResponse(client.r2) - self.warp_connector = resources.WARPConnectorResourceWithStreamingResponse(client.warp_connector) + self.warp_connector = resources.WARPConnectorWithStreamingResponse(client.warp_connector) self.workers_for_platforms = resources.WorkersForPlatformsWithStreamingResponse(client.workers_for_platforms) self.zero_trust = resources.ZeroTrustWithStreamingResponse(client.zero_trust) self.challenges = resources.ChallengesWithStreamingResponse(client.challenges) @@ -1211,7 +1211,7 @@ def __init__(self, client: AsyncCloudflare) -> None: self.alerting = resources.AsyncAlertingWithStreamingResponse(client.alerting) self.d1 = resources.AsyncD1ResourceWithStreamingResponse(client.d1) self.r2 = resources.AsyncR2WithStreamingResponse(client.r2) - self.warp_connector = resources.AsyncWARPConnectorResourceWithStreamingResponse(client.warp_connector) + self.warp_connector = resources.AsyncWARPConnectorWithStreamingResponse(client.warp_connector) self.workers_for_platforms = resources.AsyncWorkersForPlatformsWithStreamingResponse( client.workers_for_platforms ) diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index 096d7cfd8ea..22875e389ef 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -497,12 +497,12 @@ AsyncLoadBalancersWithStreamingResponse, ) from .warp_connector import ( - WARPConnectorResource, - AsyncWARPConnectorResource, - WARPConnectorResourceWithRawResponse, - AsyncWARPConnectorResourceWithRawResponse, - WARPConnectorResourceWithStreamingResponse, - AsyncWARPConnectorResourceWithStreamingResponse, + WARPConnector, + AsyncWARPConnector, + WARPConnectorWithRawResponse, + AsyncWARPConnectorWithRawResponse, + WARPConnectorWithStreamingResponse, + AsyncWARPConnectorWithStreamingResponse, ) from .durable_objects import ( DurableObjects, @@ -1020,12 +1020,12 @@ "AsyncR2WithRawResponse", "R2WithStreamingResponse", "AsyncR2WithStreamingResponse", - "WARPConnectorResource", - "AsyncWARPConnectorResource", - "WARPConnectorResourceWithRawResponse", - "AsyncWARPConnectorResourceWithRawResponse", - "WARPConnectorResourceWithStreamingResponse", - "AsyncWARPConnectorResourceWithStreamingResponse", + "WARPConnector", + "AsyncWARPConnector", + "WARPConnectorWithRawResponse", + "AsyncWARPConnectorWithRawResponse", + "WARPConnectorWithStreamingResponse", + "AsyncWARPConnectorWithStreamingResponse", "WorkersForPlatforms", "AsyncWorkersForPlatforms", "WorkersForPlatformsWithRawResponse", diff --git a/src/cloudflare/resources/warp_connector.py b/src/cloudflare/resources/warp_connector.py index cca02fe40b7..c25a010f0d3 100644 --- a/src/cloudflare/resources/warp_connector.py +++ b/src/cloudflare/resources/warp_connector.py @@ -8,8 +8,12 @@ import httpx from ..types import ( - WARPConnector, + WARPConnectorGetResponse, + WARPConnectorEditResponse, + WARPConnectorListResponse, WARPConnectorTokenResponse, + WARPConnectorCreateResponse, + WARPConnectorDeleteResponse, warp_connector_edit_params, warp_connector_list_params, warp_connector_create_params, @@ -35,17 +39,17 @@ make_request_options, ) -__all__ = ["WARPConnectorResource", "AsyncWARPConnectorResource"] +__all__ = ["WARPConnector", "AsyncWARPConnector"] -class WARPConnectorResource(SyncAPIResource): +class WARPConnector(SyncAPIResource): @cached_property - def with_raw_response(self) -> WARPConnectorResourceWithRawResponse: - return WARPConnectorResourceWithRawResponse(self) + def with_raw_response(self) -> WARPConnectorWithRawResponse: + return WARPConnectorWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WARPConnectorResourceWithStreamingResponse: - return WARPConnectorResourceWithStreamingResponse(self) + def with_streaming_response(self) -> WARPConnectorWithStreamingResponse: + return WARPConnectorWithStreamingResponse(self) def create( self, @@ -58,7 +62,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> WARPConnectorCreateResponse: """ Creates a new Warp Connector Tunnel in an account. @@ -78,7 +82,7 @@ def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WARPConnector, + WARPConnectorCreateResponse, self._post( f"/accounts/{account_id}/warp_connector", body=maybe_transform({"name": name}, warp_connector_create_params.WARPConnectorCreateParams), @@ -90,7 +94,7 @@ def create( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[WARPConnectorCreateResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -115,7 +119,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[WARPConnector]: + ) -> SyncV4PagePaginationArray[WARPConnectorListResponse]: """ Lists and filters Warp Connector Tunnels in an account. @@ -148,7 +152,7 @@ def list( 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}/warp_connector", - page=SyncV4PagePaginationArray[WARPConnector], + page=SyncV4PagePaginationArray[WARPConnectorListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -170,7 +174,9 @@ def list( warp_connector_list_params.WARPConnectorListParams, ), ), - model=cast(Any, WARPConnector), # Union types cannot be passed in as arguments in the type system + model=cast( + Any, WARPConnectorListResponse + ), # Union types cannot be passed in as arguments in the type system ) def delete( @@ -185,7 +191,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> WARPConnectorDeleteResponse: """ Deletes a Warp Connector Tunnel from an account. @@ -207,7 +213,7 @@ def delete( if not tunnel_id: raise ValueError(f"Expected a non-empty value for `tunnel_id` but received {tunnel_id!r}") return cast( - WARPConnector, + WARPConnectorDeleteResponse, self._delete( f"/accounts/{account_id}/warp_connector/{tunnel_id}", body=maybe_transform(body, warp_connector_delete_params.WARPConnectorDeleteParams), @@ -219,7 +225,7 @@ def delete( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[WARPConnectorDeleteResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -237,7 +243,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> WARPConnectorEditResponse: """ Updates an existing Warp Connector Tunnel. @@ -264,7 +270,7 @@ def edit( if not tunnel_id: raise ValueError(f"Expected a non-empty value for `tunnel_id` but received {tunnel_id!r}") return cast( - WARPConnector, + WARPConnectorEditResponse, self._patch( f"/accounts/{account_id}/warp_connector/{tunnel_id}", body=maybe_transform( @@ -282,7 +288,7 @@ def edit( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[WARPConnectorEditResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -298,7 +304,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> WARPConnectorGetResponse: """ Fetches a single Warp Connector Tunnel. @@ -320,7 +326,7 @@ def get( if not tunnel_id: raise ValueError(f"Expected a non-empty value for `tunnel_id` but received {tunnel_id!r}") return cast( - WARPConnector, + WARPConnectorGetResponse, self._get( f"/accounts/{account_id}/warp_connector/{tunnel_id}", options=make_request_options( @@ -331,7 +337,7 @@ def get( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[WARPConnectorGetResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -387,14 +393,14 @@ def token( ) -class AsyncWARPConnectorResource(AsyncAPIResource): +class AsyncWARPConnector(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWARPConnectorResourceWithRawResponse: - return AsyncWARPConnectorResourceWithRawResponse(self) + def with_raw_response(self) -> AsyncWARPConnectorWithRawResponse: + return AsyncWARPConnectorWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWARPConnectorResourceWithStreamingResponse: - return AsyncWARPConnectorResourceWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWARPConnectorWithStreamingResponse: + return AsyncWARPConnectorWithStreamingResponse(self) async def create( self, @@ -407,7 +413,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> WARPConnectorCreateResponse: """ Creates a new Warp Connector Tunnel in an account. @@ -427,7 +433,7 @@ async def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - WARPConnector, + WARPConnectorCreateResponse, await self._post( f"/accounts/{account_id}/warp_connector", body=await async_maybe_transform( @@ -441,7 +447,7 @@ async def create( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[WARPConnectorCreateResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -466,7 +472,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WARPConnector, AsyncV4PagePaginationArray[WARPConnector]]: + ) -> AsyncPaginator[WARPConnectorListResponse, AsyncV4PagePaginationArray[WARPConnectorListResponse]]: """ Lists and filters Warp Connector Tunnels in an account. @@ -499,7 +505,7 @@ def list( 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}/warp_connector", - page=AsyncV4PagePaginationArray[WARPConnector], + page=AsyncV4PagePaginationArray[WARPConnectorListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -521,7 +527,9 @@ def list( warp_connector_list_params.WARPConnectorListParams, ), ), - model=cast(Any, WARPConnector), # Union types cannot be passed in as arguments in the type system + model=cast( + Any, WARPConnectorListResponse + ), # Union types cannot be passed in as arguments in the type system ) async def delete( @@ -536,7 +544,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> WARPConnectorDeleteResponse: """ Deletes a Warp Connector Tunnel from an account. @@ -558,7 +566,7 @@ async def delete( if not tunnel_id: raise ValueError(f"Expected a non-empty value for `tunnel_id` but received {tunnel_id!r}") return cast( - WARPConnector, + WARPConnectorDeleteResponse, await self._delete( f"/accounts/{account_id}/warp_connector/{tunnel_id}", body=await async_maybe_transform(body, warp_connector_delete_params.WARPConnectorDeleteParams), @@ -570,7 +578,7 @@ async def delete( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[WARPConnectorDeleteResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -588,7 +596,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> WARPConnectorEditResponse: """ Updates an existing Warp Connector Tunnel. @@ -615,7 +623,7 @@ async def edit( if not tunnel_id: raise ValueError(f"Expected a non-empty value for `tunnel_id` but received {tunnel_id!r}") return cast( - WARPConnector, + WARPConnectorEditResponse, await self._patch( f"/accounts/{account_id}/warp_connector/{tunnel_id}", body=await async_maybe_transform( @@ -633,7 +641,7 @@ async def edit( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[WARPConnectorEditResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -649,7 +657,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> WARPConnectorGetResponse: """ Fetches a single Warp Connector Tunnel. @@ -671,7 +679,7 @@ async def get( if not tunnel_id: raise ValueError(f"Expected a non-empty value for `tunnel_id` but received {tunnel_id!r}") return cast( - WARPConnector, + WARPConnectorGetResponse, await self._get( f"/accounts/{account_id}/warp_connector/{tunnel_id}", options=make_request_options( @@ -682,7 +690,7 @@ async def get( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[WARPConnectorGetResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -738,8 +746,8 @@ async def token( ) -class WARPConnectorResourceWithRawResponse: - def __init__(self, warp_connector: WARPConnectorResource) -> None: +class WARPConnectorWithRawResponse: + def __init__(self, warp_connector: WARPConnector) -> None: self._warp_connector = warp_connector self.create = to_raw_response_wrapper( @@ -762,8 +770,8 @@ def __init__(self, warp_connector: WARPConnectorResource) -> None: ) -class AsyncWARPConnectorResourceWithRawResponse: - def __init__(self, warp_connector: AsyncWARPConnectorResource) -> None: +class AsyncWARPConnectorWithRawResponse: + def __init__(self, warp_connector: AsyncWARPConnector) -> None: self._warp_connector = warp_connector self.create = async_to_raw_response_wrapper( @@ -786,8 +794,8 @@ def __init__(self, warp_connector: AsyncWARPConnectorResource) -> None: ) -class WARPConnectorResourceWithStreamingResponse: - def __init__(self, warp_connector: WARPConnectorResource) -> None: +class WARPConnectorWithStreamingResponse: + def __init__(self, warp_connector: WARPConnector) -> None: self._warp_connector = warp_connector self.create = to_streamed_response_wrapper( @@ -810,8 +818,8 @@ def __init__(self, warp_connector: WARPConnectorResource) -> None: ) -class AsyncWARPConnectorResourceWithStreamingResponse: - def __init__(self, warp_connector: AsyncWARPConnectorResource) -> None: +class AsyncWARPConnectorWithStreamingResponse: + def __init__(self, warp_connector: AsyncWARPConnector) -> None: self._warp_connector = warp_connector self.create = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py index 17585c77db7..1797bf9d824 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py +++ b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py @@ -15,7 +15,6 @@ TokenWithStreamingResponse, AsyncTokenWithStreamingResponse, ) -from ....types import WARPConnector from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( maybe_transform, @@ -69,6 +68,8 @@ ) from ....types.zero_trust import ( Tunnel, + TunnelEditResponse, + TunnelListResponse, tunnel_edit_params, tunnel_list_params, tunnel_create_params, @@ -181,7 +182,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncV4PagePaginationArray[WARPConnector]: + ) -> SyncV4PagePaginationArray[TunnelListResponse]: """ Lists and filters all types of Tunnels in an account. @@ -216,7 +217,7 @@ def list( 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}/tunnels", - page=SyncV4PagePaginationArray[WARPConnector], + page=SyncV4PagePaginationArray[TunnelListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -239,7 +240,7 @@ def list( tunnel_list_params.TunnelListParams, ), ), - model=cast(Any, WARPConnector), # Union types cannot be passed in as arguments in the type system + model=cast(Any, TunnelListResponse), # Union types cannot be passed in as arguments in the type system ) def delete( @@ -301,7 +302,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> TunnelEditResponse: """ Updates an existing Cloudflare Tunnel. @@ -328,7 +329,7 @@ def edit( if not tunnel_id: raise ValueError(f"Expected a non-empty value for `tunnel_id` but received {tunnel_id!r}") return cast( - WARPConnector, + TunnelEditResponse, self._patch( f"/accounts/{account_id}/cfd_tunnel/{tunnel_id}", body=maybe_transform( @@ -346,7 +347,7 @@ def edit( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[TunnelEditResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -499,7 +500,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WARPConnector, AsyncV4PagePaginationArray[WARPConnector]]: + ) -> AsyncPaginator[TunnelListResponse, AsyncV4PagePaginationArray[TunnelListResponse]]: """ Lists and filters all types of Tunnels in an account. @@ -534,7 +535,7 @@ def list( 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}/tunnels", - page=AsyncV4PagePaginationArray[WARPConnector], + page=AsyncV4PagePaginationArray[TunnelListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -557,7 +558,7 @@ def list( tunnel_list_params.TunnelListParams, ), ), - model=cast(Any, WARPConnector), # Union types cannot be passed in as arguments in the type system + model=cast(Any, TunnelListResponse), # Union types cannot be passed in as arguments in the type system ) async def delete( @@ -619,7 +620,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WARPConnector: + ) -> TunnelEditResponse: """ Updates an existing Cloudflare Tunnel. @@ -646,7 +647,7 @@ async def edit( if not tunnel_id: raise ValueError(f"Expected a non-empty value for `tunnel_id` but received {tunnel_id!r}") return cast( - WARPConnector, + TunnelEditResponse, await self._patch( f"/accounts/{account_id}/cfd_tunnel/{tunnel_id}", body=await async_maybe_transform( @@ -664,7 +665,7 @@ async def edit( post_parser=ResultWrapper._unwrapper, ), cast_to=cast( - Any, ResultWrapper[WARPConnector] + Any, ResultWrapper[TunnelEditResponse] ), # Union types cannot be passed in as arguments in the type system ), ) diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index ade26412b8e..1986dd954aa 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -80,7 +80,6 @@ from .hostname_param import HostnameParam as HostnameParam from .ip_list_params import IPListParams as IPListParams from .labeled_region import LabeledRegion as LabeledRegion -from .warp_connector import WARPConnector as WARPConnector from .allowed_origins import AllowedOrigins as AllowedOrigins from .firewall_filter import FirewallFilter as FirewallFilter from .origin_steering import OriginSteering as OriginSteering @@ -239,6 +238,7 @@ from .page_shield_update_response import PageShieldUpdateResponse as PageShieldUpdateResponse from .session_affinity_attributes import SessionAffinityAttributes as SessionAffinityAttributes from .single_step_migration_param import SingleStepMigrationParam as SingleStepMigrationParam +from .warp_connector_get_response import WARPConnectorGetResponse as WARPConnectorGetResponse from .bot_fight_mode_configuration import BotFightModeConfiguration as BotFightModeConfiguration from .bot_management_update_params import BotManagementUpdateParams as BotManagementUpdateParams from .custom_hostname_get_response import CustomHostnameGetResponse as CustomHostnameGetResponse @@ -252,6 +252,8 @@ from .waiting_room_delete_response import WaitingRoomDeleteResponse as WaitingRoomDeleteResponse from .warp_connector_create_params import WARPConnectorCreateParams as WARPConnectorCreateParams from .warp_connector_delete_params import WARPConnectorDeleteParams as WARPConnectorDeleteParams +from .warp_connector_edit_response import WARPConnectorEditResponse as WARPConnectorEditResponse +from .warp_connector_list_response import WARPConnectorListResponse as WARPConnectorListResponse from .custom_hostname_create_params import CustomHostnameCreateParams as CustomHostnameCreateParams from .custom_hostname_delete_params import CustomHostnameDeleteParams as CustomHostnameDeleteParams from .custom_hostname_edit_response import CustomHostnameEditResponse as CustomHostnameEditResponse @@ -268,6 +270,8 @@ from .mtls_certificate_create_params import MTLSCertificateCreateParams as MTLSCertificateCreateParams from .mtls_certificate_delete_params import MTLSCertificateDeleteParams as MTLSCertificateDeleteParams from .url_normalization_get_response import URLNormalizationGetResponse as URLNormalizationGetResponse +from .warp_connector_create_response import WARPConnectorCreateResponse as WARPConnectorCreateResponse +from .warp_connector_delete_response import WARPConnectorDeleteResponse as WARPConnectorDeleteResponse from .zone_authenticated_origin_pull import ZoneAuthenticatedOriginPull as ZoneAuthenticatedOriginPull from .custom_certificate_get_response import CustomCertificateGetResponse as CustomCertificateGetResponse from .custom_hostname_create_response import CustomHostnameCreateResponse as CustomHostnameCreateResponse diff --git a/src/cloudflare/types/warp_connector_create_response.py b/src/cloudflare/types/warp_connector_create_response.py new file mode 100644 index 00000000000..d9735129282 --- /dev/null +++ b/src/cloudflare/types/warp_connector_create_response.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .zero_trust import Connection + +__all__ = ["WARPConnectorCreateResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] + + +class TunnelCfdTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + remote_config: Optional[bool] = None + """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + + If `false`, the tunnel must be configured locally on the origin machine. + """ + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +WARPConnectorCreateResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_delete_response.py b/src/cloudflare/types/warp_connector_delete_response.py new file mode 100644 index 00000000000..c70fba6a894 --- /dev/null +++ b/src/cloudflare/types/warp_connector_delete_response.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .zero_trust import Connection + +__all__ = ["WARPConnectorDeleteResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] + + +class TunnelCfdTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + remote_config: Optional[bool] = None + """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + + If `false`, the tunnel must be configured locally on the origin machine. + """ + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +WARPConnectorDeleteResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_edit_response.py b/src/cloudflare/types/warp_connector_edit_response.py new file mode 100644 index 00000000000..8896d821243 --- /dev/null +++ b/src/cloudflare/types/warp_connector_edit_response.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .zero_trust import Connection + +__all__ = ["WARPConnectorEditResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] + + +class TunnelCfdTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + remote_config: Optional[bool] = None + """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + + If `false`, the tunnel must be configured locally on the origin machine. + """ + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +WARPConnectorEditResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector.py b/src/cloudflare/types/warp_connector_get_response.py similarity index 95% rename from src/cloudflare/types/warp_connector.py rename to src/cloudflare/types/warp_connector_get_response.py index 33a4b1983b1..dab92ef6fa7 100644 --- a/src/cloudflare/types/warp_connector.py +++ b/src/cloudflare/types/warp_connector_get_response.py @@ -7,7 +7,7 @@ from .._models import BaseModel from .zero_trust import Connection -__all__ = ["WARPConnector", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] +__all__ = ["WARPConnectorGetResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] class TunnelCfdTunnel(BaseModel): @@ -116,4 +116,4 @@ class TunnelWARPConnectorTunnel(BaseModel): """The type of tunnel.""" -WARPConnector = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] +WARPConnectorGetResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/warp_connector_list_response.py b/src/cloudflare/types/warp_connector_list_response.py new file mode 100644 index 00000000000..e127bf2e5a5 --- /dev/null +++ b/src/cloudflare/types/warp_connector_list_response.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .zero_trust import Connection + +__all__ = ["WARPConnectorListResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] + + +class TunnelCfdTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + remote_config: Optional[bool] = None + """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + + If `false`, the tunnel must be configured locally on the origin machine. + """ + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +WARPConnectorListResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/zero_trust/__init__.py b/src/cloudflare/types/zero_trust/__init__.py index 6f258fdf90a..19bcaf6ee16 100644 --- a/src/cloudflare/types/zero_trust/__init__.py +++ b/src/cloudflare/types/zero_trust/__init__.py @@ -47,6 +47,8 @@ from .generic_oauth_config import GenericOAuthConfig as GenericOAuthConfig from .tunnel_create_params import TunnelCreateParams as TunnelCreateParams from .tunnel_delete_params import TunnelDeleteParams as TunnelDeleteParams +from .tunnel_edit_response import TunnelEditResponse as TunnelEditResponse +from .tunnel_list_response import TunnelListResponse as TunnelListResponse from .email_list_rule_param import EmailListRuleParam as EmailListRuleParam from .gateway_list_response import GatewayListResponse as GatewayListResponse from .okta_group_rule_param import OktaGroupRuleParam as OktaGroupRuleParam diff --git a/src/cloudflare/types/zero_trust/tunnel_edit_response.py b/src/cloudflare/types/zero_trust/tunnel_edit_response.py new file mode 100644 index 00000000000..edac0e4990a --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnel_edit_response.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel +from .connection import Connection + +__all__ = ["TunnelEditResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] + + +class TunnelCfdTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + remote_config: Optional[bool] = None + """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + + If `false`, the tunnel must be configured locally on the origin machine. + """ + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +TunnelEditResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/zero_trust/tunnel_list_response.py b/src/cloudflare/types/zero_trust/tunnel_list_response.py new file mode 100644 index 00000000000..ee53910b58a --- /dev/null +++ b/src/cloudflare/types/zero_trust/tunnel_list_response.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel +from .connection import Connection + +__all__ = ["TunnelListResponse", "TunnelCfdTunnel", "TunnelWARPConnectorTunnel"] + + +class TunnelCfdTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + remote_config: Optional[bool] = None + """If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + + If `false`, the tunnel must be configured locally on the origin machine. + """ + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[Connection]] = None + """The Cloudflare Tunnel connections between your origin and Cloudflare's edge.""" + + conns_active_at: Optional[datetime] = None + """ + Timestamp of when the tunnel established at least one connection to Cloudflare's + edge. If `null`, the tunnel is inactive. + """ + + conns_inactive_at: Optional[datetime] = None + """ + Timestamp of when the tunnel became inactive (no connections to Cloudflare's + edge). If `null`, the tunnel is active. + """ + + created_at: Optional[datetime] = None + """Timestamp of when the tunnel was created.""" + + deleted_at: Optional[datetime] = None + """Timestamp of when the tunnel was deleted. + + If `null`, the tunnel has not been deleted. + """ + + metadata: Optional[object] = None + """Metadata associated with the tunnel.""" + + name: Optional[str] = None + """A user-friendly name for the tunnel.""" + + status: Optional[str] = None + """The status of the tunnel. + + Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is + active and able to serve traffic but in an unhealthy state), `healthy` (tunnel + is active and able to serve traffic), or `down` (tunnel can not serve traffic as + it has no connections to the Cloudflare Edge). + """ + + tun_type: Optional[Literal["cfd_tunnel", "warp_connector", "ip_sec", "gre", "cni"]] = None + """The type of tunnel.""" + + +TunnelListResponse = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/tests/api_resources/test_warp_connector.py b/tests/api_resources/test_warp_connector.py index 7dbb76cb6f7..9a8ad00e596 100644 --- a/tests/api_resources/test_warp_connector.py +++ b/tests/api_resources/test_warp_connector.py @@ -10,8 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.types import ( - WARPConnector, + WARPConnectorGetResponse, + WARPConnectorEditResponse, + WARPConnectorListResponse, WARPConnectorTokenResponse, + WARPConnectorCreateResponse, + WARPConnectorDeleteResponse, ) from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray @@ -29,7 +33,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="blog", ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorCreateResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +46,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorCreateResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +59,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorCreateResponse, warp_connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +78,7 @@ def test_method_list(self, client: Cloudflare) -> None: warp_connector = client.warp_connector.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncV4PagePaginationArray[WARPConnector], warp_connector, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[WARPConnectorListResponse], warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -92,7 +96,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: was_active_at=parse_datetime("2009-11-10T23:00:00Z"), was_inactive_at=parse_datetime("2009-11-10T23:00:00Z"), ) - assert_matches_type(SyncV4PagePaginationArray[WARPConnector], warp_connector, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[WARPConnectorListResponse], warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -104,7 +108,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WARPConnector], warp_connector, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[WARPConnectorListResponse], warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +120,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WARPConnector], warp_connector, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[WARPConnectorListResponse], warp_connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -136,7 +140,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body={}, ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorDeleteResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -150,7 +154,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorDeleteResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +168,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorDeleteResponse, warp_connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -192,7 +196,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorEditResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +207,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: name="blog", tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorEditResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -216,7 +220,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorEditResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -229,7 +233,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorEditResponse, warp_connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -255,7 +259,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorGetResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +272,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorGetResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -281,7 +285,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorGetResponse, warp_connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -363,7 +367,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", name="blog", ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorCreateResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -376,7 +380,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorCreateResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -389,7 +393,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorCreateResponse, warp_connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -408,7 +412,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: warp_connector = await async_client.warp_connector.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncV4PagePaginationArray[WARPConnector], warp_connector, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[WARPConnectorListResponse], warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -426,7 +430,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) was_active_at=parse_datetime("2009-11-10T23:00:00Z"), was_inactive_at=parse_datetime("2009-11-10T23:00:00Z"), ) - assert_matches_type(AsyncV4PagePaginationArray[WARPConnector], warp_connector, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[WARPConnectorListResponse], warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -438,7 +442,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WARPConnector], warp_connector, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[WARPConnectorListResponse], warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -450,7 +454,9 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WARPConnector], warp_connector, path=["response"]) + assert_matches_type( + AsyncV4PagePaginationArray[WARPConnectorListResponse], warp_connector, path=["response"] + ) assert cast(Any, response.is_closed) is True @@ -470,7 +476,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body={}, ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorDeleteResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -484,7 +490,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorDeleteResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -498,7 +504,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorDeleteResponse, warp_connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -526,7 +532,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorEditResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -537,7 +543,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) name="blog", tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorEditResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -550,7 +556,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorEditResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -563,7 +569,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorEditResponse, warp_connector, path=["response"]) assert cast(Any, response.is_closed) is True @@ -589,7 +595,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorGetResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -602,7 +608,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorGetResponse, warp_connector, path=["response"]) @pytest.mark.skip() @parametrize @@ -615,7 +621,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" warp_connector = await response.parse() - assert_matches_type(WARPConnector, warp_connector, path=["response"]) + assert_matches_type(WARPConnectorGetResponse, warp_connector, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/test_tunnels.py b/tests/api_resources/zero_trust/test_tunnels.py index 1e5b90f5f72..c0afd309b36 100644 --- a/tests/api_resources/zero_trust/test_tunnels.py +++ b/tests/api_resources/zero_trust/test_tunnels.py @@ -9,11 +9,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import WARPConnector from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.zero_trust import ( Tunnel, + TunnelEditResponse, + TunnelListResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -78,7 +79,7 @@ def test_method_list(self, client: Cloudflare) -> None: tunnel = client.zero_trust.tunnels.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(SyncV4PagePaginationArray[WARPConnector], tunnel, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[TunnelListResponse], tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +98,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: was_active_at=parse_datetime("2009-11-10T23:00:00Z"), was_inactive_at=parse_datetime("2009-11-10T23:00:00Z"), ) - assert_matches_type(SyncV4PagePaginationArray[WARPConnector], tunnel, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[TunnelListResponse], tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -109,7 +110,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WARPConnector], tunnel, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[TunnelListResponse], tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +122,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(SyncV4PagePaginationArray[WARPConnector], tunnel, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[TunnelListResponse], tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,7 +198,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WARPConnector, tunnel, path=["response"]) + assert_matches_type(TunnelEditResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -208,7 +209,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: name="blog", tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) - assert_matches_type(WARPConnector, tunnel, path=["response"]) + assert_matches_type(TunnelEditResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +222,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(WARPConnector, tunnel, path=["response"]) + assert_matches_type(TunnelEditResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -234,7 +235,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = response.parse() - assert_matches_type(WARPConnector, tunnel, path=["response"]) + assert_matches_type(TunnelEditResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -365,7 +366,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: tunnel = await async_client.zero_trust.tunnels.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(AsyncV4PagePaginationArray[WARPConnector], tunnel, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[TunnelListResponse], tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -384,7 +385,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) was_active_at=parse_datetime("2009-11-10T23:00:00Z"), was_inactive_at=parse_datetime("2009-11-10T23:00:00Z"), ) - assert_matches_type(AsyncV4PagePaginationArray[WARPConnector], tunnel, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[TunnelListResponse], tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -396,7 +397,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WARPConnector], tunnel, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[TunnelListResponse], tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -408,7 +409,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[WARPConnector], tunnel, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[TunnelListResponse], tunnel, path=["response"]) assert cast(Any, response.is_closed) is True @@ -484,7 +485,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(WARPConnector, tunnel, path=["response"]) + assert_matches_type(TunnelEditResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -495,7 +496,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) name="blog", tunnel_secret="AQIDBAUGBwgBAgMEBQYHCAECAwQFBgcIAQIDBAUGBwg=", ) - assert_matches_type(WARPConnector, tunnel, path=["response"]) + assert_matches_type(TunnelEditResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -508,7 +509,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(WARPConnector, tunnel, path=["response"]) + assert_matches_type(TunnelEditResponse, tunnel, path=["response"]) @pytest.mark.skip() @parametrize @@ -521,7 +522,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tunnel = await response.parse() - assert_matches_type(WARPConnector, tunnel, path=["response"]) + assert_matches_type(TunnelEditResponse, tunnel, path=["response"]) assert cast(Any, response.is_closed) is True