diff --git a/api.md b/api.md index bc13908c485..01ea5b1c810 100644 --- a/api.md +++ b/api.md @@ -134,12 +134,12 @@ Methods: Types: ```python -from cloudflare.types.user.billing import BillingHistory, HistoryGetResponse +from cloudflare.types.user.billing import BillingHistory ``` Methods: -- client.user.billing.history.get(\*\*params) -> Optional +- client.user.billing.history.list(\*\*params) -> SyncV4PagePaginationArray[BillingHistory] ### Profile @@ -178,14 +178,14 @@ Methods: - client.user.invites.edit(invite_id, \*\*params) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a - client.user.invites.get(invite_id) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a -## LoadBalancers +## LoadBalancing ### Monitors Types: ```python -from cloudflare.types.user.load_balancers import ( +from cloudflare.types.user.load_balancing import ( MonitorCreateResponse, MonitorUpdateResponse, MonitorListResponse, @@ -199,21 +199,21 @@ from cloudflare.types.user.load_balancers import ( Methods: -- client.user.load_balancers.monitors.create(\*\*params) -> MonitorCreateResponse -- client.user.load_balancers.monitors.update(monitor_id, \*\*params) -> MonitorUpdateResponse -- client.user.load_balancers.monitors.list() -> SyncSinglePage[MonitorListResponse] -- client.user.load_balancers.monitors.delete(monitor_id, \*\*params) -> MonitorDeleteResponse -- client.user.load_balancers.monitors.edit(monitor_id, \*\*params) -> MonitorEditResponse -- client.user.load_balancers.monitors.get(monitor_id) -> MonitorGetResponse -- client.user.load_balancers.monitors.preview(monitor_id, \*\*params) -> MonitorPreviewResponse -- client.user.load_balancers.monitors.references(monitor_id) -> Optional +- client.user.load_balancing.monitors.create(\*\*params) -> MonitorCreateResponse +- client.user.load_balancing.monitors.update(monitor_id, \*\*params) -> MonitorUpdateResponse +- client.user.load_balancing.monitors.list() -> SyncSinglePage[MonitorListResponse] +- client.user.load_balancing.monitors.delete(monitor_id, \*\*params) -> MonitorDeleteResponse +- client.user.load_balancing.monitors.edit(monitor_id, \*\*params) -> MonitorEditResponse +- client.user.load_balancing.monitors.get(monitor_id) -> MonitorGetResponse +- client.user.load_balancing.monitors.preview(monitor_id, \*\*params) -> MonitorPreviewResponse +- client.user.load_balancing.monitors.references(monitor_id) -> Optional ### Pools Types: ```python -from cloudflare.types.user.load_balancers import ( +from cloudflare.types.user.load_balancing import ( PoolDeleteResponse, PoolHealthResponse, PoolPreviewResponse, @@ -223,41 +223,41 @@ from cloudflare.types.user.load_balancers import ( Methods: -- client.user.load_balancers.pools.create(\*\*params) -> Pool -- client.user.load_balancers.pools.update(pool_id, \*\*params) -> Pool -- client.user.load_balancers.pools.list(\*\*params) -> SyncSinglePage[Pool] -- client.user.load_balancers.pools.delete(pool_id, \*\*params) -> PoolDeleteResponse -- client.user.load_balancers.pools.edit(pool_id, \*\*params) -> Pool -- client.user.load_balancers.pools.get(pool_id) -> Pool -- client.user.load_balancers.pools.health(pool_id) -> PoolHealthResponse -- client.user.load_balancers.pools.preview(pool_id, \*\*params) -> PoolPreviewResponse -- client.user.load_balancers.pools.references(pool_id) -> Optional +- client.user.load_balancing.pools.create(\*\*params) -> Pool +- client.user.load_balancing.pools.update(pool_id, \*\*params) -> Pool +- client.user.load_balancing.pools.list(\*\*params) -> SyncSinglePage[Pool] +- client.user.load_balancing.pools.delete(pool_id, \*\*params) -> PoolDeleteResponse +- client.user.load_balancing.pools.edit(pool_id, \*\*params) -> Pool +- client.user.load_balancing.pools.get(pool_id) -> Pool +- client.user.load_balancing.pools.health(pool_id) -> PoolHealthResponse +- client.user.load_balancing.pools.preview(pool_id, \*\*params) -> PoolPreviewResponse +- client.user.load_balancing.pools.references(pool_id) -> Optional -### PreviewResource +### Preview Types: ```python -from cloudflare.types.user.load_balancers import Preview +from cloudflare.types.user.load_balancing import PreviewGetResponse ``` Methods: -- client.user.load_balancers.preview.get(preview_id) -> Preview +- client.user.load_balancing.preview.get(preview_id) -> PreviewGetResponse ### Analytics Types: ```python -from cloudflare.types.user.load_balancers import Analytics +from cloudflare.types.user.load_balancing import Analytics ``` #### Events Methods: -- client.user.load_balancers.analytics.events.list(\*\*params) -> SyncSinglePage[Analytics] +- client.user.load_balancing.analytics.events.list(\*\*params) -> SyncSinglePage[Analytics] ## Organizations @@ -1206,9 +1206,15 @@ Methods: ## Previews +Types: + +```python +from cloudflare.types.load_balancers import PreviewGetResponse +``` + Methods: -- client.load_balancers.previews.get(preview_id, \*, account_id) -> Preview +- client.load_balancers.previews.get(preview_id, \*, account_id) -> PreviewGetResponse ## Regions @@ -3564,12 +3570,16 @@ Methods: Types: ```python -from cloudflare.types.intel import DNS, UnnamedSchemaRefB5e16cee4f32382c294201aedb9fc050 +from cloudflare.types.intel import ( + DNS, + UnnamedSchemaRefB5e16cee4f32382c294201aedb9fc050, + DNSListResponse, +) ``` Methods: -- client.intel.dns.get(\*, account_id, \*\*params) -> DNS +- client.intel.dns.list(\*, account_id, \*\*params) -> SyncV4PagePagination[DNSListResponse] ## Domains @@ -5432,11 +5442,7 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import ( - Tunnel, - UnnamedSchemaRefA9c0e0a8cc5fd0e244f41ea806cd954a, - WARPConnectorTunnel, -) +from cloudflare.types.zero_trust import Tunnel, WARPConnectorTunnel ``` Methods: @@ -6054,15 +6060,17 @@ Methods: ### Leaks +#### Events + Types: ```python -from cloudflare.types.radar.bgp import LeakEventsResponse +from cloudflare.types.radar.bgp.leaks import EventListResponse ``` Methods: -- client.radar.bgp.leaks.events(\*\*params) -> LeakEventsResponse +- client.radar.bgp.leaks.events.list(\*\*params) -> SyncV4PagePagination[EventListResponse] ### Top @@ -6091,15 +6099,17 @@ Methods: ### Hijacks +#### Events + Types: ```python -from cloudflare.types.radar.bgp import HijackEventsResponse +from cloudflare.types.radar.bgp.hijacks import EventListResponse ``` Methods: -- client.radar.bgp.hijacks.events(\*\*params) -> HijackEventsResponse +- client.radar.bgp.hijacks.events.list(\*\*params) -> SyncV4PagePagination[EventListResponse] ### Routes diff --git a/src/cloudflare/resources/intel/dns.py b/src/cloudflare/resources/intel/dns.py index ccb0f4ee538..a74d19434c6 100644 --- a/src/cloudflare/resources/intel/dns.py +++ b/src/cloudflare/resources/intel/dns.py @@ -2,15 +2,10 @@ from __future__ import annotations -from typing import Type, cast - import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -19,9 +14,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper -from ...types.intel import dns, dns_get_params +from ...pagination import SyncV4PagePagination, AsyncV4PagePagination +from ...types.intel import DNSListResponse, dns_list_params from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -37,21 +33,21 @@ def with_raw_response(self) -> DNSWithRawResponse: def with_streaming_response(self) -> DNSWithStreamingResponse: return DNSWithStreamingResponse(self) - def get( + def list( self, *, account_id: str, ipv4: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, - start_end_params: dns_get_params.StartEndParams | NotGiven = NOT_GIVEN, + start_end_params: dns_list_params.StartEndParams | 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, - ) -> dns.DNS: + ) -> SyncV4PagePagination[DNSListResponse]: """ Get Passive DNS by IP @@ -72,8 +68,9 @@ def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/intel/dns", + page=SyncV4PagePagination[DNSListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -86,11 +83,10 @@ def get( "per_page": per_page, "start_end_params": start_end_params, }, - dns_get_params.DNSGetParams, + dns_list_params.DNSListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[dns.DNS], ResultWrapper[dns.DNS]), + model=DNSListResponse, ) @@ -103,21 +99,21 @@ def with_raw_response(self) -> AsyncDNSWithRawResponse: def with_streaming_response(self) -> AsyncDNSWithStreamingResponse: return AsyncDNSWithStreamingResponse(self) - async def get( + def list( self, *, account_id: str, ipv4: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, - start_end_params: dns_get_params.StartEndParams | NotGiven = NOT_GIVEN, + start_end_params: dns_list_params.StartEndParams | 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, - ) -> dns.DNS: + ) -> AsyncPaginator[DNSListResponse, AsyncV4PagePagination[DNSListResponse]]: """ Get Passive DNS by IP @@ -138,25 +134,25 @@ async def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/intel/dns", + page=AsyncV4PagePagination[DNSListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "ipv4": ipv4, "page": page, "per_page": per_page, "start_end_params": start_end_params, }, - dns_get_params.DNSGetParams, + dns_list_params.DNSListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[dns.DNS], ResultWrapper[dns.DNS]), + model=DNSListResponse, ) @@ -164,8 +160,8 @@ class DNSWithRawResponse: def __init__(self, dns: DNS) -> None: self._dns = dns - self.get = to_raw_response_wrapper( - dns.get, + self.list = to_raw_response_wrapper( + dns.list, ) @@ -173,8 +169,8 @@ class AsyncDNSWithRawResponse: def __init__(self, dns: AsyncDNS) -> None: self._dns = dns - self.get = async_to_raw_response_wrapper( - dns.get, + self.list = async_to_raw_response_wrapper( + dns.list, ) @@ -182,8 +178,8 @@ class DNSWithStreamingResponse: def __init__(self, dns: DNS) -> None: self._dns = dns - self.get = to_streamed_response_wrapper( - dns.get, + self.list = to_streamed_response_wrapper( + dns.list, ) @@ -191,6 +187,6 @@ class AsyncDNSWithStreamingResponse: def __init__(self, dns: AsyncDNS) -> None: self._dns = dns - self.get = async_to_streamed_response_wrapper( - dns.get, + self.list = async_to_streamed_response_wrapper( + dns.list, ) diff --git a/src/cloudflare/resources/load_balancers/previews.py b/src/cloudflare/resources/load_balancers/previews.py index e896b284fc8..3577eacc422 100644 --- a/src/cloudflare/resources/load_balancers/previews.py +++ b/src/cloudflare/resources/load_balancers/previews.py @@ -19,7 +19,7 @@ from ..._base_client import ( make_request_options, ) -from ...types.user.load_balancers import Preview +from ...types.load_balancers import PreviewGetResponse __all__ = ["Previews", "AsyncPreviews"] @@ -44,7 +44,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Preview: + ) -> PreviewGetResponse: """ Get the result of a previous preview operation using the provided preview_id. @@ -72,7 +72,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Preview], ResultWrapper[Preview]), + cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]), ) @@ -96,7 +96,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Preview: + ) -> PreviewGetResponse: """ Get the result of a previous preview operation using the provided preview_id. @@ -124,7 +124,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Preview], ResultWrapper[Preview]), + cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]), ) diff --git a/src/cloudflare/resources/radar/bgp/bgp.py b/src/cloudflare/resources/radar/bgp/bgp.py index d2636d2e58a..f684a66b772 100644 --- a/src/cloudflare/resources/radar/bgp/bgp.py +++ b/src/cloudflare/resources/radar/bgp/bgp.py @@ -47,6 +47,7 @@ async_maybe_transform, ) from ...._compat import cached_property +from .leaks.leaks import Leaks, AsyncLeaks from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( to_raw_response_wrapper, @@ -59,6 +60,7 @@ from ...._base_client import ( make_request_options, ) +from .hijacks.hijacks import Hijacks, AsyncHijacks __all__ = ["BGP", "AsyncBGP"] diff --git a/src/cloudflare/resources/radar/bgp/hijacks/__init__.py b/src/cloudflare/resources/radar/bgp/hijacks/__init__.py new file mode 100644 index 00000000000..476f32bf825 --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/hijacks/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .events import ( + Events, + AsyncEvents, + EventsWithRawResponse, + AsyncEventsWithRawResponse, + EventsWithStreamingResponse, + AsyncEventsWithStreamingResponse, +) +from .hijacks import ( + Hijacks, + AsyncHijacks, + HijacksWithRawResponse, + AsyncHijacksWithRawResponse, + HijacksWithStreamingResponse, + AsyncHijacksWithStreamingResponse, +) + +__all__ = [ + "Events", + "AsyncEvents", + "EventsWithRawResponse", + "AsyncEventsWithRawResponse", + "EventsWithStreamingResponse", + "AsyncEventsWithStreamingResponse", + "Hijacks", + "AsyncHijacks", + "HijacksWithRawResponse", + "AsyncHijacksWithRawResponse", + "HijacksWithStreamingResponse", + "AsyncHijacksWithStreamingResponse", +] diff --git a/src/cloudflare/resources/radar/bgp/hijacks.py b/src/cloudflare/resources/radar/bgp/hijacks/events.py similarity index 78% rename from src/cloudflare/resources/radar/bgp/hijacks.py rename to src/cloudflare/resources/radar/bgp/hijacks/events.py index ffe551e6def..12be32c82c0 100644 --- a/src/cloudflare/resources/radar/bgp/hijacks.py +++ b/src/cloudflare/resources/radar/bgp/hijacks/events.py @@ -2,44 +2,42 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Union from datetime import datetime 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 ( +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import 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 ( +from .....pagination import SyncV4PagePagination, AsyncV4PagePagination +from ....._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.radar.bgp import HijackEventsResponse, hijack_events_params +from .....types.radar.bgp.hijacks import EventListResponse, event_list_params -__all__ = ["Hijacks", "AsyncHijacks"] +__all__ = ["Events", "AsyncEvents"] -class Hijacks(SyncAPIResource): +class Events(SyncAPIResource): @cached_property - def with_raw_response(self) -> HijacksWithRawResponse: - return HijacksWithRawResponse(self) + def with_raw_response(self) -> EventsWithRawResponse: + return EventsWithRawResponse(self) @cached_property - def with_streaming_response(self) -> HijacksWithStreamingResponse: - return HijacksWithStreamingResponse(self) + def with_streaming_response(self) -> EventsWithStreamingResponse: + return EventsWithStreamingResponse(self) - def events( + def list( self, *, date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -81,7 +79,7 @@ def events( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HijackEventsResponse: + ) -> SyncV4PagePagination[EventListResponse]: """Get the BGP hijack events. (Beta) @@ -128,8 +126,9 @@ def events( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/radar/bgp/hijacks/events", + page=SyncV4PagePagination[EventListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -154,24 +153,23 @@ def events( "sort_order": sort_order, "victim_asn": victim_asn, }, - hijack_events_params.HijackEventsParams, + event_list_params.EventListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[HijackEventsResponse], ResultWrapper[HijackEventsResponse]), + model=EventListResponse, ) -class AsyncHijacks(AsyncAPIResource): +class AsyncEvents(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncHijacksWithRawResponse: - return AsyncHijacksWithRawResponse(self) + def with_raw_response(self) -> AsyncEventsWithRawResponse: + return AsyncEventsWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncHijacksWithStreamingResponse: - return AsyncHijacksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEventsWithStreamingResponse: + return AsyncEventsWithStreamingResponse(self) - async def events( + def list( self, *, date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -213,7 +211,7 @@ async def events( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> HijackEventsResponse: + ) -> AsyncPaginator[EventListResponse, AsyncV4PagePagination[EventListResponse]]: """Get the BGP hijack events. (Beta) @@ -260,14 +258,15 @@ async def events( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/radar/bgp/hijacks/events", + page=AsyncV4PagePagination[EventListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "date_end": date_end, "date_range": date_range, @@ -286,45 +285,44 @@ async def events( "sort_order": sort_order, "victim_asn": victim_asn, }, - hijack_events_params.HijackEventsParams, + event_list_params.EventListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[HijackEventsResponse], ResultWrapper[HijackEventsResponse]), + model=EventListResponse, ) -class HijacksWithRawResponse: - def __init__(self, hijacks: Hijacks) -> None: - self._hijacks = hijacks +class EventsWithRawResponse: + def __init__(self, events: Events) -> None: + self._events = events - self.events = to_raw_response_wrapper( - hijacks.events, + self.list = to_raw_response_wrapper( + events.list, ) -class AsyncHijacksWithRawResponse: - def __init__(self, hijacks: AsyncHijacks) -> None: - self._hijacks = hijacks +class AsyncEventsWithRawResponse: + def __init__(self, events: AsyncEvents) -> None: + self._events = events - self.events = async_to_raw_response_wrapper( - hijacks.events, + self.list = async_to_raw_response_wrapper( + events.list, ) -class HijacksWithStreamingResponse: - def __init__(self, hijacks: Hijacks) -> None: - self._hijacks = hijacks +class EventsWithStreamingResponse: + def __init__(self, events: Events) -> None: + self._events = events - self.events = to_streamed_response_wrapper( - hijacks.events, + self.list = to_streamed_response_wrapper( + events.list, ) -class AsyncHijacksWithStreamingResponse: - def __init__(self, hijacks: AsyncHijacks) -> None: - self._hijacks = hijacks +class AsyncEventsWithStreamingResponse: + def __init__(self, events: AsyncEvents) -> None: + self._events = events - self.events = async_to_streamed_response_wrapper( - hijacks.events, + self.list = async_to_streamed_response_wrapper( + events.list, ) diff --git a/src/cloudflare/resources/radar/bgp/hijacks/hijacks.py b/src/cloudflare/resources/radar/bgp/hijacks/hijacks.py new file mode 100644 index 00000000000..f3d51c73d60 --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/hijacks/hijacks.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .events import ( + Events, + AsyncEvents, + EventsWithRawResponse, + AsyncEventsWithRawResponse, + EventsWithStreamingResponse, + AsyncEventsWithStreamingResponse, +) +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["Hijacks", "AsyncHijacks"] + + +class Hijacks(SyncAPIResource): + @cached_property + def events(self) -> Events: + return Events(self._client) + + @cached_property + def with_raw_response(self) -> HijacksWithRawResponse: + return HijacksWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> HijacksWithStreamingResponse: + return HijacksWithStreamingResponse(self) + + +class AsyncHijacks(AsyncAPIResource): + @cached_property + def events(self) -> AsyncEvents: + return AsyncEvents(self._client) + + @cached_property + def with_raw_response(self) -> AsyncHijacksWithRawResponse: + return AsyncHijacksWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncHijacksWithStreamingResponse: + return AsyncHijacksWithStreamingResponse(self) + + +class HijacksWithRawResponse: + def __init__(self, hijacks: Hijacks) -> None: + self._hijacks = hijacks + + @cached_property + def events(self) -> EventsWithRawResponse: + return EventsWithRawResponse(self._hijacks.events) + + +class AsyncHijacksWithRawResponse: + def __init__(self, hijacks: AsyncHijacks) -> None: + self._hijacks = hijacks + + @cached_property + def events(self) -> AsyncEventsWithRawResponse: + return AsyncEventsWithRawResponse(self._hijacks.events) + + +class HijacksWithStreamingResponse: + def __init__(self, hijacks: Hijacks) -> None: + self._hijacks = hijacks + + @cached_property + def events(self) -> EventsWithStreamingResponse: + return EventsWithStreamingResponse(self._hijacks.events) + + +class AsyncHijacksWithStreamingResponse: + def __init__(self, hijacks: AsyncHijacks) -> None: + self._hijacks = hijacks + + @cached_property + def events(self) -> AsyncEventsWithStreamingResponse: + return AsyncEventsWithStreamingResponse(self._hijacks.events) diff --git a/src/cloudflare/resources/radar/bgp/leaks/__init__.py b/src/cloudflare/resources/radar/bgp/leaks/__init__.py new file mode 100644 index 00000000000..465d1ed3402 --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/leaks/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .leaks import ( + Leaks, + AsyncLeaks, + LeaksWithRawResponse, + AsyncLeaksWithRawResponse, + LeaksWithStreamingResponse, + AsyncLeaksWithStreamingResponse, +) +from .events import ( + Events, + AsyncEvents, + EventsWithRawResponse, + AsyncEventsWithRawResponse, + EventsWithStreamingResponse, + AsyncEventsWithStreamingResponse, +) + +__all__ = [ + "Events", + "AsyncEvents", + "EventsWithRawResponse", + "AsyncEventsWithRawResponse", + "EventsWithStreamingResponse", + "AsyncEventsWithStreamingResponse", + "Leaks", + "AsyncLeaks", + "LeaksWithRawResponse", + "AsyncLeaksWithRawResponse", + "LeaksWithStreamingResponse", + "AsyncLeaksWithStreamingResponse", +] diff --git a/src/cloudflare/resources/radar/bgp/leaks.py b/src/cloudflare/resources/radar/bgp/leaks/events.py similarity index 76% rename from src/cloudflare/resources/radar/bgp/leaks.py rename to src/cloudflare/resources/radar/bgp/leaks/events.py index 5de9dda0c71..bb67456f087 100644 --- a/src/cloudflare/resources/radar/bgp/leaks.py +++ b/src/cloudflare/resources/radar/bgp/leaks/events.py @@ -2,44 +2,42 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Union from datetime import datetime 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 ( +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import 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 ( +from .....pagination import SyncV4PagePagination, AsyncV4PagePagination +from ....._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.radar.bgp import LeakEventsResponse, leak_events_params +from .....types.radar.bgp.leaks import EventListResponse, event_list_params -__all__ = ["Leaks", "AsyncLeaks"] +__all__ = ["Events", "AsyncEvents"] -class Leaks(SyncAPIResource): +class Events(SyncAPIResource): @cached_property - def with_raw_response(self) -> LeaksWithRawResponse: - return LeaksWithRawResponse(self) + def with_raw_response(self) -> EventsWithRawResponse: + return EventsWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LeaksWithStreamingResponse: - return LeaksWithStreamingResponse(self) + def with_streaming_response(self) -> EventsWithStreamingResponse: + return EventsWithStreamingResponse(self) - def events( + def list( self, *, date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -77,7 +75,7 @@ def events( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LeakEventsResponse: + ) -> SyncV4PagePagination[EventListResponse]: """ Get the BGP route leak events (Beta). @@ -115,8 +113,9 @@ def events( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/radar/bgp/leaks/events", + page=SyncV4PagePagination[EventListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -137,24 +136,23 @@ def events( "sort_by": sort_by, "sort_order": sort_order, }, - leak_events_params.LeakEventsParams, + event_list_params.EventListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LeakEventsResponse], ResultWrapper[LeakEventsResponse]), + model=EventListResponse, ) -class AsyncLeaks(AsyncAPIResource): +class AsyncEvents(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncLeaksWithRawResponse: - return AsyncLeaksWithRawResponse(self) + def with_raw_response(self) -> AsyncEventsWithRawResponse: + return AsyncEventsWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLeaksWithStreamingResponse: - return AsyncLeaksWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEventsWithStreamingResponse: + return AsyncEventsWithStreamingResponse(self) - async def events( + def list( self, *, date_end: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -192,7 +190,7 @@ async def events( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LeakEventsResponse: + ) -> AsyncPaginator[EventListResponse, AsyncV4PagePagination[EventListResponse]]: """ Get the BGP route leak events (Beta). @@ -230,14 +228,15 @@ async def events( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/radar/bgp/leaks/events", + page=AsyncV4PagePagination[EventListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "date_end": date_end, "date_range": date_range, @@ -252,45 +251,44 @@ async def events( "sort_by": sort_by, "sort_order": sort_order, }, - leak_events_params.LeakEventsParams, + event_list_params.EventListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[LeakEventsResponse], ResultWrapper[LeakEventsResponse]), + model=EventListResponse, ) -class LeaksWithRawResponse: - def __init__(self, leaks: Leaks) -> None: - self._leaks = leaks +class EventsWithRawResponse: + def __init__(self, events: Events) -> None: + self._events = events - self.events = to_raw_response_wrapper( - leaks.events, + self.list = to_raw_response_wrapper( + events.list, ) -class AsyncLeaksWithRawResponse: - def __init__(self, leaks: AsyncLeaks) -> None: - self._leaks = leaks +class AsyncEventsWithRawResponse: + def __init__(self, events: AsyncEvents) -> None: + self._events = events - self.events = async_to_raw_response_wrapper( - leaks.events, + self.list = async_to_raw_response_wrapper( + events.list, ) -class LeaksWithStreamingResponse: - def __init__(self, leaks: Leaks) -> None: - self._leaks = leaks +class EventsWithStreamingResponse: + def __init__(self, events: Events) -> None: + self._events = events - self.events = to_streamed_response_wrapper( - leaks.events, + self.list = to_streamed_response_wrapper( + events.list, ) -class AsyncLeaksWithStreamingResponse: - def __init__(self, leaks: AsyncLeaks) -> None: - self._leaks = leaks +class AsyncEventsWithStreamingResponse: + def __init__(self, events: AsyncEvents) -> None: + self._events = events - self.events = async_to_streamed_response_wrapper( - leaks.events, + self.list = async_to_streamed_response_wrapper( + events.list, ) diff --git a/src/cloudflare/resources/radar/bgp/leaks/leaks.py b/src/cloudflare/resources/radar/bgp/leaks/leaks.py new file mode 100644 index 00000000000..aaf6fe97ffb --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/leaks/leaks.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .events import ( + Events, + AsyncEvents, + EventsWithRawResponse, + AsyncEventsWithRawResponse, + EventsWithStreamingResponse, + AsyncEventsWithStreamingResponse, +) +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["Leaks", "AsyncLeaks"] + + +class Leaks(SyncAPIResource): + @cached_property + def events(self) -> Events: + return Events(self._client) + + @cached_property + def with_raw_response(self) -> LeaksWithRawResponse: + return LeaksWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LeaksWithStreamingResponse: + return LeaksWithStreamingResponse(self) + + +class AsyncLeaks(AsyncAPIResource): + @cached_property + def events(self) -> AsyncEvents: + return AsyncEvents(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLeaksWithRawResponse: + return AsyncLeaksWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLeaksWithStreamingResponse: + return AsyncLeaksWithStreamingResponse(self) + + +class LeaksWithRawResponse: + def __init__(self, leaks: Leaks) -> None: + self._leaks = leaks + + @cached_property + def events(self) -> EventsWithRawResponse: + return EventsWithRawResponse(self._leaks.events) + + +class AsyncLeaksWithRawResponse: + def __init__(self, leaks: AsyncLeaks) -> None: + self._leaks = leaks + + @cached_property + def events(self) -> AsyncEventsWithRawResponse: + return AsyncEventsWithRawResponse(self._leaks.events) + + +class LeaksWithStreamingResponse: + def __init__(self, leaks: Leaks) -> None: + self._leaks = leaks + + @cached_property + def events(self) -> EventsWithStreamingResponse: + return EventsWithStreamingResponse(self._leaks.events) + + +class AsyncLeaksWithStreamingResponse: + def __init__(self, leaks: AsyncLeaks) -> None: + self._leaks = leaks + + @cached_property + def events(self) -> AsyncEventsWithStreamingResponse: + return AsyncEventsWithStreamingResponse(self._leaks.events) diff --git a/src/cloudflare/resources/user/__init__.py b/src/cloudflare/resources/user/__init__.py index f190d6046ea..1cb95227682 100644 --- a/src/cloudflare/resources/user/__init__.py +++ b/src/cloudflare/resources/user/__init__.py @@ -64,13 +64,13 @@ SubscriptionsWithStreamingResponse, AsyncSubscriptionsWithStreamingResponse, ) -from .load_balancers import ( - LoadBalancers, - AsyncLoadBalancers, - LoadBalancersWithRawResponse, - AsyncLoadBalancersWithRawResponse, - LoadBalancersWithStreamingResponse, - AsyncLoadBalancersWithStreamingResponse, +from .load_balancing import ( + LoadBalancing, + AsyncLoadBalancing, + LoadBalancingWithRawResponse, + AsyncLoadBalancingWithRawResponse, + LoadBalancingWithStreamingResponse, + AsyncLoadBalancingWithStreamingResponse, ) __all__ = [ @@ -98,12 +98,12 @@ "AsyncInvitesWithRawResponse", "InvitesWithStreamingResponse", "AsyncInvitesWithStreamingResponse", - "LoadBalancers", - "AsyncLoadBalancers", - "LoadBalancersWithRawResponse", - "AsyncLoadBalancersWithRawResponse", - "LoadBalancersWithStreamingResponse", - "AsyncLoadBalancersWithStreamingResponse", + "LoadBalancing", + "AsyncLoadBalancing", + "LoadBalancingWithRawResponse", + "AsyncLoadBalancingWithRawResponse", + "LoadBalancingWithStreamingResponse", + "AsyncLoadBalancingWithStreamingResponse", "Organizations", "AsyncOrganizations", "OrganizationsWithRawResponse", diff --git a/src/cloudflare/resources/user/billing/history.py b/src/cloudflare/resources/user/billing/history.py index c6662b0ab4a..9a5556c08ed 100644 --- a/src/cloudflare/resources/user/billing/history.py +++ b/src/cloudflare/resources/user/billing/history.py @@ -2,17 +2,14 @@ from __future__ import annotations -from typing import Type, Union, Optional, cast +from typing import Union from datetime import datetime 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 ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -21,11 +18,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._wrappers import ResultWrapper +from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.user.billing import HistoryGetResponse, history_get_params +from ....types.user.billing import BillingHistory, history_list_params __all__ = ["History", "AsyncHistory"] @@ -39,7 +37,7 @@ def with_raw_response(self) -> HistoryWithRawResponse: def with_streaming_response(self) -> HistoryWithStreamingResponse: return HistoryWithStreamingResponse(self) - def get( + def list( self, *, action: str | NotGiven = NOT_GIVEN, @@ -55,7 +53,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HistoryGetResponse]: + ) -> SyncV4PagePaginationArray[BillingHistory]: """ Accesses your billing history object. @@ -82,8 +80,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/user/billing/history", + page=SyncV4PagePaginationArray[BillingHistory], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -99,11 +98,10 @@ def get( "per_page": per_page, "type": type, }, - history_get_params.HistoryGetParams, + history_list_params.HistoryListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[HistoryGetResponse]], ResultWrapper[HistoryGetResponse]), + model=BillingHistory, ) @@ -116,7 +114,7 @@ def with_raw_response(self) -> AsyncHistoryWithRawResponse: def with_streaming_response(self) -> AsyncHistoryWithStreamingResponse: return AsyncHistoryWithStreamingResponse(self) - async def get( + def list( self, *, action: str | NotGiven = NOT_GIVEN, @@ -132,7 +130,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HistoryGetResponse]: + ) -> AsyncPaginator[BillingHistory, AsyncV4PagePaginationArray[BillingHistory]]: """ Accesses your billing history object. @@ -159,14 +157,15 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/user/billing/history", + page=AsyncV4PagePaginationArray[BillingHistory], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "action": action, "occured_at": occured_at, @@ -176,11 +175,10 @@ async def get( "per_page": per_page, "type": type, }, - history_get_params.HistoryGetParams, + history_list_params.HistoryListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[HistoryGetResponse]], ResultWrapper[HistoryGetResponse]), + model=BillingHistory, ) @@ -188,8 +186,8 @@ class HistoryWithRawResponse: def __init__(self, history: History) -> None: self._history = history - self.get = to_raw_response_wrapper( - history.get, + self.list = to_raw_response_wrapper( + history.list, ) @@ -197,8 +195,8 @@ class AsyncHistoryWithRawResponse: def __init__(self, history: AsyncHistory) -> None: self._history = history - self.get = async_to_raw_response_wrapper( - history.get, + self.list = async_to_raw_response_wrapper( + history.list, ) @@ -206,8 +204,8 @@ class HistoryWithStreamingResponse: def __init__(self, history: History) -> None: self._history = history - self.get = to_streamed_response_wrapper( - history.get, + self.list = to_streamed_response_wrapper( + history.list, ) @@ -215,6 +213,6 @@ class AsyncHistoryWithStreamingResponse: def __init__(self, history: AsyncHistory) -> None: self._history = history - self.get = async_to_streamed_response_wrapper( - history.get, + self.list = async_to_streamed_response_wrapper( + history.list, ) diff --git a/src/cloudflare/resources/user/load_balancers/__init__.py b/src/cloudflare/resources/user/load_balancing/__init__.py similarity index 58% rename from src/cloudflare/resources/user/load_balancers/__init__.py rename to src/cloudflare/resources/user/load_balancing/__init__.py index fbc81ccc792..6b715b8da6a 100644 --- a/src/cloudflare/resources/user/load_balancers/__init__.py +++ b/src/cloudflare/resources/user/load_balancing/__init__.py @@ -9,12 +9,12 @@ AsyncPoolsWithStreamingResponse, ) from .preview import ( - PreviewResource, - AsyncPreviewResource, - PreviewResourceWithRawResponse, - AsyncPreviewResourceWithRawResponse, - PreviewResourceWithStreamingResponse, - AsyncPreviewResourceWithStreamingResponse, + Preview, + AsyncPreview, + PreviewWithRawResponse, + AsyncPreviewWithRawResponse, + PreviewWithStreamingResponse, + AsyncPreviewWithStreamingResponse, ) from .monitors import ( Monitors, @@ -32,13 +32,13 @@ AnalyticsWithStreamingResponse, AsyncAnalyticsWithStreamingResponse, ) -from .load_balancers import ( - LoadBalancers, - AsyncLoadBalancers, - LoadBalancersWithRawResponse, - AsyncLoadBalancersWithRawResponse, - LoadBalancersWithStreamingResponse, - AsyncLoadBalancersWithStreamingResponse, +from .load_balancing import ( + LoadBalancing, + AsyncLoadBalancing, + LoadBalancingWithRawResponse, + AsyncLoadBalancingWithRawResponse, + LoadBalancingWithStreamingResponse, + AsyncLoadBalancingWithStreamingResponse, ) __all__ = [ @@ -54,22 +54,22 @@ "AsyncPoolsWithRawResponse", "PoolsWithStreamingResponse", "AsyncPoolsWithStreamingResponse", - "PreviewResource", - "AsyncPreviewResource", - "PreviewResourceWithRawResponse", - "AsyncPreviewResourceWithRawResponse", - "PreviewResourceWithStreamingResponse", - "AsyncPreviewResourceWithStreamingResponse", + "Preview", + "AsyncPreview", + "PreviewWithRawResponse", + "AsyncPreviewWithRawResponse", + "PreviewWithStreamingResponse", + "AsyncPreviewWithStreamingResponse", "Analytics", "AsyncAnalytics", "AnalyticsWithRawResponse", "AsyncAnalyticsWithRawResponse", "AnalyticsWithStreamingResponse", "AsyncAnalyticsWithStreamingResponse", - "LoadBalancers", - "AsyncLoadBalancers", - "LoadBalancersWithRawResponse", - "AsyncLoadBalancersWithRawResponse", - "LoadBalancersWithStreamingResponse", - "AsyncLoadBalancersWithStreamingResponse", + "LoadBalancing", + "AsyncLoadBalancing", + "LoadBalancingWithRawResponse", + "AsyncLoadBalancingWithRawResponse", + "LoadBalancingWithStreamingResponse", + "AsyncLoadBalancingWithStreamingResponse", ] diff --git a/src/cloudflare/resources/user/load_balancers/analytics/__init__.py b/src/cloudflare/resources/user/load_balancing/analytics/__init__.py similarity index 100% rename from src/cloudflare/resources/user/load_balancers/analytics/__init__.py rename to src/cloudflare/resources/user/load_balancing/analytics/__init__.py diff --git a/src/cloudflare/resources/user/load_balancers/analytics/analytics.py b/src/cloudflare/resources/user/load_balancing/analytics/analytics.py similarity index 100% rename from src/cloudflare/resources/user/load_balancers/analytics/analytics.py rename to src/cloudflare/resources/user/load_balancing/analytics/analytics.py diff --git a/src/cloudflare/resources/user/load_balancers/analytics/events.py b/src/cloudflare/resources/user/load_balancing/analytics/events.py similarity index 98% rename from src/cloudflare/resources/user/load_balancers/analytics/events.py rename to src/cloudflare/resources/user/load_balancing/analytics/events.py index 7d778121abf..75cc328e305 100644 --- a/src/cloudflare/resources/user/load_balancers/analytics/events.py +++ b/src/cloudflare/resources/user/load_balancing/analytics/events.py @@ -22,8 +22,8 @@ AsyncPaginator, make_request_options, ) -from .....types.user.load_balancers import Analytics -from .....types.user.load_balancers.analytics import event_list_params +from .....types.user.load_balancing import Analytics +from .....types.user.load_balancing.analytics import event_list_params __all__ = ["Events", "AsyncEvents"] diff --git a/src/cloudflare/resources/user/load_balancers/load_balancers.py b/src/cloudflare/resources/user/load_balancing/load_balancing.py similarity index 50% rename from src/cloudflare/resources/user/load_balancers/load_balancers.py rename to src/cloudflare/resources/user/load_balancing/load_balancing.py index 7f661fbb07f..04b7e0d19ba 100644 --- a/src/cloudflare/resources/user/load_balancers/load_balancers.py +++ b/src/cloudflare/resources/user/load_balancing/load_balancing.py @@ -11,12 +11,12 @@ AsyncPoolsWithStreamingResponse, ) from .preview import ( - PreviewResource, - AsyncPreviewResource, - PreviewResourceWithRawResponse, - AsyncPreviewResourceWithRawResponse, - PreviewResourceWithStreamingResponse, - AsyncPreviewResourceWithStreamingResponse, + Preview, + AsyncPreview, + PreviewWithRawResponse, + AsyncPreviewWithRawResponse, + PreviewWithStreamingResponse, + AsyncPreviewWithStreamingResponse, ) from .monitors import ( Monitors, @@ -38,10 +38,10 @@ from ...._resource import SyncAPIResource, AsyncAPIResource from .analytics.analytics import Analytics, AsyncAnalytics -__all__ = ["LoadBalancers", "AsyncLoadBalancers"] +__all__ = ["LoadBalancing", "AsyncLoadBalancing"] -class LoadBalancers(SyncAPIResource): +class LoadBalancing(SyncAPIResource): @cached_property def monitors(self) -> Monitors: return Monitors(self._client) @@ -51,23 +51,23 @@ def pools(self) -> Pools: return Pools(self._client) @cached_property - def preview(self) -> PreviewResource: - return PreviewResource(self._client) + def preview(self) -> Preview: + return Preview(self._client) @cached_property def analytics(self) -> Analytics: return Analytics(self._client) @cached_property - def with_raw_response(self) -> LoadBalancersWithRawResponse: - return LoadBalancersWithRawResponse(self) + def with_raw_response(self) -> LoadBalancingWithRawResponse: + return LoadBalancingWithRawResponse(self) @cached_property - def with_streaming_response(self) -> LoadBalancersWithStreamingResponse: - return LoadBalancersWithStreamingResponse(self) + def with_streaming_response(self) -> LoadBalancingWithStreamingResponse: + return LoadBalancingWithStreamingResponse(self) -class AsyncLoadBalancers(AsyncAPIResource): +class AsyncLoadBalancing(AsyncAPIResource): @cached_property def monitors(self) -> AsyncMonitors: return AsyncMonitors(self._client) @@ -77,101 +77,101 @@ def pools(self) -> AsyncPools: return AsyncPools(self._client) @cached_property - def preview(self) -> AsyncPreviewResource: - return AsyncPreviewResource(self._client) + def preview(self) -> AsyncPreview: + return AsyncPreview(self._client) @cached_property def analytics(self) -> AsyncAnalytics: return AsyncAnalytics(self._client) @cached_property - def with_raw_response(self) -> AsyncLoadBalancersWithRawResponse: - return AsyncLoadBalancersWithRawResponse(self) + def with_raw_response(self) -> AsyncLoadBalancingWithRawResponse: + return AsyncLoadBalancingWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncLoadBalancersWithStreamingResponse: - return AsyncLoadBalancersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncLoadBalancingWithStreamingResponse: + return AsyncLoadBalancingWithStreamingResponse(self) -class LoadBalancersWithRawResponse: - def __init__(self, load_balancers: LoadBalancers) -> None: - self._load_balancers = load_balancers +class LoadBalancingWithRawResponse: + def __init__(self, load_balancing: LoadBalancing) -> None: + self._load_balancing = load_balancing @cached_property def monitors(self) -> MonitorsWithRawResponse: - return MonitorsWithRawResponse(self._load_balancers.monitors) + return MonitorsWithRawResponse(self._load_balancing.monitors) @cached_property def pools(self) -> PoolsWithRawResponse: - return PoolsWithRawResponse(self._load_balancers.pools) + return PoolsWithRawResponse(self._load_balancing.pools) @cached_property - def preview(self) -> PreviewResourceWithRawResponse: - return PreviewResourceWithRawResponse(self._load_balancers.preview) + def preview(self) -> PreviewWithRawResponse: + return PreviewWithRawResponse(self._load_balancing.preview) @cached_property def analytics(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self._load_balancers.analytics) + return AnalyticsWithRawResponse(self._load_balancing.analytics) -class AsyncLoadBalancersWithRawResponse: - def __init__(self, load_balancers: AsyncLoadBalancers) -> None: - self._load_balancers = load_balancers +class AsyncLoadBalancingWithRawResponse: + def __init__(self, load_balancing: AsyncLoadBalancing) -> None: + self._load_balancing = load_balancing @cached_property def monitors(self) -> AsyncMonitorsWithRawResponse: - return AsyncMonitorsWithRawResponse(self._load_balancers.monitors) + return AsyncMonitorsWithRawResponse(self._load_balancing.monitors) @cached_property def pools(self) -> AsyncPoolsWithRawResponse: - return AsyncPoolsWithRawResponse(self._load_balancers.pools) + return AsyncPoolsWithRawResponse(self._load_balancing.pools) @cached_property - def preview(self) -> AsyncPreviewResourceWithRawResponse: - return AsyncPreviewResourceWithRawResponse(self._load_balancers.preview) + def preview(self) -> AsyncPreviewWithRawResponse: + return AsyncPreviewWithRawResponse(self._load_balancing.preview) @cached_property def analytics(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self._load_balancers.analytics) + return AsyncAnalyticsWithRawResponse(self._load_balancing.analytics) -class LoadBalancersWithStreamingResponse: - def __init__(self, load_balancers: LoadBalancers) -> None: - self._load_balancers = load_balancers +class LoadBalancingWithStreamingResponse: + def __init__(self, load_balancing: LoadBalancing) -> None: + self._load_balancing = load_balancing @cached_property def monitors(self) -> MonitorsWithStreamingResponse: - return MonitorsWithStreamingResponse(self._load_balancers.monitors) + return MonitorsWithStreamingResponse(self._load_balancing.monitors) @cached_property def pools(self) -> PoolsWithStreamingResponse: - return PoolsWithStreamingResponse(self._load_balancers.pools) + return PoolsWithStreamingResponse(self._load_balancing.pools) @cached_property - def preview(self) -> PreviewResourceWithStreamingResponse: - return PreviewResourceWithStreamingResponse(self._load_balancers.preview) + def preview(self) -> PreviewWithStreamingResponse: + return PreviewWithStreamingResponse(self._load_balancing.preview) @cached_property def analytics(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self._load_balancers.analytics) + return AnalyticsWithStreamingResponse(self._load_balancing.analytics) -class AsyncLoadBalancersWithStreamingResponse: - def __init__(self, load_balancers: AsyncLoadBalancers) -> None: - self._load_balancers = load_balancers +class AsyncLoadBalancingWithStreamingResponse: + def __init__(self, load_balancing: AsyncLoadBalancing) -> None: + self._load_balancing = load_balancing @cached_property def monitors(self) -> AsyncMonitorsWithStreamingResponse: - return AsyncMonitorsWithStreamingResponse(self._load_balancers.monitors) + return AsyncMonitorsWithStreamingResponse(self._load_balancing.monitors) @cached_property def pools(self) -> AsyncPoolsWithStreamingResponse: - return AsyncPoolsWithStreamingResponse(self._load_balancers.pools) + return AsyncPoolsWithStreamingResponse(self._load_balancing.pools) @cached_property - def preview(self) -> AsyncPreviewResourceWithStreamingResponse: - return AsyncPreviewResourceWithStreamingResponse(self._load_balancers.preview) + def preview(self) -> AsyncPreviewWithStreamingResponse: + return AsyncPreviewWithStreamingResponse(self._load_balancing.preview) @cached_property def analytics(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self._load_balancers.analytics) + return AsyncAnalyticsWithStreamingResponse(self._load_balancing.analytics) diff --git a/src/cloudflare/resources/user/load_balancers/monitors.py b/src/cloudflare/resources/user/load_balancing/monitors.py similarity index 99% rename from src/cloudflare/resources/user/load_balancers/monitors.py rename to src/cloudflare/resources/user/load_balancing/monitors.py index df03967b45b..bfb0ef30268 100644 --- a/src/cloudflare/resources/user/load_balancers/monitors.py +++ b/src/cloudflare/resources/user/load_balancing/monitors.py @@ -26,7 +26,7 @@ AsyncPaginator, make_request_options, ) -from ....types.user.load_balancers import ( +from ....types.user.load_balancing import ( MonitorGetResponse, MonitorEditResponse, MonitorListResponse, diff --git a/src/cloudflare/resources/user/load_balancers/pools.py b/src/cloudflare/resources/user/load_balancing/pools.py similarity index 99% rename from src/cloudflare/resources/user/load_balancers/pools.py rename to src/cloudflare/resources/user/load_balancing/pools.py index 58b1f964306..3d9fa86e418 100644 --- a/src/cloudflare/resources/user/load_balancers/pools.py +++ b/src/cloudflare/resources/user/load_balancing/pools.py @@ -34,7 +34,7 @@ make_request_options, ) from ....types.load_balancers import Pool -from ....types.user.load_balancers import ( +from ....types.user.load_balancing import ( PoolDeleteResponse, PoolHealthResponse, PoolPreviewResponse, diff --git a/src/cloudflare/resources/user/load_balancers/preview.py b/src/cloudflare/resources/user/load_balancing/preview.py similarity index 75% rename from src/cloudflare/resources/user/load_balancers/preview.py rename to src/cloudflare/resources/user/load_balancing/preview.py index 1e655e816a1..d07b0937420 100644 --- a/src/cloudflare/resources/user/load_balancers/preview.py +++ b/src/cloudflare/resources/user/load_balancing/preview.py @@ -19,19 +19,19 @@ from ...._base_client import ( make_request_options, ) -from ....types.user.load_balancers import Preview +from ....types.user.load_balancing import PreviewGetResponse -__all__ = ["PreviewResource", "AsyncPreviewResource"] +__all__ = ["Preview", "AsyncPreview"] -class PreviewResource(SyncAPIResource): +class Preview(SyncAPIResource): @cached_property - def with_raw_response(self) -> PreviewResourceWithRawResponse: - return PreviewResourceWithRawResponse(self) + def with_raw_response(self) -> PreviewWithRawResponse: + return PreviewWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PreviewResourceWithStreamingResponse: - return PreviewResourceWithStreamingResponse(self) + def with_streaming_response(self) -> PreviewWithStreamingResponse: + return PreviewWithStreamingResponse(self) def get( self, @@ -43,7 +43,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Preview: + ) -> PreviewGetResponse: """ Get the result of a previous preview operation using the provided preview_id. @@ -67,18 +67,18 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Preview], ResultWrapper[Preview]), + cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]), ) -class AsyncPreviewResource(AsyncAPIResource): +class AsyncPreview(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPreviewResourceWithRawResponse: - return AsyncPreviewResourceWithRawResponse(self) + def with_raw_response(self) -> AsyncPreviewWithRawResponse: + return AsyncPreviewWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPreviewResourceWithStreamingResponse: - return AsyncPreviewResourceWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPreviewWithStreamingResponse: + return AsyncPreviewWithStreamingResponse(self) async def get( self, @@ -90,7 +90,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Preview: + ) -> PreviewGetResponse: """ Get the result of a previous preview operation using the provided preview_id. @@ -114,12 +114,12 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Preview], ResultWrapper[Preview]), + cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]), ) -class PreviewResourceWithRawResponse: - def __init__(self, preview: PreviewResource) -> None: +class PreviewWithRawResponse: + def __init__(self, preview: Preview) -> None: self._preview = preview self.get = to_raw_response_wrapper( @@ -127,8 +127,8 @@ def __init__(self, preview: PreviewResource) -> None: ) -class AsyncPreviewResourceWithRawResponse: - def __init__(self, preview: AsyncPreviewResource) -> None: +class AsyncPreviewWithRawResponse: + def __init__(self, preview: AsyncPreview) -> None: self._preview = preview self.get = async_to_raw_response_wrapper( @@ -136,8 +136,8 @@ def __init__(self, preview: AsyncPreviewResource) -> None: ) -class PreviewResourceWithStreamingResponse: - def __init__(self, preview: PreviewResource) -> None: +class PreviewWithStreamingResponse: + def __init__(self, preview: Preview) -> None: self._preview = preview self.get = to_streamed_response_wrapper( @@ -145,8 +145,8 @@ def __init__(self, preview: PreviewResource) -> None: ) -class AsyncPreviewResourceWithStreamingResponse: - def __init__(self, preview: AsyncPreviewResource) -> None: +class AsyncPreviewWithStreamingResponse: + def __init__(self, preview: AsyncPreview) -> None: self._preview = preview self.get = async_to_streamed_response_wrapper( diff --git a/src/cloudflare/resources/user/user.py b/src/cloudflare/resources/user/user.py index 3371adbe3c5..cc4e39f3a45 100644 --- a/src/cloudflare/resources/user/user.py +++ b/src/cloudflare/resources/user/user.py @@ -82,17 +82,17 @@ make_request_options, ) from ...types.shared import UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a -from .load_balancers import ( - LoadBalancers, - AsyncLoadBalancers, - LoadBalancersWithRawResponse, - AsyncLoadBalancersWithRawResponse, - LoadBalancersWithStreamingResponse, - AsyncLoadBalancersWithStreamingResponse, +from .load_balancing import ( + LoadBalancing, + AsyncLoadBalancing, + LoadBalancingWithRawResponse, + AsyncLoadBalancingWithRawResponse, + LoadBalancingWithStreamingResponse, + AsyncLoadBalancingWithStreamingResponse, ) from .billing.billing import Billing, AsyncBilling from .firewall.firewall import Firewall, AsyncFirewall -from .load_balancers.load_balancers import LoadBalancers, AsyncLoadBalancers +from .load_balancing.load_balancing import LoadBalancing, AsyncLoadBalancing __all__ = ["User", "AsyncUser"] @@ -115,8 +115,8 @@ def invites(self) -> Invites: return Invites(self._client) @cached_property - def load_balancers(self) -> LoadBalancers: - return LoadBalancers(self._client) + def load_balancing(self) -> LoadBalancing: + return LoadBalancing(self._client) @cached_property def organizations(self) -> Organizations: @@ -249,8 +249,8 @@ def invites(self) -> AsyncInvites: return AsyncInvites(self._client) @cached_property - def load_balancers(self) -> AsyncLoadBalancers: - return AsyncLoadBalancers(self._client) + def load_balancing(self) -> AsyncLoadBalancing: + return AsyncLoadBalancing(self._client) @cached_property def organizations(self) -> AsyncOrganizations: @@ -393,8 +393,8 @@ def invites(self) -> InvitesWithRawResponse: return InvitesWithRawResponse(self._user.invites) @cached_property - def load_balancers(self) -> LoadBalancersWithRawResponse: - return LoadBalancersWithRawResponse(self._user.load_balancers) + def load_balancing(self) -> LoadBalancingWithRawResponse: + return LoadBalancingWithRawResponse(self._user.load_balancing) @cached_property def organizations(self) -> OrganizationsWithRawResponse: @@ -437,8 +437,8 @@ def invites(self) -> AsyncInvitesWithRawResponse: return AsyncInvitesWithRawResponse(self._user.invites) @cached_property - def load_balancers(self) -> AsyncLoadBalancersWithRawResponse: - return AsyncLoadBalancersWithRawResponse(self._user.load_balancers) + def load_balancing(self) -> AsyncLoadBalancingWithRawResponse: + return AsyncLoadBalancingWithRawResponse(self._user.load_balancing) @cached_property def organizations(self) -> AsyncOrganizationsWithRawResponse: @@ -481,8 +481,8 @@ def invites(self) -> InvitesWithStreamingResponse: return InvitesWithStreamingResponse(self._user.invites) @cached_property - def load_balancers(self) -> LoadBalancersWithStreamingResponse: - return LoadBalancersWithStreamingResponse(self._user.load_balancers) + def load_balancing(self) -> LoadBalancingWithStreamingResponse: + return LoadBalancingWithStreamingResponse(self._user.load_balancing) @cached_property def organizations(self) -> OrganizationsWithStreamingResponse: @@ -525,8 +525,8 @@ def invites(self) -> AsyncInvitesWithStreamingResponse: return AsyncInvitesWithStreamingResponse(self._user.invites) @cached_property - def load_balancers(self) -> AsyncLoadBalancersWithStreamingResponse: - return AsyncLoadBalancersWithStreamingResponse(self._user.load_balancers) + def load_balancing(self) -> AsyncLoadBalancingWithStreamingResponse: + return AsyncLoadBalancingWithStreamingResponse(self._user.load_balancing) @cached_property def organizations(self) -> AsyncOrganizationsWithStreamingResponse: diff --git a/src/cloudflare/types/intel/__init__.py b/src/cloudflare/types/intel/__init__.py index ec3642b8432..2cb97e70899 100644 --- a/src/cloudflare/types/intel/__init__.py +++ b/src/cloudflare/types/intel/__init__.py @@ -11,10 +11,11 @@ from .dns_param import DNSParam as DNSParam from .ip_get_params import IPGetParams as IPGetParams from .sinkhole_item import SinkholeItem as SinkholeItem -from .dns_get_params import DNSGetParams as DNSGetParams from .domain_history import DomainHistory as DomainHistory +from .dns_list_params import DNSListParams as DNSListParams from .ip_get_response import IPGetResponse as IPGetResponse from .whois_get_params import WhoisGetParams as WhoisGetParams +from .dns_list_response import DNSListResponse as DNSListResponse from .domain_get_params import DomainGetParams as DomainGetParams from .ip_list_get_response import IPListGetResponse as IPListGetResponse from .domain_history_get_params import DomainHistoryGetParams as DomainHistoryGetParams diff --git a/src/cloudflare/types/intel/dns_get_params.py b/src/cloudflare/types/intel/dns_list_params.py similarity index 89% rename from src/cloudflare/types/intel/dns_get_params.py rename to src/cloudflare/types/intel/dns_list_params.py index 3bc9fc3bdc7..1937591d655 100644 --- a/src/cloudflare/types/intel/dns_get_params.py +++ b/src/cloudflare/types/intel/dns_list_params.py @@ -8,10 +8,10 @@ from ..._utils import PropertyInfo -__all__ = ["DNSGetParams", "StartEndParams"] +__all__ = ["DNSListParams", "StartEndParams"] -class DNSGetParams(TypedDict, total=False): +class DNSListParams(TypedDict, total=False): account_id: Required[str] """Identifier""" diff --git a/src/cloudflare/types/intel/dns_list_response.py b/src/cloudflare/types/intel/dns_list_response.py new file mode 100644 index 00000000000..9f5e1bae0be --- /dev/null +++ b/src/cloudflare/types/intel/dns_list_response.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from .dns import DNS +from ..shared import ResponseInfo +from ..._models import BaseModel + +__all__ = ["DNSListResponse"] + + +class DNSListResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + result: DNS + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/load_balancers/__init__.py b/src/cloudflare/types/load_balancers/__init__.py index 402466a6f48..a7e6c17cea9 100644 --- a/src/cloudflare/types/load_balancers/__init__.py +++ b/src/cloudflare/types/load_balancers/__init__.py @@ -15,6 +15,7 @@ from .search_get_response import SearchGetResponse as SearchGetResponse from .monitor_get_response import MonitorGetResponse as MonitorGetResponse from .pool_delete_response import PoolDeleteResponse as PoolDeleteResponse +from .preview_get_response import PreviewGetResponse as PreviewGetResponse from .monitor_create_params import MonitorCreateParams as MonitorCreateParams from .monitor_delete_params import MonitorDeleteParams as MonitorDeleteParams from .monitor_edit_response import MonitorEditResponse as MonitorEditResponse diff --git a/src/cloudflare/types/load_balancers/preview_get_response.py b/src/cloudflare/types/load_balancers/preview_get_response.py new file mode 100644 index 00000000000..60d5ed36be9 --- /dev/null +++ b/src/cloudflare/types/load_balancers/preview_get_response.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from ..._models import BaseModel + +__all__ = [ + "PreviewGetResponse", + "PreviewGetResponseItem", + "PreviewGetResponseItemOriginPreviewGetResponseItemOriginItem", +] + + +class PreviewGetResponseItemOriginPreviewGetResponseItemOriginItem(BaseModel): + failure_reason: Optional[str] = None + + healthy: Optional[bool] = None + + response_code: Optional[float] = None + + rtt: Optional[str] = None + + +class PreviewGetResponseItem(BaseModel): + healthy: Optional[bool] = None + + origins: Optional[List[Dict[str, PreviewGetResponseItemOriginPreviewGetResponseItemOriginItem]]] = None + + +PreviewGetResponse = Dict[str, PreviewGetResponseItem] diff --git a/src/cloudflare/types/radar/bgp/__init__.py b/src/cloudflare/types/radar/bgp/__init__.py index 2a16e34dabb..d1bc53367b3 100644 --- a/src/cloudflare/types/radar/bgp/__init__.py +++ b/src/cloudflare/types/radar/bgp/__init__.py @@ -3,16 +3,12 @@ from __future__ import annotations from .route_moas_params import RouteMoasParams as RouteMoasParams -from .leak_events_params import LeakEventsParams as LeakEventsParams from .route_stats_params import RouteStatsParams as RouteStatsParams from .route_moas_response import RouteMoasResponse as RouteMoasResponse from .route_pfx2as_params import RoutePfx2asParams as RoutePfx2asParams from .top_prefixes_params import TopPrefixesParams as TopPrefixesParams -from .hijack_events_params import HijackEventsParams as HijackEventsParams -from .leak_events_response import LeakEventsResponse as LeakEventsResponse from .route_stats_response import RouteStatsResponse as RouteStatsResponse from .route_pfx2as_response import RoutePfx2asResponse as RoutePfx2asResponse from .top_prefixes_response import TopPrefixesResponse as TopPrefixesResponse -from .hijack_events_response import HijackEventsResponse as HijackEventsResponse from .route_timeseries_params import RouteTimeseriesParams as RouteTimeseriesParams from .route_timeseries_response import RouteTimeseriesResponse as RouteTimeseriesResponse diff --git a/src/cloudflare/types/radar/bgp/hijacks/__init__.py b/src/cloudflare/types/radar/bgp/hijacks/__init__.py new file mode 100644 index 00000000000..c9d802c01db --- /dev/null +++ b/src/cloudflare/types/radar/bgp/hijacks/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .event_list_params import EventListParams as EventListParams +from .event_list_response import EventListResponse as EventListResponse diff --git a/src/cloudflare/types/radar/bgp/hijack_events_params.py b/src/cloudflare/types/radar/bgp/hijacks/event_list_params.py similarity index 95% rename from src/cloudflare/types/radar/bgp/hijack_events_params.py rename to src/cloudflare/types/radar/bgp/hijacks/event_list_params.py index 8c22813f0bf..8bceb23cf4f 100644 --- a/src/cloudflare/types/radar/bgp/hijack_events_params.py +++ b/src/cloudflare/types/radar/bgp/hijacks/event_list_params.py @@ -6,12 +6,12 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict -from ...._utils import PropertyInfo +from ....._utils import PropertyInfo -__all__ = ["HijackEventsParams"] +__all__ = ["EventListParams"] -class HijackEventsParams(TypedDict, total=False): +class EventListParams(TypedDict, total=False): date_end: Annotated[Union[str, datetime], PropertyInfo(alias="dateEnd", format="iso8601")] """End of the date range (inclusive).""" diff --git a/src/cloudflare/types/radar/bgp/hijack_events_response.py b/src/cloudflare/types/radar/bgp/hijacks/event_list_response.py similarity index 53% rename from src/cloudflare/types/radar/bgp/hijack_events_response.py rename to src/cloudflare/types/radar/bgp/hijacks/event_list_response.py index 2ef0458dd56..1d28e50b2f5 100644 --- a/src/cloudflare/types/radar/bgp/hijack_events_response.py +++ b/src/cloudflare/types/radar/bgp/hijacks/event_list_response.py @@ -2,12 +2,12 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel -__all__ = ["HijackEventsResponse", "ASNInfo", "Event", "EventTag"] +__all__ = ["EventListResponse", "Result", "ResultASNInfo", "ResultEvent", "ResultEventTag", "ResultInfo"] -class ASNInfo(BaseModel): +class ResultASNInfo(BaseModel): asn: int country_code: str @@ -15,13 +15,13 @@ class ASNInfo(BaseModel): org_name: str -class EventTag(BaseModel): +class ResultEventTag(BaseModel): name: str score: int -class Event(BaseModel): +class ResultEvent(BaseModel): id: int confidence_score: int @@ -52,16 +52,34 @@ class Event(BaseModel): prefixes: List[str] - tags: List[EventTag] + tags: List[ResultEventTag] victim_asns: List[int] victim_countries: List[str] -class HijackEventsResponse(BaseModel): - asn_info: List[ASNInfo] +class Result(BaseModel): + asn_info: List[ResultASNInfo] - events: List[Event] + events: List[ResultEvent] total_monitors: int + + +class ResultInfo(BaseModel): + count: int + + page: int + + per_page: int + + total_count: int + + +class EventListResponse(BaseModel): + result: Result + + result_info: ResultInfo + + success: bool diff --git a/src/cloudflare/types/radar/bgp/leak_events_response.py b/src/cloudflare/types/radar/bgp/leak_events_response.py deleted file mode 100644 index 664756ba64e..00000000000 --- a/src/cloudflare/types/radar/bgp/leak_events_response.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel - -__all__ = ["LeakEventsResponse", "ASNInfo", "Event"] - - -class ASNInfo(BaseModel): - asn: int - - country_code: str - - org_name: str - - -class Event(BaseModel): - id: int - - countries: List[str] - - detected_ts: str - - finished: bool - - leak_asn: int - - leak_count: int - - leak_seg: List[int] - - leak_type: int - - max_ts: str - - min_ts: str - - origin_count: int - - peer_count: int - - prefix_count: int - - -class LeakEventsResponse(BaseModel): - asn_info: List[ASNInfo] - - events: List[Event] diff --git a/src/cloudflare/types/radar/bgp/leaks/__init__.py b/src/cloudflare/types/radar/bgp/leaks/__init__.py new file mode 100644 index 00000000000..c9d802c01db --- /dev/null +++ b/src/cloudflare/types/radar/bgp/leaks/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .event_list_params import EventListParams as EventListParams +from .event_list_response import EventListResponse as EventListResponse diff --git a/src/cloudflare/types/radar/bgp/leak_events_params.py b/src/cloudflare/types/radar/bgp/leaks/event_list_params.py similarity index 94% rename from src/cloudflare/types/radar/bgp/leak_events_params.py rename to src/cloudflare/types/radar/bgp/leaks/event_list_params.py index 17d0e4a0e09..c67ff410944 100644 --- a/src/cloudflare/types/radar/bgp/leak_events_params.py +++ b/src/cloudflare/types/radar/bgp/leaks/event_list_params.py @@ -6,12 +6,12 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict -from ...._utils import PropertyInfo +from ....._utils import PropertyInfo -__all__ = ["LeakEventsParams"] +__all__ = ["EventListParams"] -class LeakEventsParams(TypedDict, total=False): +class EventListParams(TypedDict, total=False): date_end: Annotated[Union[str, datetime], PropertyInfo(alias="dateEnd", format="iso8601")] """End of the date range (inclusive).""" diff --git a/src/cloudflare/types/radar/bgp/leaks/event_list_response.py b/src/cloudflare/types/radar/bgp/leaks/event_list_response.py new file mode 100644 index 00000000000..2a5447b0399 --- /dev/null +++ b/src/cloudflare/types/radar/bgp/leaks/event_list_response.py @@ -0,0 +1,67 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel + +__all__ = ["EventListResponse", "Result", "ResultASNInfo", "ResultEvent", "ResultInfo"] + + +class ResultASNInfo(BaseModel): + asn: int + + country_code: str + + org_name: str + + +class ResultEvent(BaseModel): + id: int + + countries: List[str] + + detected_ts: str + + finished: bool + + leak_asn: int + + leak_count: int + + leak_seg: List[int] + + leak_type: int + + max_ts: str + + min_ts: str + + origin_count: int + + peer_count: int + + prefix_count: int + + +class Result(BaseModel): + asn_info: List[ResultASNInfo] + + events: List[ResultEvent] + + +class ResultInfo(BaseModel): + count: int + + page: int + + per_page: int + + total_count: int + + +class EventListResponse(BaseModel): + result: Result + + result_info: ResultInfo + + success: bool diff --git a/src/cloudflare/types/shared/unnamed_schema_ref_33f2e3917f3fe46ad98af0acbb1d9a19.py b/src/cloudflare/types/shared/unnamed_schema_ref_33f2e3917f3fe46ad98af0acbb1d9a19.py index 5af22b0a31d..cf2899cec22 100644 --- a/src/cloudflare/types/shared/unnamed_schema_ref_33f2e3917f3fe46ad98af0acbb1d9a19.py +++ b/src/cloudflare/types/shared/unnamed_schema_ref_33f2e3917f3fe46ad98af0acbb1d9a19.py @@ -5,9 +5,14 @@ from typing_extensions import Literal from ..._models import BaseModel -from ..zero_trust import WARPConnectorTunnel -__all__ = ["UnnamedSchemaRef33f2e3917f3fe46ad98af0acbb1d9a19", "TunnelCfdTunnel", "TunnelCfdTunnelConnection"] +__all__ = [ + "UnnamedSchemaRef33f2e3917f3fe46ad98af0acbb1d9a19", + "TunnelCfdTunnel", + "TunnelCfdTunnelConnection", + "TunnelWARPConnectorTunnel", + "TunnelWARPConnectorTunnelConnection", +] class TunnelCfdTunnelConnection(BaseModel): @@ -97,4 +102,85 @@ class TunnelCfdTunnel(BaseModel): """The type of tunnel.""" -UnnamedSchemaRef33f2e3917f3fe46ad98af0acbb1d9a19 = Union[TunnelCfdTunnel, WARPConnectorTunnel] +class TunnelWARPConnectorTunnelConnection(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[object] = None + """UUID of the cloudflared instance.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = 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.""" + + +UnnamedSchemaRef33f2e3917f3fe46ad98af0acbb1d9a19 = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/user/billing/__init__.py b/src/cloudflare/types/user/billing/__init__.py index 6839137c981..df6493c8b62 100644 --- a/src/cloudflare/types/user/billing/__init__.py +++ b/src/cloudflare/types/user/billing/__init__.py @@ -3,5 +3,4 @@ from __future__ import annotations from .billing_history import BillingHistory as BillingHistory -from .history_get_params import HistoryGetParams as HistoryGetParams -from .history_get_response import HistoryGetResponse as HistoryGetResponse +from .history_list_params import HistoryListParams as HistoryListParams diff --git a/src/cloudflare/types/user/billing/history_get_response.py b/src/cloudflare/types/user/billing/history_get_response.py deleted file mode 100644 index a3679cab400..00000000000 --- a/src/cloudflare/types/user/billing/history_get_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .billing_history import BillingHistory - -__all__ = ["HistoryGetResponse"] - -HistoryGetResponse = List[BillingHistory] diff --git a/src/cloudflare/types/user/billing/history_get_params.py b/src/cloudflare/types/user/billing/history_list_params.py similarity index 91% rename from src/cloudflare/types/user/billing/history_get_params.py rename to src/cloudflare/types/user/billing/history_list_params.py index 9a7a92aa257..fa4ce0d1076 100644 --- a/src/cloudflare/types/user/billing/history_get_params.py +++ b/src/cloudflare/types/user/billing/history_list_params.py @@ -8,10 +8,10 @@ from ...._utils import PropertyInfo -__all__ = ["HistoryGetParams"] +__all__ = ["HistoryListParams"] -class HistoryGetParams(TypedDict, total=False): +class HistoryListParams(TypedDict, total=False): action: str """The billing item action.""" diff --git a/src/cloudflare/types/user/load_balancers/preview.py b/src/cloudflare/types/user/load_balancers/preview.py deleted file mode 100644 index d27357a1346..00000000000 --- a/src/cloudflare/types/user/load_balancers/preview.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional - -from ...._models import BaseModel - -__all__ = ["Preview", "PreviewItem", "PreviewItemOriginPreviewItemOriginItem"] - - -class PreviewItemOriginPreviewItemOriginItem(BaseModel): - failure_reason: Optional[str] = None - - healthy: Optional[bool] = None - - response_code: Optional[float] = None - - rtt: Optional[str] = None - - -class PreviewItem(BaseModel): - healthy: Optional[bool] = None - - origins: Optional[List[Dict[str, PreviewItemOriginPreviewItemOriginItem]]] = None - - -Preview = Dict[str, PreviewItem] diff --git a/src/cloudflare/types/user/load_balancers/__init__.py b/src/cloudflare/types/user/load_balancing/__init__.py similarity index 96% rename from src/cloudflare/types/user/load_balancers/__init__.py rename to src/cloudflare/types/user/load_balancing/__init__.py index 48873b0a4e7..1ff9c933d63 100644 --- a/src/cloudflare/types/user/load_balancers/__init__.py +++ b/src/cloudflare/types/user/load_balancing/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from .preview import Preview as Preview from .analytics import Analytics as Analytics from .pool_edit_params import PoolEditParams as PoolEditParams from .pool_list_params import PoolListParams as PoolListParams @@ -14,6 +13,7 @@ from .monitor_get_response import MonitorGetResponse as MonitorGetResponse from .pool_delete_response import PoolDeleteResponse as PoolDeleteResponse from .pool_health_response import PoolHealthResponse as PoolHealthResponse +from .preview_get_response import PreviewGetResponse as PreviewGetResponse from .monitor_create_params import MonitorCreateParams as MonitorCreateParams from .monitor_delete_params import MonitorDeleteParams as MonitorDeleteParams from .monitor_edit_response import MonitorEditResponse as MonitorEditResponse diff --git a/src/cloudflare/types/user/load_balancers/analytics/__init__.py b/src/cloudflare/types/user/load_balancing/analytics/__init__.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/analytics/__init__.py rename to src/cloudflare/types/user/load_balancing/analytics/__init__.py diff --git a/src/cloudflare/types/user/load_balancers/analytics/analytics.py b/src/cloudflare/types/user/load_balancing/analytics/analytics.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/analytics/analytics.py rename to src/cloudflare/types/user/load_balancing/analytics/analytics.py diff --git a/src/cloudflare/types/user/load_balancers/analytics/event_list_params.py b/src/cloudflare/types/user/load_balancing/analytics/event_list_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/analytics/event_list_params.py rename to src/cloudflare/types/user/load_balancing/analytics/event_list_params.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_create_params.py b/src/cloudflare/types/user/load_balancing/monitor_create_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_create_params.py rename to src/cloudflare/types/user/load_balancing/monitor_create_params.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_create_response.py b/src/cloudflare/types/user/load_balancing/monitor_create_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_create_response.py rename to src/cloudflare/types/user/load_balancing/monitor_create_response.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_delete_params.py b/src/cloudflare/types/user/load_balancing/monitor_delete_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_delete_params.py rename to src/cloudflare/types/user/load_balancing/monitor_delete_params.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_delete_response.py b/src/cloudflare/types/user/load_balancing/monitor_delete_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_delete_response.py rename to src/cloudflare/types/user/load_balancing/monitor_delete_response.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_edit_params.py b/src/cloudflare/types/user/load_balancing/monitor_edit_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_edit_params.py rename to src/cloudflare/types/user/load_balancing/monitor_edit_params.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_edit_response.py b/src/cloudflare/types/user/load_balancing/monitor_edit_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_edit_response.py rename to src/cloudflare/types/user/load_balancing/monitor_edit_response.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_get_response.py b/src/cloudflare/types/user/load_balancing/monitor_get_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_get_response.py rename to src/cloudflare/types/user/load_balancing/monitor_get_response.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_list_response.py b/src/cloudflare/types/user/load_balancing/monitor_list_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_list_response.py rename to src/cloudflare/types/user/load_balancing/monitor_list_response.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_preview_params.py b/src/cloudflare/types/user/load_balancing/monitor_preview_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_preview_params.py rename to src/cloudflare/types/user/load_balancing/monitor_preview_params.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_preview_response.py b/src/cloudflare/types/user/load_balancing/monitor_preview_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_preview_response.py rename to src/cloudflare/types/user/load_balancing/monitor_preview_response.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_references_response.py b/src/cloudflare/types/user/load_balancing/monitor_references_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_references_response.py rename to src/cloudflare/types/user/load_balancing/monitor_references_response.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_update_params.py b/src/cloudflare/types/user/load_balancing/monitor_update_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_update_params.py rename to src/cloudflare/types/user/load_balancing/monitor_update_params.py diff --git a/src/cloudflare/types/user/load_balancers/monitor_update_response.py b/src/cloudflare/types/user/load_balancing/monitor_update_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/monitor_update_response.py rename to src/cloudflare/types/user/load_balancing/monitor_update_response.py diff --git a/src/cloudflare/types/user/load_balancers/pool_create_params.py b/src/cloudflare/types/user/load_balancing/pool_create_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_create_params.py rename to src/cloudflare/types/user/load_balancing/pool_create_params.py diff --git a/src/cloudflare/types/user/load_balancers/pool_delete_params.py b/src/cloudflare/types/user/load_balancing/pool_delete_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_delete_params.py rename to src/cloudflare/types/user/load_balancing/pool_delete_params.py diff --git a/src/cloudflare/types/user/load_balancers/pool_delete_response.py b/src/cloudflare/types/user/load_balancing/pool_delete_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_delete_response.py rename to src/cloudflare/types/user/load_balancing/pool_delete_response.py diff --git a/src/cloudflare/types/user/load_balancers/pool_edit_params.py b/src/cloudflare/types/user/load_balancing/pool_edit_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_edit_params.py rename to src/cloudflare/types/user/load_balancing/pool_edit_params.py diff --git a/src/cloudflare/types/user/load_balancers/pool_health_response.py b/src/cloudflare/types/user/load_balancing/pool_health_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_health_response.py rename to src/cloudflare/types/user/load_balancing/pool_health_response.py diff --git a/src/cloudflare/types/user/load_balancers/pool_list_params.py b/src/cloudflare/types/user/load_balancing/pool_list_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_list_params.py rename to src/cloudflare/types/user/load_balancing/pool_list_params.py diff --git a/src/cloudflare/types/user/load_balancers/pool_preview_params.py b/src/cloudflare/types/user/load_balancing/pool_preview_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_preview_params.py rename to src/cloudflare/types/user/load_balancing/pool_preview_params.py diff --git a/src/cloudflare/types/user/load_balancers/pool_preview_response.py b/src/cloudflare/types/user/load_balancing/pool_preview_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_preview_response.py rename to src/cloudflare/types/user/load_balancing/pool_preview_response.py diff --git a/src/cloudflare/types/user/load_balancers/pool_references_response.py b/src/cloudflare/types/user/load_balancing/pool_references_response.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_references_response.py rename to src/cloudflare/types/user/load_balancing/pool_references_response.py diff --git a/src/cloudflare/types/user/load_balancers/pool_update_params.py b/src/cloudflare/types/user/load_balancing/pool_update_params.py similarity index 100% rename from src/cloudflare/types/user/load_balancers/pool_update_params.py rename to src/cloudflare/types/user/load_balancing/pool_update_params.py diff --git a/src/cloudflare/types/user/load_balancing/preview_get_response.py b/src/cloudflare/types/user/load_balancing/preview_get_response.py new file mode 100644 index 00000000000..aefa03cc917 --- /dev/null +++ b/src/cloudflare/types/user/load_balancing/preview_get_response.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from ...._models import BaseModel + +__all__ = [ + "PreviewGetResponse", + "PreviewGetResponseItem", + "PreviewGetResponseItemOriginPreviewGetResponseItemOriginItem", +] + + +class PreviewGetResponseItemOriginPreviewGetResponseItemOriginItem(BaseModel): + failure_reason: Optional[str] = None + + healthy: Optional[bool] = None + + response_code: Optional[float] = None + + rtt: Optional[str] = None + + +class PreviewGetResponseItem(BaseModel): + healthy: Optional[bool] = None + + origins: Optional[List[Dict[str, PreviewGetResponseItemOriginPreviewGetResponseItemOriginItem]]] = None + + +PreviewGetResponse = Dict[str, PreviewGetResponseItem] diff --git a/src/cloudflare/types/warp_connector.py b/src/cloudflare/types/warp_connector.py index 6141b142e4b..c8ba2fe49b5 100644 --- a/src/cloudflare/types/warp_connector.py +++ b/src/cloudflare/types/warp_connector.py @@ -5,9 +5,14 @@ from typing_extensions import Literal from .._models import BaseModel -from .zero_trust import WARPConnectorTunnel -__all__ = ["WARPConnector", "TunnelCfdTunnel", "TunnelCfdTunnelConnection"] +__all__ = [ + "WARPConnector", + "TunnelCfdTunnel", + "TunnelCfdTunnelConnection", + "TunnelWARPConnectorTunnel", + "TunnelWARPConnectorTunnelConnection", +] class TunnelCfdTunnelConnection(BaseModel): @@ -97,4 +102,85 @@ class TunnelCfdTunnel(BaseModel): """The type of tunnel.""" -WARPConnector = Union[TunnelCfdTunnel, WARPConnectorTunnel] +class TunnelWARPConnectorTunnelConnection(BaseModel): + id: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + client_id: Optional[object] = None + """UUID of the cloudflared instance.""" + + client_version: Optional[str] = None + """The cloudflared version used to establish this connection.""" + + colo_name: Optional[str] = None + """The Cloudflare data center used for this connection.""" + + is_pending_reconnect: Optional[bool] = None + """ + Cloudflare continues to track connections for several minutes after they + disconnect. This is an optimization to improve latency and reliability of + reconnecting. If `true`, the connection has disconnected but is still being + tracked. If `false`, the connection is actively serving traffic. + """ + + opened_at: Optional[datetime] = None + """Timestamp of when the connection was established.""" + + origin_ip: Optional[str] = None + """The public IP address of the host running cloudflared.""" + + uuid: Optional[str] = None + """UUID of the Cloudflare Tunnel connection.""" + + +class TunnelWARPConnectorTunnel(BaseModel): + id: Optional[str] = None + """UUID of the tunnel.""" + + account_tag: Optional[str] = None + """Cloudflare account ID""" + + connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = 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.""" + + +WARPConnector = Union[TunnelCfdTunnel, TunnelWARPConnectorTunnel] diff --git a/src/cloudflare/types/zero_trust/__init__.py b/src/cloudflare/types/zero_trust/__init__.py index 7269a131f1e..33f2bb57fa3 100644 --- a/src/cloudflare/types/zero_trust/__init__.py +++ b/src/cloudflare/types/zero_trust/__init__.py @@ -48,7 +48,6 @@ from .gateway_list_response import GatewayListResponse as GatewayListResponse from .okta_group_rule_param import OktaGroupRuleParam as OktaGroupRuleParam from .saml_group_rule_param import SAMLGroupRuleParam as SAMLGroupRuleParam -from .warp_connector_tunnel import WARPConnectorTunnel as WARPConnectorTunnel from .azure_group_rule_param import AzureGroupRuleParam as AzureGroupRuleParam from .certificate_rule_param import CertificateRuleParam as CertificateRuleParam from .identity_provider_type import IdentityProviderType as IdentityProviderType diff --git a/src/cloudflare/types/zero_trust/warp_connector_tunnel.py b/src/cloudflare/types/zero_trust/warp_connector_tunnel.py deleted file mode 100644 index 8ba61e6d86c..00000000000 --- a/src/cloudflare/types/zero_trust/warp_connector_tunnel.py +++ /dev/null @@ -1,90 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["WARPConnectorTunnel", "Connection"] - - -class Connection(BaseModel): - id: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - client_id: Optional[object] = None - """UUID of the cloudflared instance.""" - - client_version: Optional[str] = None - """The cloudflared version used to establish this connection.""" - - colo_name: Optional[str] = None - """The Cloudflare data center used for this connection.""" - - is_pending_reconnect: Optional[bool] = None - """ - Cloudflare continues to track connections for several minutes after they - disconnect. This is an optimization to improve latency and reliability of - reconnecting. If `true`, the connection has disconnected but is still being - tracked. If `false`, the connection is actively serving traffic. - """ - - opened_at: Optional[datetime] = None - """Timestamp of when the connection was established.""" - - origin_ip: Optional[str] = None - """The public IP address of the host running cloudflared.""" - - uuid: Optional[str] = None - """UUID of the Cloudflare Tunnel connection.""" - - -class WARPConnectorTunnel(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.""" diff --git a/tests/api_resources/intel/test_dns.py b/tests/api_resources/intel/test_dns.py index 84f07865c11..0c916acc860 100644 --- a/tests/api_resources/intel/test_dns.py +++ b/tests/api_resources/intel/test_dns.py @@ -10,7 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_date -from cloudflare.types.intel import DNS +from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination +from cloudflare.types.intel import DNSListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,16 +21,16 @@ class TestDNS: @pytest.mark.skip() @parametrize - def test_method_get(self, client: Cloudflare) -> None: - dns = client.intel.dns.get( + def test_method_list(self, client: Cloudflare) -> None: + dns = client.intel.dns.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNS, dns, path=["response"]) + assert_matches_type(SyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - dns = client.intel.dns.get( + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + dns = client.intel.dns.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ipv4="string", page=1, @@ -39,39 +40,39 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "start": parse_date("2021-04-01"), }, ) - assert_matches_type(DNS, dns, path=["response"]) + assert_matches_type(SyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.intel.dns.with_raw_response.get( + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.intel.dns.with_raw_response.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns = response.parse() - assert_matches_type(DNS, dns, path=["response"]) + assert_matches_type(SyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.intel.dns.with_streaming_response.get( + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.intel.dns.with_streaming_response.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns = response.parse() - assert_matches_type(DNS, dns, path=["response"]) + assert_matches_type(SyncV4PagePagination[DNSListResponse], dns, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: + 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.intel.dns.with_raw_response.get( + client.intel.dns.with_raw_response.list( account_id="", ) @@ -81,16 +82,16 @@ class TestAsyncDNS: @pytest.mark.skip() @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - dns = await async_client.intel.dns.get( + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + dns = await async_client.intel.dns.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DNS, dns, path=["response"]) + assert_matches_type(AsyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - dns = await async_client.intel.dns.get( + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + dns = await async_client.intel.dns.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ipv4="string", page=1, @@ -100,38 +101,38 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "start": parse_date("2021-04-01"), }, ) - assert_matches_type(DNS, dns, path=["response"]) + assert_matches_type(AsyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.intel.dns.with_raw_response.get( + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.intel.dns.with_raw_response.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns = await response.parse() - assert_matches_type(DNS, dns, path=["response"]) + assert_matches_type(AsyncV4PagePagination[DNSListResponse], dns, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.intel.dns.with_streaming_response.get( + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.intel.dns.with_streaming_response.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" dns = await response.parse() - assert_matches_type(DNS, dns, path=["response"]) + assert_matches_type(AsyncV4PagePagination[DNSListResponse], dns, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + 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.intel.dns.with_raw_response.get( + await async_client.intel.dns.with_raw_response.list( account_id="", ) diff --git a/tests/api_resources/load_balancers/test_previews.py b/tests/api_resources/load_balancers/test_previews.py index 695eca5a8e3..588ab766d4a 100644 --- a/tests/api_resources/load_balancers/test_previews.py +++ b/tests/api_resources/load_balancers/test_previews.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.user.load_balancers import Preview +from cloudflare.types.load_balancers import PreviewGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: "p1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" preview = response.parse() - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" preview = response.parse() - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) assert cast(Any, response.is_closed) is True @@ -80,7 +80,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "p1aba936b94213e5b8dca0c0dbf1f9cc", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,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" preview = await response.parse() - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +106,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" preview = await response.parse() - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/load_balancers/__init__.py b/tests/api_resources/radar/bgp/hijacks/__init__.py similarity index 100% rename from tests/api_resources/user/load_balancers/__init__.py rename to tests/api_resources/radar/bgp/hijacks/__init__.py diff --git a/tests/api_resources/radar/bgp/test_hijacks.py b/tests/api_resources/radar/bgp/hijacks/test_events.py similarity index 53% rename from tests/api_resources/radar/bgp/test_hijacks.py rename to tests/api_resources/radar/bgp/hijacks/test_events.py index e7f5bc847d6..e12b3caa09f 100644 --- a/tests/api_resources/radar/bgp/test_hijacks.py +++ b/tests/api_resources/radar/bgp/hijacks/test_events.py @@ -10,24 +10,25 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.bgp import HijackEventsResponse +from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination +from cloudflare.types.radar.bgp.hijacks import EventListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestHijacks: +class TestEvents: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip() @parametrize - def test_method_events(self, client: Cloudflare) -> None: - hijack = client.radar.bgp.hijacks.events() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) + def test_method_list(self, client: Cloudflare) -> None: + event = client.radar.bgp.hijacks.events.list() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_events_with_all_params(self, client: Cloudflare) -> None: - hijack = client.radar.bgp.hijacks.events( + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + event = client.radar.bgp.hijacks.events.list( date_end=parse_datetime("2023-09-01T11:41:33.782Z"), date_range="7d", date_start=parse_datetime("2023-09-01T11:41:33.782Z"), @@ -45,44 +46,44 @@ def test_method_events_with_all_params(self, client: Cloudflare) -> None: sort_order="DESC", victim_asn=0, ) - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_events(self, client: Cloudflare) -> None: - response = client.radar.bgp.hijacks.with_raw_response.events() + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.radar.bgp.hijacks.events.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hijack = response.parse() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) + event = response.parse() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_events(self, client: Cloudflare) -> None: - with client.radar.bgp.hijacks.with_streaming_response.events() as response: + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.radar.bgp.hijacks.events.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hijack = response.parse() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) + event = response.parse() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncHijacks: +class TestAsyncEvents: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip() @parametrize - async def test_method_events(self, async_client: AsyncCloudflare) -> None: - hijack = await async_client.radar.bgp.hijacks.events() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + event = await async_client.radar.bgp.hijacks.events.list() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_events_with_all_params(self, async_client: AsyncCloudflare) -> None: - hijack = await async_client.radar.bgp.hijacks.events( + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + event = await async_client.radar.bgp.hijacks.events.list( date_end=parse_datetime("2023-09-01T11:41:33.782Z"), date_range="7d", date_start=parse_datetime("2023-09-01T11:41:33.782Z"), @@ -100,26 +101,26 @@ async def test_method_events_with_all_params(self, async_client: AsyncCloudflare sort_order="DESC", victim_asn=0, ) - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_events(self, async_client: AsyncCloudflare) -> None: - response = await async_client.radar.bgp.hijacks.with_raw_response.events() + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.bgp.hijacks.events.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hijack = await response.parse() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) + event = await response.parse() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_events(self, async_client: AsyncCloudflare) -> None: - async with async_client.radar.bgp.hijacks.with_streaming_response.events() as response: + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.bgp.hijacks.events.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hijack = await response.parse() - assert_matches_type(HijackEventsResponse, hijack, path=["response"]) + event = await response.parse() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/load_balancers/analytics/__init__.py b/tests/api_resources/radar/bgp/leaks/__init__.py similarity index 100% rename from tests/api_resources/user/load_balancers/analytics/__init__.py rename to tests/api_resources/radar/bgp/leaks/__init__.py diff --git a/tests/api_resources/radar/bgp/test_leaks.py b/tests/api_resources/radar/bgp/leaks/test_events.py similarity index 50% rename from tests/api_resources/radar/bgp/test_leaks.py rename to tests/api_resources/radar/bgp/leaks/test_events.py index eb7d85f2290..a8eef2dfaf3 100644 --- a/tests/api_resources/radar/bgp/test_leaks.py +++ b/tests/api_resources/radar/bgp/leaks/test_events.py @@ -10,24 +10,25 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.radar.bgp import LeakEventsResponse +from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination +from cloudflare.types.radar.bgp.leaks import EventListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestLeaks: +class TestEvents: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip() @parametrize - def test_method_events(self, client: Cloudflare) -> None: - leak = client.radar.bgp.leaks.events() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) + def test_method_list(self, client: Cloudflare) -> None: + event = client.radar.bgp.leaks.events.list() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_events_with_all_params(self, client: Cloudflare) -> None: - leak = client.radar.bgp.leaks.events( + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + event = client.radar.bgp.leaks.events.list( date_end=parse_datetime("2023-09-01T11:41:33.782Z"), date_range="7d", date_start=parse_datetime("2023-09-01T11:41:33.782Z"), @@ -41,44 +42,44 @@ def test_method_events_with_all_params(self, client: Cloudflare) -> None: sort_by="TIME", sort_order="DESC", ) - assert_matches_type(LeakEventsResponse, leak, path=["response"]) + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_events(self, client: Cloudflare) -> None: - response = client.radar.bgp.leaks.with_raw_response.events() + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.radar.bgp.leaks.events.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - leak = response.parse() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) + event = response.parse() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_events(self, client: Cloudflare) -> None: - with client.radar.bgp.leaks.with_streaming_response.events() as response: + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.radar.bgp.leaks.events.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - leak = response.parse() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) + event = response.parse() + assert_matches_type(SyncV4PagePagination[EventListResponse], event, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncLeaks: +class TestAsyncEvents: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip() @parametrize - async def test_method_events(self, async_client: AsyncCloudflare) -> None: - leak = await async_client.radar.bgp.leaks.events() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + event = await async_client.radar.bgp.leaks.events.list() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_events_with_all_params(self, async_client: AsyncCloudflare) -> None: - leak = await async_client.radar.bgp.leaks.events( + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + event = await async_client.radar.bgp.leaks.events.list( date_end=parse_datetime("2023-09-01T11:41:33.782Z"), date_range="7d", date_start=parse_datetime("2023-09-01T11:41:33.782Z"), @@ -92,26 +93,26 @@ async def test_method_events_with_all_params(self, async_client: AsyncCloudflare sort_by="TIME", sort_order="DESC", ) - assert_matches_type(LeakEventsResponse, leak, path=["response"]) + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_events(self, async_client: AsyncCloudflare) -> None: - response = await async_client.radar.bgp.leaks.with_raw_response.events() + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.bgp.leaks.events.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - leak = await response.parse() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) + event = await response.parse() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_events(self, async_client: AsyncCloudflare) -> None: - async with async_client.radar.bgp.leaks.with_streaming_response.events() as response: + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.bgp.leaks.events.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - leak = await response.parse() - assert_matches_type(LeakEventsResponse, leak, path=["response"]) + event = await response.parse() + assert_matches_type(AsyncV4PagePagination[EventListResponse], event, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/billing/test_history.py b/tests/api_resources/user/billing/test_history.py index fbe2c0d675e..d16cf7ce228 100644 --- a/tests/api_resources/user/billing/test_history.py +++ b/tests/api_resources/user/billing/test_history.py @@ -3,14 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.user.billing import HistoryGetResponse +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.user.billing import BillingHistory base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,14 +21,14 @@ class TestHistory: @pytest.mark.skip() @parametrize - def test_method_get(self, client: Cloudflare) -> None: - history = client.user.billing.history.get() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + def test_method_list(self, client: Cloudflare) -> None: + history = client.user.billing.history.list() + assert_matches_type(SyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - history = client.user.billing.history.get( + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + history = client.user.billing.history.list( action="subscription", occured_at=parse_datetime("2014-03-01T12:21:59.3456Z"), occurred_at=parse_datetime("2014-03-01T12:21:59.3456Z"), @@ -36,27 +37,27 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: per_page=5, type="charge", ) - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.user.billing.history.with_raw_response.get() + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.user.billing.history.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.user.billing.history.with_streaming_response.get() as response: + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.user.billing.history.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = response.parse() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[BillingHistory], history, path=["response"]) assert cast(Any, response.is_closed) is True @@ -66,14 +67,14 @@ class TestAsyncHistory: @pytest.mark.skip() @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - history = await async_client.user.billing.history.get() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + history = await async_client.user.billing.history.list() + assert_matches_type(AsyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - history = await async_client.user.billing.history.get( + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + history = await async_client.user.billing.history.list( action="subscription", occured_at=parse_datetime("2014-03-01T12:21:59.3456Z"), occurred_at=parse_datetime("2014-03-01T12:21:59.3456Z"), @@ -82,26 +83,26 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - per_page=5, type="charge", ) - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.billing.history.with_raw_response.get() + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.user.billing.history.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[BillingHistory], history, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.billing.history.with_streaming_response.get() as response: + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.user.billing.history.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" history = await response.parse() - assert_matches_type(Optional[HistoryGetResponse], history, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[BillingHistory], history, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/load_balancing/__init__.py b/tests/api_resources/user/load_balancing/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/user/load_balancing/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/user/load_balancing/analytics/__init__.py b/tests/api_resources/user/load_balancing/analytics/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/user/load_balancing/analytics/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/user/load_balancers/analytics/test_events.py b/tests/api_resources/user/load_balancing/analytics/test_events.py similarity index 87% rename from tests/api_resources/user/load_balancers/analytics/test_events.py rename to tests/api_resources/user/load_balancing/analytics/test_events.py index d29a265c01d..fe06038b050 100644 --- a/tests/api_resources/user/load_balancers/analytics/test_events.py +++ b/tests/api_resources/user/load_balancing/analytics/test_events.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.user.load_balancers import Analytics +from cloudflare.types.user.load_balancing import Analytics base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,13 +22,13 @@ class TestEvents: @pytest.mark.skip() @parametrize def test_method_list(self, client: Cloudflare) -> None: - event = client.user.load_balancers.analytics.events.list() + event = client.user.load_balancing.analytics.events.list() assert_matches_type(SyncSinglePage[Analytics], event, path=["response"]) @pytest.mark.skip() @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: - event = client.user.load_balancers.analytics.events.list( + event = client.user.load_balancing.analytics.events.list( origin_healthy=True, origin_name="primary-dc-1", pool_healthy=True, @@ -42,7 +42,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.user.load_balancers.analytics.events.with_raw_response.list() + response = client.user.load_balancing.analytics.events.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -52,7 +52,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.user.load_balancers.analytics.events.with_streaming_response.list() as response: + with client.user.load_balancing.analytics.events.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -68,13 +68,13 @@ class TestAsyncEvents: @pytest.mark.skip() @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - event = await async_client.user.load_balancers.analytics.events.list() + event = await async_client.user.load_balancing.analytics.events.list() assert_matches_type(AsyncSinglePage[Analytics], event, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - event = await async_client.user.load_balancers.analytics.events.list( + event = await async_client.user.load_balancing.analytics.events.list( origin_healthy=True, origin_name="primary-dc-1", pool_healthy=True, @@ -88,7 +88,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.analytics.events.with_raw_response.list() + response = await async_client.user.load_balancing.analytics.events.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -98,7 +98,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.analytics.events.with_streaming_response.list() as response: + async with async_client.user.load_balancing.analytics.events.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/user/load_balancers/test_monitors.py b/tests/api_resources/user/load_balancing/test_monitors.py similarity index 87% rename from tests/api_resources/user/load_balancers/test_monitors.py rename to tests/api_resources/user/load_balancing/test_monitors.py index 2c2955c7342..6e3dfae90be 100644 --- a/tests/api_resources/user/load_balancers/test_monitors.py +++ b/tests/api_resources/user/load_balancing/test_monitors.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.user.load_balancers import ( +from cloudflare.types.user.load_balancing import ( MonitorGetResponse, MonitorEditResponse, MonitorListResponse, @@ -30,7 +30,7 @@ class TestMonitors: @pytest.mark.skip() @parametrize def test_method_create(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.create( + monitor = client.user.load_balancing.monitors.create( expected_codes="2xx", ) assert_matches_type(MonitorCreateResponse, monitor, path=["response"]) @@ -38,7 +38,7 @@ def test_method_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.create( + monitor = client.user.load_balancing.monitors.create( expected_codes="2xx", allow_insecure=True, consecutive_down=0, @@ -64,7 +64,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.create( + response = client.user.load_balancing.monitors.with_raw_response.create( expected_codes="2xx", ) @@ -76,7 +76,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.create( + with client.user.load_balancing.monitors.with_streaming_response.create( expected_codes="2xx", ) as response: assert not response.is_closed @@ -90,7 +90,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.update( + monitor = client.user.load_balancing.monitors.update( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -99,7 +99,7 @@ def test_method_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.update( + monitor = client.user.load_balancing.monitors.update( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", allow_insecure=True, @@ -126,7 +126,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.update( + response = client.user.load_balancing.monitors.with_raw_response.update( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -139,7 +139,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.update( + with client.user.load_balancing.monitors.with_streaming_response.update( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) as response: @@ -155,7 +155,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @parametrize def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.update( + client.user.load_balancing.monitors.with_raw_response.update( "", expected_codes="2xx", ) @@ -163,13 +163,13 @@ def test_path_params_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_list(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.list() + monitor = client.user.load_balancing.monitors.list() assert_matches_type(SyncSinglePage[MonitorListResponse], monitor, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.list() + response = client.user.load_balancing.monitors.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -179,7 +179,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.list() as response: + with client.user.load_balancing.monitors.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -191,7 +191,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_delete(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.delete( + monitor = client.user.load_balancing.monitors.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", body={}, ) @@ -200,7 +200,7 @@ def test_method_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.delete( + response = client.user.load_balancing.monitors.with_raw_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", body={}, ) @@ -213,7 +213,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.delete( + with client.user.load_balancing.monitors.with_streaming_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", body={}, ) as response: @@ -229,7 +229,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.delete( + client.user.load_balancing.monitors.with_raw_response.delete( "", body={}, ) @@ -237,7 +237,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_edit(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.edit( + monitor = client.user.load_balancing.monitors.edit( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -246,7 +246,7 @@ def test_method_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.edit( + monitor = client.user.load_balancing.monitors.edit( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", allow_insecure=True, @@ -273,7 +273,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.edit( + response = client.user.load_balancing.monitors.with_raw_response.edit( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -286,7 +286,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.edit( + with client.user.load_balancing.monitors.with_streaming_response.edit( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) as response: @@ -302,7 +302,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.edit( + client.user.load_balancing.monitors.with_raw_response.edit( "", expected_codes="2xx", ) @@ -310,7 +310,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.get( + monitor = client.user.load_balancing.monitors.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) assert_matches_type(MonitorGetResponse, monitor, path=["response"]) @@ -318,7 +318,7 @@ def test_method_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.get( + response = client.user.load_balancing.monitors.with_raw_response.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) @@ -330,7 +330,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.get( + with client.user.load_balancing.monitors.with_streaming_response.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) as response: assert not response.is_closed @@ -345,14 +345,14 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.get( + client.user.load_balancing.monitors.with_raw_response.get( "", ) @pytest.mark.skip() @parametrize def test_method_preview(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.preview( + monitor = client.user.load_balancing.monitors.preview( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -361,7 +361,7 @@ def test_method_preview(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_preview_with_all_params(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.preview( + monitor = client.user.load_balancing.monitors.preview( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", allow_insecure=True, @@ -388,7 +388,7 @@ def test_method_preview_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_preview(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.preview( + response = client.user.load_balancing.monitors.with_raw_response.preview( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -401,7 +401,7 @@ def test_raw_response_preview(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_preview(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.preview( + with client.user.load_balancing.monitors.with_streaming_response.preview( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) as response: @@ -417,7 +417,7 @@ def test_streaming_response_preview(self, client: Cloudflare) -> None: @parametrize def test_path_params_preview(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.preview( + client.user.load_balancing.monitors.with_raw_response.preview( "", expected_codes="2xx", ) @@ -425,7 +425,7 @@ def test_path_params_preview(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_references(self, client: Cloudflare) -> None: - monitor = client.user.load_balancers.monitors.references( + monitor = client.user.load_balancing.monitors.references( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) assert_matches_type(Optional[MonitorReferencesResponse], monitor, path=["response"]) @@ -433,7 +433,7 @@ def test_method_references(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_references(self, client: Cloudflare) -> None: - response = client.user.load_balancers.monitors.with_raw_response.references( + response = client.user.load_balancing.monitors.with_raw_response.references( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) @@ -445,7 +445,7 @@ def test_raw_response_references(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_references(self, client: Cloudflare) -> None: - with client.user.load_balancers.monitors.with_streaming_response.references( + with client.user.load_balancing.monitors.with_streaming_response.references( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) as response: assert not response.is_closed @@ -460,7 +460,7 @@ def test_streaming_response_references(self, client: Cloudflare) -> None: @parametrize def test_path_params_references(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - client.user.load_balancers.monitors.with_raw_response.references( + client.user.load_balancing.monitors.with_raw_response.references( "", ) @@ -471,7 +471,7 @@ class TestAsyncMonitors: @pytest.mark.skip() @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.create( + monitor = await async_client.user.load_balancing.monitors.create( expected_codes="2xx", ) assert_matches_type(MonitorCreateResponse, monitor, path=["response"]) @@ -479,7 +479,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.create( + monitor = await async_client.user.load_balancing.monitors.create( expected_codes="2xx", allow_insecure=True, consecutive_down=0, @@ -505,7 +505,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.create( + response = await async_client.user.load_balancing.monitors.with_raw_response.create( expected_codes="2xx", ) @@ -517,7 +517,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.create( + async with async_client.user.load_balancing.monitors.with_streaming_response.create( expected_codes="2xx", ) as response: assert not response.is_closed @@ -531,7 +531,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.update( + monitor = await async_client.user.load_balancing.monitors.update( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -540,7 +540,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.update( + monitor = await async_client.user.load_balancing.monitors.update( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", allow_insecure=True, @@ -567,7 +567,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.update( + response = await async_client.user.load_balancing.monitors.with_raw_response.update( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -580,7 +580,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.update( + async with async_client.user.load_balancing.monitors.with_streaming_response.update( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) as response: @@ -596,7 +596,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.update( + await async_client.user.load_balancing.monitors.with_raw_response.update( "", expected_codes="2xx", ) @@ -604,13 +604,13 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.list() + monitor = await async_client.user.load_balancing.monitors.list() assert_matches_type(AsyncSinglePage[MonitorListResponse], monitor, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.list() + response = await async_client.user.load_balancing.monitors.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -620,7 +620,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.list() as response: + async with async_client.user.load_balancing.monitors.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -632,7 +632,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip() @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.delete( + monitor = await async_client.user.load_balancing.monitors.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", body={}, ) @@ -641,7 +641,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.delete( + response = await async_client.user.load_balancing.monitors.with_raw_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", body={}, ) @@ -654,7 +654,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.delete( + async with async_client.user.load_balancing.monitors.with_streaming_response.delete( "f1aba936b94213e5b8dca0c0dbf1f9cc", body={}, ) as response: @@ -670,7 +670,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.delete( + await async_client.user.load_balancing.monitors.with_raw_response.delete( "", body={}, ) @@ -678,7 +678,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.edit( + monitor = await async_client.user.load_balancing.monitors.edit( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -687,7 +687,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.edit( + monitor = await async_client.user.load_balancing.monitors.edit( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", allow_insecure=True, @@ -714,7 +714,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.edit( + response = await async_client.user.load_balancing.monitors.with_raw_response.edit( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -727,7 +727,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.edit( + async with async_client.user.load_balancing.monitors.with_streaming_response.edit( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) as response: @@ -743,7 +743,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.edit( + await async_client.user.load_balancing.monitors.with_raw_response.edit( "", expected_codes="2xx", ) @@ -751,7 +751,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.get( + monitor = await async_client.user.load_balancing.monitors.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) assert_matches_type(MonitorGetResponse, monitor, path=["response"]) @@ -759,7 +759,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.get( + response = await async_client.user.load_balancing.monitors.with_raw_response.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) @@ -771,7 +771,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.get( + async with async_client.user.load_balancing.monitors.with_streaming_response.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) as response: assert not response.is_closed @@ -786,14 +786,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.get( + await async_client.user.load_balancing.monitors.with_raw_response.get( "", ) @pytest.mark.skip() @parametrize async def test_method_preview(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.preview( + monitor = await async_client.user.load_balancing.monitors.preview( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -802,7 +802,7 @@ async def test_method_preview(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_preview_with_all_params(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.preview( + monitor = await async_client.user.load_balancing.monitors.preview( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", allow_insecure=True, @@ -829,7 +829,7 @@ async def test_method_preview_with_all_params(self, async_client: AsyncCloudflar @pytest.mark.skip() @parametrize async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.preview( + response = await async_client.user.load_balancing.monitors.with_raw_response.preview( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) @@ -842,7 +842,7 @@ async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None @pytest.mark.skip() @parametrize async def test_streaming_response_preview(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.preview( + async with async_client.user.load_balancing.monitors.with_streaming_response.preview( "f1aba936b94213e5b8dca0c0dbf1f9cc", expected_codes="2xx", ) as response: @@ -858,7 +858,7 @@ async def test_streaming_response_preview(self, async_client: AsyncCloudflare) - @parametrize async def test_path_params_preview(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.preview( + await async_client.user.load_balancing.monitors.with_raw_response.preview( "", expected_codes="2xx", ) @@ -866,7 +866,7 @@ async def test_path_params_preview(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_references(self, async_client: AsyncCloudflare) -> None: - monitor = await async_client.user.load_balancers.monitors.references( + monitor = await async_client.user.load_balancing.monitors.references( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) assert_matches_type(Optional[MonitorReferencesResponse], monitor, path=["response"]) @@ -874,7 +874,7 @@ async def test_method_references(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_references(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.monitors.with_raw_response.references( + response = await async_client.user.load_balancing.monitors.with_raw_response.references( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) @@ -886,7 +886,7 @@ async def test_raw_response_references(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip() @parametrize async def test_streaming_response_references(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.monitors.with_streaming_response.references( + async with async_client.user.load_balancing.monitors.with_streaming_response.references( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) as response: assert not response.is_closed @@ -901,6 +901,6 @@ async def test_streaming_response_references(self, async_client: AsyncCloudflare @parametrize async def test_path_params_references(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `monitor_id` but received ''"): - await async_client.user.load_balancers.monitors.with_raw_response.references( + await async_client.user.load_balancing.monitors.with_raw_response.references( "", ) diff --git a/tests/api_resources/user/load_balancers/test_pools.py b/tests/api_resources/user/load_balancing/test_pools.py similarity index 89% rename from tests/api_resources/user/load_balancers/test_pools.py rename to tests/api_resources/user/load_balancing/test_pools.py index 4875ba28f5e..355643b6f9d 100644 --- a/tests/api_resources/user/load_balancers/test_pools.py +++ b/tests/api_resources/user/load_balancing/test_pools.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.load_balancers import Pool -from cloudflare.types.user.load_balancers import ( +from cloudflare.types.user.load_balancing import ( PoolDeleteResponse, PoolHealthResponse, PoolPreviewResponse, @@ -27,7 +27,7 @@ class TestPools: @pytest.mark.skip() @parametrize def test_method_create(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.create( + pool = client.user.load_balancing.pools.create( name="primary-dc-1", origins=[{}, {}, {}], ) @@ -36,7 +36,7 @@ def test_method_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.create( + pool = client.user.load_balancing.pools.create( name="primary-dc-1", origins=[ { @@ -95,7 +95,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.create( + response = client.user.load_balancing.pools.with_raw_response.create( name="primary-dc-1", origins=[{}, {}, {}], ) @@ -108,7 +108,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.create( + with client.user.load_balancing.pools.with_streaming_response.create( name="primary-dc-1", origins=[{}, {}, {}], ) as response: @@ -123,7 +123,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.update( + pool = client.user.load_balancing.pools.update( "17b5962d775c646f3f9725cbc7a53df4", name="primary-dc-1", origins=[{}, {}, {}], @@ -133,7 +133,7 @@ def test_method_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.update( + pool = client.user.load_balancing.pools.update( "17b5962d775c646f3f9725cbc7a53df4", name="primary-dc-1", origins=[ @@ -193,7 +193,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.update( + response = client.user.load_balancing.pools.with_raw_response.update( "17b5962d775c646f3f9725cbc7a53df4", name="primary-dc-1", origins=[{}, {}, {}], @@ -207,7 +207,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.update( + with client.user.load_balancing.pools.with_streaming_response.update( "17b5962d775c646f3f9725cbc7a53df4", name="primary-dc-1", origins=[{}, {}, {}], @@ -224,7 +224,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @parametrize def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.update( + client.user.load_balancing.pools.with_raw_response.update( "", name="primary-dc-1", origins=[{}, {}, {}], @@ -233,13 +233,13 @@ def test_path_params_update(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_list(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.list() + pool = client.user.load_balancing.pools.list() assert_matches_type(SyncSinglePage[Pool], pool, path=["response"]) @pytest.mark.skip() @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.list( + pool = client.user.load_balancing.pools.list( monitor={}, ) assert_matches_type(SyncSinglePage[Pool], pool, path=["response"]) @@ -247,7 +247,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.list() + response = client.user.load_balancing.pools.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -257,7 +257,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.list() as response: + with client.user.load_balancing.pools.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -269,7 +269,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_delete(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.delete( + pool = client.user.load_balancing.pools.delete( "17b5962d775c646f3f9725cbc7a53df4", body={}, ) @@ -278,7 +278,7 @@ def test_method_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.delete( + response = client.user.load_balancing.pools.with_raw_response.delete( "17b5962d775c646f3f9725cbc7a53df4", body={}, ) @@ -291,7 +291,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.delete( + with client.user.load_balancing.pools.with_streaming_response.delete( "17b5962d775c646f3f9725cbc7a53df4", body={}, ) as response: @@ -307,7 +307,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.delete( + client.user.load_balancing.pools.with_raw_response.delete( "", body={}, ) @@ -315,7 +315,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_edit(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.edit( + pool = client.user.load_balancing.pools.edit( "17b5962d775c646f3f9725cbc7a53df4", ) assert_matches_type(Pool, pool, path=["response"]) @@ -323,7 +323,7 @@ def test_method_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.edit( + pool = client.user.load_balancing.pools.edit( "17b5962d775c646f3f9725cbc7a53df4", check_regions=["WEU", "ENAM"], description="Primary data center - Provider XYZ", @@ -383,7 +383,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.edit( + response = client.user.load_balancing.pools.with_raw_response.edit( "17b5962d775c646f3f9725cbc7a53df4", ) @@ -395,7 +395,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.edit( + with client.user.load_balancing.pools.with_streaming_response.edit( "17b5962d775c646f3f9725cbc7a53df4", ) as response: assert not response.is_closed @@ -410,14 +410,14 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.edit( + client.user.load_balancing.pools.with_raw_response.edit( "", ) @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.get( + pool = client.user.load_balancing.pools.get( "17b5962d775c646f3f9725cbc7a53df4", ) assert_matches_type(Pool, pool, path=["response"]) @@ -425,7 +425,7 @@ def test_method_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.get( + response = client.user.load_balancing.pools.with_raw_response.get( "17b5962d775c646f3f9725cbc7a53df4", ) @@ -437,7 +437,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.get( + with client.user.load_balancing.pools.with_streaming_response.get( "17b5962d775c646f3f9725cbc7a53df4", ) as response: assert not response.is_closed @@ -452,14 +452,14 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.get( + client.user.load_balancing.pools.with_raw_response.get( "", ) @pytest.mark.skip() @parametrize def test_method_health(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.health( + pool = client.user.load_balancing.pools.health( "17b5962d775c646f3f9725cbc7a53df4", ) assert_matches_type(PoolHealthResponse, pool, path=["response"]) @@ -467,7 +467,7 @@ def test_method_health(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_health(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.health( + response = client.user.load_balancing.pools.with_raw_response.health( "17b5962d775c646f3f9725cbc7a53df4", ) @@ -479,7 +479,7 @@ def test_raw_response_health(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_health(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.health( + with client.user.load_balancing.pools.with_streaming_response.health( "17b5962d775c646f3f9725cbc7a53df4", ) as response: assert not response.is_closed @@ -494,14 +494,14 @@ def test_streaming_response_health(self, client: Cloudflare) -> None: @parametrize def test_path_params_health(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.health( + client.user.load_balancing.pools.with_raw_response.health( "", ) @pytest.mark.skip() @parametrize def test_method_preview(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.preview( + pool = client.user.load_balancing.pools.preview( "17b5962d775c646f3f9725cbc7a53df4", expected_codes="2xx", ) @@ -510,7 +510,7 @@ def test_method_preview(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_preview_with_all_params(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.preview( + pool = client.user.load_balancing.pools.preview( "17b5962d775c646f3f9725cbc7a53df4", expected_codes="2xx", allow_insecure=True, @@ -537,7 +537,7 @@ def test_method_preview_with_all_params(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_preview(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.preview( + response = client.user.load_balancing.pools.with_raw_response.preview( "17b5962d775c646f3f9725cbc7a53df4", expected_codes="2xx", ) @@ -550,7 +550,7 @@ def test_raw_response_preview(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_preview(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.preview( + with client.user.load_balancing.pools.with_streaming_response.preview( "17b5962d775c646f3f9725cbc7a53df4", expected_codes="2xx", ) as response: @@ -566,7 +566,7 @@ def test_streaming_response_preview(self, client: Cloudflare) -> None: @parametrize def test_path_params_preview(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.preview( + client.user.load_balancing.pools.with_raw_response.preview( "", expected_codes="2xx", ) @@ -574,7 +574,7 @@ def test_path_params_preview(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_method_references(self, client: Cloudflare) -> None: - pool = client.user.load_balancers.pools.references( + pool = client.user.load_balancing.pools.references( "17b5962d775c646f3f9725cbc7a53df4", ) assert_matches_type(Optional[PoolReferencesResponse], pool, path=["response"]) @@ -582,7 +582,7 @@ def test_method_references(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_raw_response_references(self, client: Cloudflare) -> None: - response = client.user.load_balancers.pools.with_raw_response.references( + response = client.user.load_balancing.pools.with_raw_response.references( "17b5962d775c646f3f9725cbc7a53df4", ) @@ -594,7 +594,7 @@ def test_raw_response_references(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize def test_streaming_response_references(self, client: Cloudflare) -> None: - with client.user.load_balancers.pools.with_streaming_response.references( + with client.user.load_balancing.pools.with_streaming_response.references( "17b5962d775c646f3f9725cbc7a53df4", ) as response: assert not response.is_closed @@ -609,7 +609,7 @@ def test_streaming_response_references(self, client: Cloudflare) -> None: @parametrize def test_path_params_references(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.user.load_balancers.pools.with_raw_response.references( + client.user.load_balancing.pools.with_raw_response.references( "", ) @@ -620,7 +620,7 @@ class TestAsyncPools: @pytest.mark.skip() @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.create( + pool = await async_client.user.load_balancing.pools.create( name="primary-dc-1", origins=[{}, {}, {}], ) @@ -629,7 +629,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.create( + pool = await async_client.user.load_balancing.pools.create( name="primary-dc-1", origins=[ { @@ -688,7 +688,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.create( + response = await async_client.user.load_balancing.pools.with_raw_response.create( name="primary-dc-1", origins=[{}, {}, {}], ) @@ -701,7 +701,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.create( + async with async_client.user.load_balancing.pools.with_streaming_response.create( name="primary-dc-1", origins=[{}, {}, {}], ) as response: @@ -716,7 +716,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @pytest.mark.skip() @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.update( + pool = await async_client.user.load_balancing.pools.update( "17b5962d775c646f3f9725cbc7a53df4", name="primary-dc-1", origins=[{}, {}, {}], @@ -726,7 +726,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.update( + pool = await async_client.user.load_balancing.pools.update( "17b5962d775c646f3f9725cbc7a53df4", name="primary-dc-1", origins=[ @@ -786,7 +786,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare @pytest.mark.skip() @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.update( + response = await async_client.user.load_balancing.pools.with_raw_response.update( "17b5962d775c646f3f9725cbc7a53df4", name="primary-dc-1", origins=[{}, {}, {}], @@ -800,7 +800,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.update( + async with async_client.user.load_balancing.pools.with_streaming_response.update( "17b5962d775c646f3f9725cbc7a53df4", name="primary-dc-1", origins=[{}, {}, {}], @@ -817,7 +817,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.update( + await async_client.user.load_balancing.pools.with_raw_response.update( "", name="primary-dc-1", origins=[{}, {}, {}], @@ -826,13 +826,13 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.list() + pool = await async_client.user.load_balancing.pools.list() assert_matches_type(AsyncSinglePage[Pool], pool, path=["response"]) @pytest.mark.skip() @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.list( + pool = await async_client.user.load_balancing.pools.list( monitor={}, ) assert_matches_type(AsyncSinglePage[Pool], pool, path=["response"]) @@ -840,7 +840,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.list() + response = await async_client.user.load_balancing.pools.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -850,7 +850,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.list() as response: + async with async_client.user.load_balancing.pools.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -862,7 +862,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip() @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.delete( + pool = await async_client.user.load_balancing.pools.delete( "17b5962d775c646f3f9725cbc7a53df4", body={}, ) @@ -871,7 +871,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.delete( + response = await async_client.user.load_balancing.pools.with_raw_response.delete( "17b5962d775c646f3f9725cbc7a53df4", body={}, ) @@ -884,7 +884,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.delete( + async with async_client.user.load_balancing.pools.with_streaming_response.delete( "17b5962d775c646f3f9725cbc7a53df4", body={}, ) as response: @@ -900,7 +900,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.delete( + await async_client.user.load_balancing.pools.with_raw_response.delete( "", body={}, ) @@ -908,7 +908,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.edit( + pool = await async_client.user.load_balancing.pools.edit( "17b5962d775c646f3f9725cbc7a53df4", ) assert_matches_type(Pool, pool, path=["response"]) @@ -916,7 +916,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.edit( + pool = await async_client.user.load_balancing.pools.edit( "17b5962d775c646f3f9725cbc7a53df4", check_regions=["WEU", "ENAM"], description="Primary data center - Provider XYZ", @@ -976,7 +976,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.edit( + response = await async_client.user.load_balancing.pools.with_raw_response.edit( "17b5962d775c646f3f9725cbc7a53df4", ) @@ -988,7 +988,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.edit( + async with async_client.user.load_balancing.pools.with_streaming_response.edit( "17b5962d775c646f3f9725cbc7a53df4", ) as response: assert not response.is_closed @@ -1003,14 +1003,14 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.edit( + await async_client.user.load_balancing.pools.with_raw_response.edit( "", ) @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.get( + pool = await async_client.user.load_balancing.pools.get( "17b5962d775c646f3f9725cbc7a53df4", ) assert_matches_type(Pool, pool, path=["response"]) @@ -1018,7 +1018,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.get( + response = await async_client.user.load_balancing.pools.with_raw_response.get( "17b5962d775c646f3f9725cbc7a53df4", ) @@ -1030,7 +1030,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.get( + async with async_client.user.load_balancing.pools.with_streaming_response.get( "17b5962d775c646f3f9725cbc7a53df4", ) as response: assert not response.is_closed @@ -1045,14 +1045,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.get( + await async_client.user.load_balancing.pools.with_raw_response.get( "", ) @pytest.mark.skip() @parametrize async def test_method_health(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.health( + pool = await async_client.user.load_balancing.pools.health( "17b5962d775c646f3f9725cbc7a53df4", ) assert_matches_type(PoolHealthResponse, pool, path=["response"]) @@ -1060,7 +1060,7 @@ async def test_method_health(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_health(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.health( + response = await async_client.user.load_balancing.pools.with_raw_response.health( "17b5962d775c646f3f9725cbc7a53df4", ) @@ -1072,7 +1072,7 @@ async def test_raw_response_health(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_streaming_response_health(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.health( + async with async_client.user.load_balancing.pools.with_streaming_response.health( "17b5962d775c646f3f9725cbc7a53df4", ) as response: assert not response.is_closed @@ -1087,14 +1087,14 @@ async def test_streaming_response_health(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_health(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.health( + await async_client.user.load_balancing.pools.with_raw_response.health( "", ) @pytest.mark.skip() @parametrize async def test_method_preview(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.preview( + pool = await async_client.user.load_balancing.pools.preview( "17b5962d775c646f3f9725cbc7a53df4", expected_codes="2xx", ) @@ -1103,7 +1103,7 @@ async def test_method_preview(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_preview_with_all_params(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.preview( + pool = await async_client.user.load_balancing.pools.preview( "17b5962d775c646f3f9725cbc7a53df4", expected_codes="2xx", allow_insecure=True, @@ -1130,7 +1130,7 @@ async def test_method_preview_with_all_params(self, async_client: AsyncCloudflar @pytest.mark.skip() @parametrize async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.preview( + response = await async_client.user.load_balancing.pools.with_raw_response.preview( "17b5962d775c646f3f9725cbc7a53df4", expected_codes="2xx", ) @@ -1143,7 +1143,7 @@ async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None @pytest.mark.skip() @parametrize async def test_streaming_response_preview(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.preview( + async with async_client.user.load_balancing.pools.with_streaming_response.preview( "17b5962d775c646f3f9725cbc7a53df4", expected_codes="2xx", ) as response: @@ -1159,7 +1159,7 @@ async def test_streaming_response_preview(self, async_client: AsyncCloudflare) - @parametrize async def test_path_params_preview(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.preview( + await async_client.user.load_balancing.pools.with_raw_response.preview( "", expected_codes="2xx", ) @@ -1167,7 +1167,7 @@ async def test_path_params_preview(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_method_references(self, async_client: AsyncCloudflare) -> None: - pool = await async_client.user.load_balancers.pools.references( + pool = await async_client.user.load_balancing.pools.references( "17b5962d775c646f3f9725cbc7a53df4", ) assert_matches_type(Optional[PoolReferencesResponse], pool, path=["response"]) @@ -1175,7 +1175,7 @@ async def test_method_references(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip() @parametrize async def test_raw_response_references(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.pools.with_raw_response.references( + response = await async_client.user.load_balancing.pools.with_raw_response.references( "17b5962d775c646f3f9725cbc7a53df4", ) @@ -1187,7 +1187,7 @@ async def test_raw_response_references(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip() @parametrize async def test_streaming_response_references(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.pools.with_streaming_response.references( + async with async_client.user.load_balancing.pools.with_streaming_response.references( "17b5962d775c646f3f9725cbc7a53df4", ) as response: assert not response.is_closed @@ -1202,6 +1202,6 @@ async def test_streaming_response_references(self, async_client: AsyncCloudflare @parametrize async def test_path_params_references(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.user.load_balancers.pools.with_raw_response.references( + await async_client.user.load_balancing.pools.with_raw_response.references( "", ) diff --git a/tests/api_resources/user/load_balancers/test_preview.py b/tests/api_resources/user/load_balancing/test_preview.py similarity index 74% rename from tests/api_resources/user/load_balancers/test_preview.py rename to tests/api_resources/user/load_balancing/test_preview.py index bbf7558671a..7c2533be309 100644 --- a/tests/api_resources/user/load_balancers/test_preview.py +++ b/tests/api_resources/user/load_balancing/test_preview.py @@ -9,7 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.user.load_balancers import Preview +from cloudflare.types.user.load_balancing import PreviewGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,34 +20,34 @@ class TestPreview: @pytest.mark.skip() @parametrize def test_method_get(self, client: Cloudflare) -> None: - preview = client.user.load_balancers.preview.get( + preview = client.user.load_balancing.preview.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.user.load_balancers.preview.with_raw_response.get( + response = client.user.load_balancing.preview.with_raw_response.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" preview = response.parse() - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.user.load_balancers.preview.with_streaming_response.get( + with client.user.load_balancing.preview.with_streaming_response.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" preview = response.parse() - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) assert cast(Any, response.is_closed) is True @@ -55,7 +55,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `preview_id` but received ''"): - client.user.load_balancers.preview.with_raw_response.get( + client.user.load_balancing.preview.with_raw_response.get( "", ) @@ -66,34 +66,34 @@ class TestAsyncPreview: @pytest.mark.skip() @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - preview = await async_client.user.load_balancers.preview.get( + preview = await async_client.user.load_balancing.preview.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.user.load_balancers.preview.with_raw_response.get( + response = await async_client.user.load_balancing.preview.with_raw_response.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" preview = await response.parse() - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) @pytest.mark.skip() @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.user.load_balancers.preview.with_streaming_response.get( + async with async_client.user.load_balancing.preview.with_streaming_response.get( "f1aba936b94213e5b8dca0c0dbf1f9cc", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" preview = await response.parse() - assert_matches_type(Preview, preview, path=["response"]) + assert_matches_type(PreviewGetResponse, preview, path=["response"]) assert cast(Any, response.is_closed) is True @@ -101,6 +101,6 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `preview_id` but received ''"): - await async_client.user.load_balancers.preview.with_raw_response.get( + await async_client.user.load_balancing.preview.with_raw_response.get( "", )