From ead688f0d1ef62eb4693e03e646c81bc3dca9e76 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 04:51:29 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#1180) --- .stats.yml | 2 +- api.md | 31 ++ src/cloudflare/_client.py | 8 + src/cloudflare/resources/__init__.py | 14 + .../resources/cloud_connector/__init__.py | 33 ++ .../cloud_connector/cloud_connector.py | 80 ++++ .../resources/cloud_connector/rules.py | 255 ++++++++++ src/cloudflare/resources/radar/__init__.py | 14 + src/cloudflare/resources/radar/radar.py | 32 ++ .../resources/radar/tcp_resets_timeouts.py | 434 ++++++++++++++++++ .../types/cloud_connector/__init__.py | 7 + .../cloud_connector/rule_list_response.py | 29 ++ .../cloud_connector/rule_update_params.py | 37 ++ .../cloud_connector/rule_update_response.py | 32 ++ src/cloudflare/types/radar/__init__.py | 8 + .../tcp_resets_timeout_summary_params.py | 53 +++ .../tcp_resets_timeout_summary_response.py | 88 ++++ ...resets_timeout_timeseries_groups_params.py | 60 +++ ...sets_timeout_timeseries_groups_response.py | 94 ++++ .../api_resources/cloud_connector/__init__.py | 1 + .../cloud_connector/test_rules.py | 183 ++++++++ .../radar/test_tcp_resets_timeouts.py | 216 +++++++++ 22 files changed, 1710 insertions(+), 1 deletion(-) create mode 100644 src/cloudflare/resources/cloud_connector/__init__.py create mode 100644 src/cloudflare/resources/cloud_connector/cloud_connector.py create mode 100644 src/cloudflare/resources/cloud_connector/rules.py create mode 100644 src/cloudflare/resources/radar/tcp_resets_timeouts.py create mode 100644 src/cloudflare/types/cloud_connector/__init__.py create mode 100644 src/cloudflare/types/cloud_connector/rule_list_response.py create mode 100644 src/cloudflare/types/cloud_connector/rule_update_params.py create mode 100644 src/cloudflare/types/cloud_connector/rule_update_response.py create mode 100644 src/cloudflare/types/radar/tcp_resets_timeout_summary_params.py create mode 100644 src/cloudflare/types/radar/tcp_resets_timeout_summary_response.py create mode 100644 src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_params.py create mode 100644 src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_response.py create mode 100644 tests/api_resources/cloud_connector/__init__.py create mode 100644 tests/api_resources/cloud_connector/test_rules.py create mode 100644 tests/api_resources/radar/test_tcp_resets_timeouts.py diff --git a/.stats.yml b/.stats.yml index 23bd6be1885..fb607b85317 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1252 +configured_endpoints: 1256 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9f6e9da01b27f4f387991ca14ecafe0c42a356cc3c47b269e5f8b4f6cd0ed700.yml diff --git a/api.md b/api.md index 1945f0c0c95..f55013739bb 100644 --- a/api.md +++ b/api.md @@ -6935,6 +6935,22 @@ Methods: - client.radar.traffic_anomalies.locations.get(\*\*params) -> LocationGetResponse +## TCPResetsTimeouts + +Types: + +```python +from cloudflare.types.radar import ( + TCPResetsTimeoutSummaryResponse, + TCPResetsTimeoutTimeseriesGroupsResponse, +) +``` + +Methods: + +- client.radar.tcp_resets_timeouts.summary(\*\*params) -> TCPResetsTimeoutSummaryResponse +- client.radar.tcp_resets_timeouts.timeseries_groups(\*\*params) -> TCPResetsTimeoutTimeseriesGroupsResponse + # BotManagement Types: @@ -7312,3 +7328,18 @@ Methods: - client.iam.resource_groups.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[object] - client.iam.resource_groups.delete(resource_group_id, \*, account_id) -> Optional - client.iam.resource_groups.get(resource_group_id, \*, account_id) -> ResourceGroupGetResponse + +# CloudConnector + +## Rules + +Types: + +```python +from cloudflare.types.cloud_connector import RuleUpdateResponse, RuleListResponse +``` + +Methods: + +- client.cloud_connector.rules.update(\*, zone_id, \*\*params) -> Optional +- client.cloud_connector.rules.list(\*, zone_id) -> SyncSinglePage[RuleListResponse] diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index 4aa3abb1416..6e2928862dd 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -131,6 +131,7 @@ class Cloudflare(SyncAPIClient): event_notifications: resources.EventNotificationsResource ai_gateway: resources.AIGatewayResource iam: resources.IAMResource + cloud_connector: resources.CloudConnectorResource with_raw_response: CloudflareWithRawResponse with_streaming_response: CloudflareWithStreamedResponse @@ -290,6 +291,7 @@ def __init__( self.event_notifications = resources.EventNotificationsResource(self) self.ai_gateway = resources.AIGatewayResource(self) self.iam = resources.IAMResource(self) + self.cloud_connector = resources.CloudConnectorResource(self) self.with_raw_response = CloudflareWithRawResponse(self) self.with_streaming_response = CloudflareWithStreamedResponse(self) @@ -552,6 +554,7 @@ class AsyncCloudflare(AsyncAPIClient): event_notifications: resources.AsyncEventNotificationsResource ai_gateway: resources.AsyncAIGatewayResource iam: resources.AsyncIAMResource + cloud_connector: resources.AsyncCloudConnectorResource with_raw_response: AsyncCloudflareWithRawResponse with_streaming_response: AsyncCloudflareWithStreamedResponse @@ -711,6 +714,7 @@ def __init__( self.event_notifications = resources.AsyncEventNotificationsResource(self) self.ai_gateway = resources.AsyncAIGatewayResource(self) self.iam = resources.AsyncIAMResource(self) + self.cloud_connector = resources.AsyncCloudConnectorResource(self) self.with_raw_response = AsyncCloudflareWithRawResponse(self) self.with_streaming_response = AsyncCloudflareWithStreamedResponse(self) @@ -984,6 +988,7 @@ def __init__(self, client: Cloudflare) -> None: self.event_notifications = resources.EventNotificationsResourceWithRawResponse(client.event_notifications) self.ai_gateway = resources.AIGatewayResourceWithRawResponse(client.ai_gateway) self.iam = resources.IAMResourceWithRawResponse(client.iam) + self.cloud_connector = resources.CloudConnectorResourceWithRawResponse(client.cloud_connector) class AsyncCloudflareWithRawResponse: @@ -1086,6 +1091,7 @@ def __init__(self, client: AsyncCloudflare) -> None: self.event_notifications = resources.AsyncEventNotificationsResourceWithRawResponse(client.event_notifications) self.ai_gateway = resources.AsyncAIGatewayResourceWithRawResponse(client.ai_gateway) self.iam = resources.AsyncIAMResourceWithRawResponse(client.iam) + self.cloud_connector = resources.AsyncCloudConnectorResourceWithRawResponse(client.cloud_connector) class CloudflareWithStreamedResponse: @@ -1188,6 +1194,7 @@ def __init__(self, client: Cloudflare) -> None: self.event_notifications = resources.EventNotificationsResourceWithStreamingResponse(client.event_notifications) self.ai_gateway = resources.AIGatewayResourceWithStreamingResponse(client.ai_gateway) self.iam = resources.IAMResourceWithStreamingResponse(client.iam) + self.cloud_connector = resources.CloudConnectorResourceWithStreamingResponse(client.cloud_connector) class AsyncCloudflareWithStreamedResponse: @@ -1298,6 +1305,7 @@ def __init__(self, client: AsyncCloudflare) -> None: ) self.ai_gateway = resources.AsyncAIGatewayResourceWithStreamingResponse(client.ai_gateway) self.iam = resources.AsyncIAMResourceWithStreamingResponse(client.iam) + self.cloud_connector = resources.AsyncCloudConnectorResourceWithStreamingResponse(client.cloud_connector) Client = Cloudflare diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index 05545390c25..35be298a563 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -528,6 +528,14 @@ WARPConnectorResourceWithStreamingResponse, AsyncWARPConnectorResourceWithStreamingResponse, ) +from .cloud_connector import ( + CloudConnectorResource, + AsyncCloudConnectorResource, + CloudConnectorResourceWithRawResponse, + AsyncCloudConnectorResourceWithRawResponse, + CloudConnectorResourceWithStreamingResponse, + AsyncCloudConnectorResourceWithStreamingResponse, +) from .durable_objects import ( DurableObjectsResource, AsyncDurableObjectsResource, @@ -1178,4 +1186,10 @@ "AsyncIAMResourceWithRawResponse", "IAMResourceWithStreamingResponse", "AsyncIAMResourceWithStreamingResponse", + "CloudConnectorResource", + "AsyncCloudConnectorResource", + "CloudConnectorResourceWithRawResponse", + "AsyncCloudConnectorResourceWithRawResponse", + "CloudConnectorResourceWithStreamingResponse", + "AsyncCloudConnectorResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/cloud_connector/__init__.py b/src/cloudflare/resources/cloud_connector/__init__.py new file mode 100644 index 00000000000..da4c14aec1c --- /dev/null +++ b/src/cloudflare/resources/cloud_connector/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from .cloud_connector import ( + CloudConnectorResource, + AsyncCloudConnectorResource, + CloudConnectorResourceWithRawResponse, + AsyncCloudConnectorResourceWithRawResponse, + CloudConnectorResourceWithStreamingResponse, + AsyncCloudConnectorResourceWithStreamingResponse, +) + +__all__ = [ + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "CloudConnectorResource", + "AsyncCloudConnectorResource", + "CloudConnectorResourceWithRawResponse", + "AsyncCloudConnectorResourceWithRawResponse", + "CloudConnectorResourceWithStreamingResponse", + "AsyncCloudConnectorResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/cloud_connector/cloud_connector.py b/src/cloudflare/resources/cloud_connector/cloud_connector.py new file mode 100644 index 00000000000..f95e76646df --- /dev/null +++ b/src/cloudflare/resources/cloud_connector/cloud_connector.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["CloudConnectorResource", "AsyncCloudConnectorResource"] + + +class CloudConnectorResource(SyncAPIResource): + @cached_property + def rules(self) -> RulesResource: + return RulesResource(self._client) + + @cached_property + def with_raw_response(self) -> CloudConnectorResourceWithRawResponse: + return CloudConnectorResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CloudConnectorResourceWithStreamingResponse: + return CloudConnectorResourceWithStreamingResponse(self) + + +class AsyncCloudConnectorResource(AsyncAPIResource): + @cached_property + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncCloudConnectorResourceWithRawResponse: + return AsyncCloudConnectorResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCloudConnectorResourceWithStreamingResponse: + return AsyncCloudConnectorResourceWithStreamingResponse(self) + + +class CloudConnectorResourceWithRawResponse: + def __init__(self, cloud_connector: CloudConnectorResource) -> None: + self._cloud_connector = cloud_connector + + @cached_property + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._cloud_connector.rules) + + +class AsyncCloudConnectorResourceWithRawResponse: + def __init__(self, cloud_connector: AsyncCloudConnectorResource) -> None: + self._cloud_connector = cloud_connector + + @cached_property + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._cloud_connector.rules) + + +class CloudConnectorResourceWithStreamingResponse: + def __init__(self, cloud_connector: CloudConnectorResource) -> None: + self._cloud_connector = cloud_connector + + @cached_property + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._cloud_connector.rules) + + +class AsyncCloudConnectorResourceWithStreamingResponse: + def __init__(self, cloud_connector: AsyncCloudConnectorResource) -> None: + self._cloud_connector = cloud_connector + + @cached_property + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._cloud_connector.rules) diff --git a/src/cloudflare/resources/cloud_connector/rules.py b/src/cloudflare/resources/cloud_connector/rules.py new file mode 100644 index 00000000000..0b741471554 --- /dev/null +++ b/src/cloudflare/resources/cloud_connector/rules.py @@ -0,0 +1,255 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Iterable, Optional, cast + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cloud_connector import rule_update_params +from ...types.cloud_connector.rule_list_response import RuleListResponse +from ...types.cloud_connector.rule_update_response import RuleUpdateResponse + +__all__ = ["RulesResource", "AsyncRulesResource"] + + +class RulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self) + + def update( + self, + *, + zone_id: str, + body: Iterable[rule_update_params.Body], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RuleUpdateResponse]: + """ + Put Rules + + Args: + zone_id: Identifier + + body: List of Cloud Connector rules + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._put( + f"/zones/{zone_id}/cloud_connector/rules", + body=maybe_transform(body, rule_update_params.RuleUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleUpdateResponse]], ResultWrapper[RuleUpdateResponse]), + ) + + def list( + self, + *, + zone_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[RuleListResponse]: + """ + Rules + + Args: + zone_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._get_api_list( + f"/zones/{zone_id}/cloud_connector/rules", + page=SyncSinglePage[RuleListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RuleListResponse, + ) + + +class AsyncRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self) + + async def update( + self, + *, + zone_id: str, + body: Iterable[rule_update_params.Body], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[RuleUpdateResponse]: + """ + Put Rules + + Args: + zone_id: Identifier + + body: List of Cloud Connector rules + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return await self._put( + f"/zones/{zone_id}/cloud_connector/rules", + body=await async_maybe_transform(body, rule_update_params.RuleUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RuleUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RuleUpdateResponse]], ResultWrapper[RuleUpdateResponse]), + ) + + def list( + self, + *, + zone_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[RuleListResponse, AsyncSinglePage[RuleListResponse]]: + """ + Rules + + Args: + zone_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._get_api_list( + f"/zones/{zone_id}/cloud_connector/rules", + page=AsyncSinglePage[RuleListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RuleListResponse, + ) + + +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.update = to_raw_response_wrapper( + rules.update, + ) + self.list = to_raw_response_wrapper( + rules.list, + ) + + +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.update = async_to_raw_response_wrapper( + rules.update, + ) + self.list = async_to_raw_response_wrapper( + rules.list, + ) + + +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.update = to_streamed_response_wrapper( + rules.update, + ) + self.list = to_streamed_response_wrapper( + rules.list, + ) + + +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.update = async_to_streamed_response_wrapper( + rules.update, + ) + self.list = async_to_streamed_response_wrapper( + rules.list, + ) diff --git a/src/cloudflare/resources/radar/__init__.py b/src/cloudflare/resources/radar/__init__.py index 20485edccb2..5ea83f8d764 100644 --- a/src/cloudflare/resources/radar/__init__.py +++ b/src/cloudflare/resources/radar/__init__.py @@ -128,6 +128,14 @@ TrafficAnomaliesResourceWithStreamingResponse, AsyncTrafficAnomaliesResourceWithStreamingResponse, ) +from .tcp_resets_timeouts import ( + TCPResetsTimeoutsResource, + AsyncTCPResetsTimeoutsResource, + TCPResetsTimeoutsResourceWithRawResponse, + AsyncTCPResetsTimeoutsResourceWithRawResponse, + TCPResetsTimeoutsResourceWithStreamingResponse, + AsyncTCPResetsTimeoutsResourceWithStreamingResponse, +) __all__ = [ "AnnotationsResource", @@ -220,6 +228,12 @@ "AsyncTrafficAnomaliesResourceWithRawResponse", "TrafficAnomaliesResourceWithStreamingResponse", "AsyncTrafficAnomaliesResourceWithStreamingResponse", + "TCPResetsTimeoutsResource", + "AsyncTCPResetsTimeoutsResource", + "TCPResetsTimeoutsResourceWithRawResponse", + "AsyncTCPResetsTimeoutsResourceWithRawResponse", + "TCPResetsTimeoutsResourceWithStreamingResponse", + "AsyncTCPResetsTimeoutsResourceWithStreamingResponse", "RadarResource", "AsyncRadarResource", "RadarResourceWithRawResponse", diff --git a/src/cloudflare/resources/radar/radar.py b/src/cloudflare/resources/radar/radar.py index 29a0fd5a913..555d88e7bf5 100644 --- a/src/cloudflare/resources/radar/radar.py +++ b/src/cloudflare/resources/radar/radar.py @@ -134,6 +134,14 @@ TrafficAnomaliesResourceWithStreamingResponse, AsyncTrafficAnomaliesResourceWithStreamingResponse, ) +from .tcp_resets_timeouts import ( + TCPResetsTimeoutsResource, + AsyncTCPResetsTimeoutsResource, + TCPResetsTimeoutsResourceWithRawResponse, + AsyncTCPResetsTimeoutsResourceWithRawResponse, + TCPResetsTimeoutsResourceWithStreamingResponse, + AsyncTCPResetsTimeoutsResourceWithStreamingResponse, +) from .annotations.annotations import AnnotationsResource, AsyncAnnotationsResource from .verified_bots.verified_bots import VerifiedBotsResource, AsyncVerifiedBotsResource from .traffic_anomalies.traffic_anomalies import TrafficAnomaliesResource, AsyncTrafficAnomaliesResource @@ -202,6 +210,10 @@ def ranking(self) -> RankingResource: def traffic_anomalies(self) -> TrafficAnomaliesResource: return TrafficAnomaliesResource(self._client) + @cached_property + def tcp_resets_timeouts(self) -> TCPResetsTimeoutsResource: + return TCPResetsTimeoutsResource(self._client) + @cached_property def with_raw_response(self) -> RadarResourceWithRawResponse: return RadarResourceWithRawResponse(self) @@ -272,6 +284,10 @@ def ranking(self) -> AsyncRankingResource: def traffic_anomalies(self) -> AsyncTrafficAnomaliesResource: return AsyncTrafficAnomaliesResource(self._client) + @cached_property + def tcp_resets_timeouts(self) -> AsyncTCPResetsTimeoutsResource: + return AsyncTCPResetsTimeoutsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncRadarResourceWithRawResponse: return AsyncRadarResourceWithRawResponse(self) @@ -345,6 +361,10 @@ def ranking(self) -> RankingResourceWithRawResponse: def traffic_anomalies(self) -> TrafficAnomaliesResourceWithRawResponse: return TrafficAnomaliesResourceWithRawResponse(self._radar.traffic_anomalies) + @cached_property + def tcp_resets_timeouts(self) -> TCPResetsTimeoutsResourceWithRawResponse: + return TCPResetsTimeoutsResourceWithRawResponse(self._radar.tcp_resets_timeouts) + class AsyncRadarResourceWithRawResponse: def __init__(self, radar: AsyncRadarResource) -> None: @@ -410,6 +430,10 @@ def ranking(self) -> AsyncRankingResourceWithRawResponse: def traffic_anomalies(self) -> AsyncTrafficAnomaliesResourceWithRawResponse: return AsyncTrafficAnomaliesResourceWithRawResponse(self._radar.traffic_anomalies) + @cached_property + def tcp_resets_timeouts(self) -> AsyncTCPResetsTimeoutsResourceWithRawResponse: + return AsyncTCPResetsTimeoutsResourceWithRawResponse(self._radar.tcp_resets_timeouts) + class RadarResourceWithStreamingResponse: def __init__(self, radar: RadarResource) -> None: @@ -475,6 +499,10 @@ def ranking(self) -> RankingResourceWithStreamingResponse: def traffic_anomalies(self) -> TrafficAnomaliesResourceWithStreamingResponse: return TrafficAnomaliesResourceWithStreamingResponse(self._radar.traffic_anomalies) + @cached_property + def tcp_resets_timeouts(self) -> TCPResetsTimeoutsResourceWithStreamingResponse: + return TCPResetsTimeoutsResourceWithStreamingResponse(self._radar.tcp_resets_timeouts) + class AsyncRadarResourceWithStreamingResponse: def __init__(self, radar: AsyncRadarResource) -> None: @@ -539,3 +567,7 @@ def ranking(self) -> AsyncRankingResourceWithStreamingResponse: @cached_property def traffic_anomalies(self) -> AsyncTrafficAnomaliesResourceWithStreamingResponse: return AsyncTrafficAnomaliesResourceWithStreamingResponse(self._radar.traffic_anomalies) + + @cached_property + def tcp_resets_timeouts(self) -> AsyncTCPResetsTimeoutsResourceWithStreamingResponse: + return AsyncTCPResetsTimeoutsResourceWithStreamingResponse(self._radar.tcp_resets_timeouts) diff --git a/src/cloudflare/resources/radar/tcp_resets_timeouts.py b/src/cloudflare/resources/radar/tcp_resets_timeouts.py new file mode 100644 index 00000000000..1a87837a3af --- /dev/null +++ b/src/cloudflare/resources/radar/tcp_resets_timeouts.py @@ -0,0 +1,434 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Type, Union, cast +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 ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._wrappers import ResultWrapper +from ...types.radar import tcp_resets_timeout_summary_params, tcp_resets_timeout_timeseries_groups_params +from ..._base_client import make_request_options +from ...types.radar.tcp_resets_timeout_summary_response import TCPResetsTimeoutSummaryResponse +from ...types.radar.tcp_resets_timeout_timeseries_groups_response import TCPResetsTimeoutTimeseriesGroupsResponse + +__all__ = ["TCPResetsTimeoutsResource", "AsyncTCPResetsTimeoutsResource"] + + +class TCPResetsTimeoutsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TCPResetsTimeoutsResourceWithRawResponse: + return TCPResetsTimeoutsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TCPResetsTimeoutsResourceWithStreamingResponse: + return TCPResetsTimeoutsResourceWithStreamingResponse(self) + + def summary( + self, + *, + asn: List[str] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[str] | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TCPResetsTimeoutSummaryResponse: + """ + Percentage distribution by connection stage of TCP connections terminated within + the first 10 packets by a reset or timeout, for a given time period. + + Args: + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + format: Format results are returned in. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/radar/tcp_resets_timeouts/summary", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "asn": asn, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "format": format, + "location": location, + "name": name, + }, + tcp_resets_timeout_summary_params.TCPResetsTimeoutSummaryParams, + ), + post_parser=ResultWrapper[TCPResetsTimeoutSummaryResponse]._unwrapper, + ), + cast_to=cast(Type[TCPResetsTimeoutSummaryResponse], ResultWrapper[TCPResetsTimeoutSummaryResponse]), + ) + + def timeseries_groups( + self, + *, + agg_interval: Literal["15m", "1h", "1d", "1w"] | NotGiven = NOT_GIVEN, + asn: List[str] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[str] | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TCPResetsTimeoutTimeseriesGroupsResponse: + """ + Percentage distribution by connection stage of TCP connections terminated within + the first 10 packets by a reset or timeout, over time. + + Args: + agg_interval: Aggregation interval results should be returned in (for example, in 15 minutes + or 1 hour intervals). Refer to + [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + format: Format results are returned in. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/radar/tcp_resets_timeouts/timeseries_groups", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "agg_interval": agg_interval, + "asn": asn, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "format": format, + "location": location, + "name": name, + }, + tcp_resets_timeout_timeseries_groups_params.TCPResetsTimeoutTimeseriesGroupsParams, + ), + post_parser=ResultWrapper[TCPResetsTimeoutTimeseriesGroupsResponse]._unwrapper, + ), + cast_to=cast( + Type[TCPResetsTimeoutTimeseriesGroupsResponse], ResultWrapper[TCPResetsTimeoutTimeseriesGroupsResponse] + ), + ) + + +class AsyncTCPResetsTimeoutsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTCPResetsTimeoutsResourceWithRawResponse: + return AsyncTCPResetsTimeoutsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTCPResetsTimeoutsResourceWithStreamingResponse: + return AsyncTCPResetsTimeoutsResourceWithStreamingResponse(self) + + async def summary( + self, + *, + asn: List[str] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[str] | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TCPResetsTimeoutSummaryResponse: + """ + Percentage distribution by connection stage of TCP connections terminated within + the first 10 packets by a reset or timeout, for a given time period. + + Args: + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + format: Format results are returned in. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/radar/tcp_resets_timeouts/summary", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "asn": asn, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "format": format, + "location": location, + "name": name, + }, + tcp_resets_timeout_summary_params.TCPResetsTimeoutSummaryParams, + ), + post_parser=ResultWrapper[TCPResetsTimeoutSummaryResponse]._unwrapper, + ), + cast_to=cast(Type[TCPResetsTimeoutSummaryResponse], ResultWrapper[TCPResetsTimeoutSummaryResponse]), + ) + + async def timeseries_groups( + self, + *, + agg_interval: Literal["15m", "1h", "1d", "1w"] | NotGiven = NOT_GIVEN, + asn: List[str] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[str] | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TCPResetsTimeoutTimeseriesGroupsResponse: + """ + Percentage distribution by connection stage of TCP connections terminated within + the first 10 packets by a reset or timeout, over time. + + Args: + agg_interval: Aggregation interval results should be returned in (for example, in 15 minutes + or 1 hour intervals). Refer to + [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + format: Format results are returned in. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/radar/tcp_resets_timeouts/timeseries_groups", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "agg_interval": agg_interval, + "asn": asn, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "format": format, + "location": location, + "name": name, + }, + tcp_resets_timeout_timeseries_groups_params.TCPResetsTimeoutTimeseriesGroupsParams, + ), + post_parser=ResultWrapper[TCPResetsTimeoutTimeseriesGroupsResponse]._unwrapper, + ), + cast_to=cast( + Type[TCPResetsTimeoutTimeseriesGroupsResponse], ResultWrapper[TCPResetsTimeoutTimeseriesGroupsResponse] + ), + ) + + +class TCPResetsTimeoutsResourceWithRawResponse: + def __init__(self, tcp_resets_timeouts: TCPResetsTimeoutsResource) -> None: + self._tcp_resets_timeouts = tcp_resets_timeouts + + self.summary = to_raw_response_wrapper( + tcp_resets_timeouts.summary, + ) + self.timeseries_groups = to_raw_response_wrapper( + tcp_resets_timeouts.timeseries_groups, + ) + + +class AsyncTCPResetsTimeoutsResourceWithRawResponse: + def __init__(self, tcp_resets_timeouts: AsyncTCPResetsTimeoutsResource) -> None: + self._tcp_resets_timeouts = tcp_resets_timeouts + + self.summary = async_to_raw_response_wrapper( + tcp_resets_timeouts.summary, + ) + self.timeseries_groups = async_to_raw_response_wrapper( + tcp_resets_timeouts.timeseries_groups, + ) + + +class TCPResetsTimeoutsResourceWithStreamingResponse: + def __init__(self, tcp_resets_timeouts: TCPResetsTimeoutsResource) -> None: + self._tcp_resets_timeouts = tcp_resets_timeouts + + self.summary = to_streamed_response_wrapper( + tcp_resets_timeouts.summary, + ) + self.timeseries_groups = to_streamed_response_wrapper( + tcp_resets_timeouts.timeseries_groups, + ) + + +class AsyncTCPResetsTimeoutsResourceWithStreamingResponse: + def __init__(self, tcp_resets_timeouts: AsyncTCPResetsTimeoutsResource) -> None: + self._tcp_resets_timeouts = tcp_resets_timeouts + + self.summary = async_to_streamed_response_wrapper( + tcp_resets_timeouts.summary, + ) + self.timeseries_groups = async_to_streamed_response_wrapper( + tcp_resets_timeouts.timeseries_groups, + ) diff --git a/src/cloudflare/types/cloud_connector/__init__.py b/src/cloudflare/types/cloud_connector/__init__.py new file mode 100644 index 00000000000..2cf9f9bde2d --- /dev/null +++ b/src/cloudflare/types/cloud_connector/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .rule_list_response import RuleListResponse as RuleListResponse +from .rule_update_params import RuleUpdateParams as RuleUpdateParams +from .rule_update_response import RuleUpdateResponse as RuleUpdateResponse diff --git a/src/cloudflare/types/cloud_connector/rule_list_response.py b/src/cloudflare/types/cloud_connector/rule_list_response.py new file mode 100644 index 00000000000..059d139b74b --- /dev/null +++ b/src/cloudflare/types/cloud_connector/rule_list_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["RuleListResponse", "Parameters"] + + +class Parameters(BaseModel): + host: Optional[str] = None + """Host to perform Cloud Connection to""" + + +class RuleListResponse(BaseModel): + id: Optional[str] = None + + description: Optional[str] = None + + enabled: Optional[bool] = None + + expression: Optional[str] = None + + parameters: Optional[Parameters] = None + """Parameters of Cloud Connector Rule""" + + provider: Optional[Literal["aws_s3", "r2", "gcp_storage", "azure_storage"]] = None + """Cloud Provider type""" diff --git a/src/cloudflare/types/cloud_connector/rule_update_params.py b/src/cloudflare/types/cloud_connector/rule_update_params.py new file mode 100644 index 00000000000..f8c25c9b2a7 --- /dev/null +++ b/src/cloudflare/types/cloud_connector/rule_update_params.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["RuleUpdateParams", "Body", "BodyParameters"] + + +class RuleUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[Iterable[Body]] + """List of Cloud Connector rules""" + + +class BodyParameters(TypedDict, total=False): + host: str + """Host to perform Cloud Connection to""" + + +class Body(TypedDict, total=False): + id: str + + description: str + + enabled: bool + + expression: str + + parameters: BodyParameters + """Parameters of Cloud Connector Rule""" + + provider: Literal["aws_s3", "r2", "gcp_storage", "azure_storage"] + """Cloud Provider type""" diff --git a/src/cloudflare/types/cloud_connector/rule_update_response.py b/src/cloudflare/types/cloud_connector/rule_update_response.py new file mode 100644 index 00000000000..86d08cd682e --- /dev/null +++ b/src/cloudflare/types/cloud_connector/rule_update_response.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["RuleUpdateResponse", "RuleUpdateResponseItem", "RuleUpdateResponseItemParameters"] + + +class RuleUpdateResponseItemParameters(BaseModel): + host: Optional[str] = None + """Host to perform Cloud Connection to""" + + +class RuleUpdateResponseItem(BaseModel): + id: Optional[str] = None + + description: Optional[str] = None + + enabled: Optional[bool] = None + + expression: Optional[str] = None + + parameters: Optional[RuleUpdateResponseItemParameters] = None + """Parameters of Cloud Connector Rule""" + + provider: Optional[Literal["aws_s3", "r2", "gcp_storage", "azure_storage"]] = None + """Cloud Provider type""" + + +RuleUpdateResponse = List[RuleUpdateResponseItem] diff --git a/src/cloudflare/types/radar/__init__.py b/src/cloudflare/types/radar/__init__.py index c41928c0014..6fc109e3bb2 100644 --- a/src/cloudflare/types/radar/__init__.py +++ b/src/cloudflare/types/radar/__init__.py @@ -26,4 +26,12 @@ from .netflow_timeseries_response import NetflowTimeseriesResponse as NetflowTimeseriesResponse from .traffic_anomaly_get_response import TrafficAnomalyGetResponse as TrafficAnomalyGetResponse from .ranking_timeseries_groups_params import RankingTimeseriesGroupsParams as RankingTimeseriesGroupsParams +from .tcp_resets_timeout_summary_params import TCPResetsTimeoutSummaryParams as TCPResetsTimeoutSummaryParams from .ranking_timeseries_groups_response import RankingTimeseriesGroupsResponse as RankingTimeseriesGroupsResponse +from .tcp_resets_timeout_summary_response import TCPResetsTimeoutSummaryResponse as TCPResetsTimeoutSummaryResponse +from .tcp_resets_timeout_timeseries_groups_params import ( + TCPResetsTimeoutTimeseriesGroupsParams as TCPResetsTimeoutTimeseriesGroupsParams, +) +from .tcp_resets_timeout_timeseries_groups_response import ( + TCPResetsTimeoutTimeseriesGroupsResponse as TCPResetsTimeoutTimeseriesGroupsResponse, +) diff --git a/src/cloudflare/types/radar/tcp_resets_timeout_summary_params.py b/src/cloudflare/types/radar/tcp_resets_timeout_summary_params.py new file mode 100644 index 00000000000..a278b500c38 --- /dev/null +++ b/src/cloudflare/types/radar/tcp_resets_timeout_summary_params.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["TCPResetsTimeoutSummaryParams"] + + +class TCPResetsTimeoutSummaryParams(TypedDict, total=False): + asn: List[str] + """Array of comma separated list of ASNs, start with `-` to exclude from results. + + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + """ + + continent: List[str] + """Array of comma separated list of continents (alpha-2 continent codes). + + Start with `-` to exclude from results. For example, `-EU,NA` excludes results + from Europe, but includes results from North America. + """ + + date_end: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateEnd", format="iso8601")] + """End of the date range (inclusive).""" + + date_range: Annotated[List[str], PropertyInfo(alias="dateRange")] + """ + For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + """ + + date_start: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateStart", format="iso8601")] + """Array of datetimes to filter the start of a series.""" + + format: Literal["JSON", "CSV"] + """Format results are returned in.""" + + location: List[str] + """Array of comma separated list of locations (alpha-2 country codes). + + Start with `-` to exclude from results. For example, `-US,PT` excludes results + from the US, but includes results from PT. + """ + + name: List[str] + """Array of names that will be used to name the series in responses.""" diff --git a/src/cloudflare/types/radar/tcp_resets_timeout_summary_response.py b/src/cloudflare/types/radar/tcp_resets_timeout_summary_response.py new file mode 100644 index 00000000000..f38a9c7df46 --- /dev/null +++ b/src/cloudflare/types/radar/tcp_resets_timeout_summary_response.py @@ -0,0 +1,88 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "TCPResetsTimeoutSummaryResponse", + "Meta", + "MetaDateRange", + "MetaConfidenceInfo", + "MetaConfidenceInfoAnnotation", + "Summary0", +] + + +class MetaDateRange(BaseModel): + end_time: datetime = FieldInfo(alias="endTime") + """Adjusted end of date range.""" + + start_time: datetime = FieldInfo(alias="startTime") + """Adjusted start of date range.""" + + +class MetaConfidenceInfoAnnotation(BaseModel): + data_source: str = FieldInfo(alias="dataSource") + + description: str + + event_type: str = FieldInfo(alias="eventType") + + is_instantaneous: bool = FieldInfo(alias="isInstantaneous") + + end_time: Optional[datetime] = FieldInfo(alias="endTime", default=None) + + linked_url: Optional[str] = FieldInfo(alias="linkedUrl", default=None) + + start_time: Optional[datetime] = FieldInfo(alias="startTime", default=None) + + +class MetaConfidenceInfo(BaseModel): + annotations: Optional[List[MetaConfidenceInfoAnnotation]] = None + + level: Optional[int] = None + + +class Meta(BaseModel): + date_range: List[MetaDateRange] = FieldInfo(alias="dateRange") + + confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) + + +class Summary0(BaseModel): + later_in_flow: str + """ + Connection resets within the first 10 packets from the client, but after the + server has received multiple data packets. + """ + + no_match: str + """All other connections.""" + + post_ack: str + """ + Connection resets or timeouts after the server received both a SYN packet and an + ACK packet, meaning the connection was successfully established. + """ + + post_psh: str + """ + Connection resets or timeouts after the server received a packet with PSH flag + set, following connection establishment. + """ + + post_syn: str + """ + Connection resets or timeouts after the server received only a single SYN + packet. + """ + + +class TCPResetsTimeoutSummaryResponse(BaseModel): + meta: Meta + + summary_0: Summary0 diff --git a/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_params.py b/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_params.py new file mode 100644 index 00000000000..81d83b0cdc2 --- /dev/null +++ b/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_params.py @@ -0,0 +1,60 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["TCPResetsTimeoutTimeseriesGroupsParams"] + + +class TCPResetsTimeoutTimeseriesGroupsParams(TypedDict, total=False): + agg_interval: Annotated[Literal["15m", "1h", "1d", "1w"], PropertyInfo(alias="aggInterval")] + """ + Aggregation interval results should be returned in (for example, in 15 minutes + or 1 hour intervals). Refer to + [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + """ + + asn: List[str] + """Array of comma separated list of ASNs, start with `-` to exclude from results. + + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + """ + + continent: List[str] + """Array of comma separated list of continents (alpha-2 continent codes). + + Start with `-` to exclude from results. For example, `-EU,NA` excludes results + from Europe, but includes results from North America. + """ + + date_end: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateEnd", format="iso8601")] + """End of the date range (inclusive).""" + + date_range: Annotated[List[str], PropertyInfo(alias="dateRange")] + """ + For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + """ + + date_start: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateStart", format="iso8601")] + """Array of datetimes to filter the start of a series.""" + + format: Literal["JSON", "CSV"] + """Format results are returned in.""" + + location: List[str] + """Array of comma separated list of locations (alpha-2 country codes). + + Start with `-` to exclude from results. For example, `-US,PT` excludes results + from the US, but includes results from PT. + """ + + name: List[str] + """Array of names that will be used to name the series in responses.""" diff --git a/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_response.py b/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_response.py new file mode 100644 index 00000000000..84e1ce0e8ea --- /dev/null +++ b/src/cloudflare/types/radar/tcp_resets_timeout_timeseries_groups_response.py @@ -0,0 +1,94 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "TCPResetsTimeoutTimeseriesGroupsResponse", + "Meta", + "MetaDateRange", + "MetaConfidenceInfo", + "MetaConfidenceInfoAnnotation", + "Serie0", +] + + +class MetaDateRange(BaseModel): + end_time: datetime = FieldInfo(alias="endTime") + """Adjusted end of date range.""" + + start_time: datetime = FieldInfo(alias="startTime") + """Adjusted start of date range.""" + + +class MetaConfidenceInfoAnnotation(BaseModel): + data_source: str = FieldInfo(alias="dataSource") + + description: str + + event_type: str = FieldInfo(alias="eventType") + + is_instantaneous: bool = FieldInfo(alias="isInstantaneous") + + end_time: Optional[datetime] = FieldInfo(alias="endTime", default=None) + + linked_url: Optional[str] = FieldInfo(alias="linkedUrl", default=None) + + start_time: Optional[datetime] = FieldInfo(alias="startTime", default=None) + + +class MetaConfidenceInfo(BaseModel): + annotations: Optional[List[MetaConfidenceInfoAnnotation]] = None + + level: Optional[int] = None + + +class Meta(BaseModel): + agg_interval: str = FieldInfo(alias="aggInterval") + + date_range: List[MetaDateRange] = FieldInfo(alias="dateRange") + + last_updated: datetime = FieldInfo(alias="lastUpdated") + + confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) + + +class Serie0(BaseModel): + later_in_flow: List[str] + """ + Connection resets within the first 10 packets from the client, but after the + server has received multiple data packets. + """ + + no_match: List[str] + """All other connections.""" + + post_ack: List[str] + """ + Connection resets or timeouts after the server received both a SYN packet and an + ACK packet, meaning the connection was successfully established. + """ + + post_psh: List[str] + """ + Connection resets or timeouts after the server received a packet with PSH flag + set, following connection establishment. + """ + + post_syn: List[str] + """ + Connection resets or timeouts after the server received only a single SYN + packet. + """ + + timestamps: List[datetime] + + +class TCPResetsTimeoutTimeseriesGroupsResponse(BaseModel): + meta: Meta + + serie_0: Serie0 diff --git a/tests/api_resources/cloud_connector/__init__.py b/tests/api_resources/cloud_connector/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/cloud_connector/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud_connector/test_rules.py b/tests/api_resources/cloud_connector/test_rules.py new file mode 100644 index 00000000000..8506196e905 --- /dev/null +++ b/tests/api_resources/cloud_connector/test_rules.py @@ -0,0 +1,183 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.cloud_connector import RuleListResponse, RuleUpdateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + rule = client.cloud_connector.rules.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[{}, {}, {}], + ) + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.cloud_connector.rules.with_raw_response.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[{}, {}, {}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.cloud_connector.rules.with_streaming_response.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[{}, {}, {}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.cloud_connector.rules.with_raw_response.update( + zone_id="", + body=[{}, {}, {}], + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + rule = client.cloud_connector.rules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[RuleListResponse], rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.cloud_connector.rules.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(SyncSinglePage[RuleListResponse], rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.cloud_connector.rules.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(SyncSinglePage[RuleListResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.cloud_connector.rules.with_raw_response.list( + zone_id="", + ) + + +class TestAsyncRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.cloud_connector.rules.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[{}, {}, {}], + ) + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.cloud_connector.rules.with_raw_response.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[{}, {}, {}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.cloud_connector.rules.with_streaming_response.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[{}, {}, {}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(Optional[RuleUpdateResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.cloud_connector.rules.with_raw_response.update( + zone_id="", + body=[{}, {}, {}], + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.cloud_connector.rules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[RuleListResponse], rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.cloud_connector.rules.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(AsyncSinglePage[RuleListResponse], rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.cloud_connector.rules.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(AsyncSinglePage[RuleListResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.cloud_connector.rules.with_raw_response.list( + zone_id="", + ) diff --git a/tests/api_resources/radar/test_tcp_resets_timeouts.py b/tests/api_resources/radar/test_tcp_resets_timeouts.py new file mode 100644 index 00000000000..fc54e4be455 --- /dev/null +++ b/tests/api_resources/radar/test_tcp_resets_timeouts.py @@ -0,0 +1,216 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare._utils import parse_datetime +from cloudflare.types.radar import ( + TCPResetsTimeoutSummaryResponse, + TCPResetsTimeoutTimeseriesGroupsResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTCPResetsTimeouts: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_summary(self, client: Cloudflare) -> None: + tcp_resets_timeout = client.radar.tcp_resets_timeouts.summary() + assert_matches_type(TCPResetsTimeoutSummaryResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + def test_method_summary_with_all_params(self, client: Cloudflare) -> None: + tcp_resets_timeout = client.radar.tcp_resets_timeouts.summary( + asn=["string", "string", "string"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["7d", "7d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + format="JSON", + location=["string", "string", "string"], + name=["string", "string", "string"], + ) + assert_matches_type(TCPResetsTimeoutSummaryResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + def test_raw_response_summary(self, client: Cloudflare) -> None: + response = client.radar.tcp_resets_timeouts.with_raw_response.summary() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tcp_resets_timeout = response.parse() + assert_matches_type(TCPResetsTimeoutSummaryResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + def test_streaming_response_summary(self, client: Cloudflare) -> None: + with client.radar.tcp_resets_timeouts.with_streaming_response.summary() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tcp_resets_timeout = response.parse() + assert_matches_type(TCPResetsTimeoutSummaryResponse, tcp_resets_timeout, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_timeseries_groups(self, client: Cloudflare) -> None: + tcp_resets_timeout = client.radar.tcp_resets_timeouts.timeseries_groups() + assert_matches_type(TCPResetsTimeoutTimeseriesGroupsResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + def test_method_timeseries_groups_with_all_params(self, client: Cloudflare) -> None: + tcp_resets_timeout = client.radar.tcp_resets_timeouts.timeseries_groups( + agg_interval="1h", + asn=["string", "string", "string"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["7d", "7d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + format="JSON", + location=["string", "string", "string"], + name=["string", "string", "string"], + ) + assert_matches_type(TCPResetsTimeoutTimeseriesGroupsResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + def test_raw_response_timeseries_groups(self, client: Cloudflare) -> None: + response = client.radar.tcp_resets_timeouts.with_raw_response.timeseries_groups() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tcp_resets_timeout = response.parse() + assert_matches_type(TCPResetsTimeoutTimeseriesGroupsResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + def test_streaming_response_timeseries_groups(self, client: Cloudflare) -> None: + with client.radar.tcp_resets_timeouts.with_streaming_response.timeseries_groups() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tcp_resets_timeout = response.parse() + assert_matches_type(TCPResetsTimeoutTimeseriesGroupsResponse, tcp_resets_timeout, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncTCPResetsTimeouts: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_summary(self, async_client: AsyncCloudflare) -> None: + tcp_resets_timeout = await async_client.radar.tcp_resets_timeouts.summary() + assert_matches_type(TCPResetsTimeoutSummaryResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + async def test_method_summary_with_all_params(self, async_client: AsyncCloudflare) -> None: + tcp_resets_timeout = await async_client.radar.tcp_resets_timeouts.summary( + asn=["string", "string", "string"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["7d", "7d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + format="JSON", + location=["string", "string", "string"], + name=["string", "string", "string"], + ) + assert_matches_type(TCPResetsTimeoutSummaryResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + async def test_raw_response_summary(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.tcp_resets_timeouts.with_raw_response.summary() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tcp_resets_timeout = await response.parse() + assert_matches_type(TCPResetsTimeoutSummaryResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + async def test_streaming_response_summary(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.tcp_resets_timeouts.with_streaming_response.summary() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tcp_resets_timeout = await response.parse() + assert_matches_type(TCPResetsTimeoutSummaryResponse, tcp_resets_timeout, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_timeseries_groups(self, async_client: AsyncCloudflare) -> None: + tcp_resets_timeout = await async_client.radar.tcp_resets_timeouts.timeseries_groups() + assert_matches_type(TCPResetsTimeoutTimeseriesGroupsResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + async def test_method_timeseries_groups_with_all_params(self, async_client: AsyncCloudflare) -> None: + tcp_resets_timeout = await async_client.radar.tcp_resets_timeouts.timeseries_groups( + agg_interval="1h", + asn=["string", "string", "string"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["7d", "7d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + format="JSON", + location=["string", "string", "string"], + name=["string", "string", "string"], + ) + assert_matches_type(TCPResetsTimeoutTimeseriesGroupsResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + async def test_raw_response_timeseries_groups(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.tcp_resets_timeouts.with_raw_response.timeseries_groups() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tcp_resets_timeout = await response.parse() + assert_matches_type(TCPResetsTimeoutTimeseriesGroupsResponse, tcp_resets_timeout, path=["response"]) + + @parametrize + async def test_streaming_response_timeseries_groups(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.tcp_resets_timeouts.with_streaming_response.timeseries_groups() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tcp_resets_timeout = await response.parse() + assert_matches_type(TCPResetsTimeoutTimeseriesGroupsResponse, tcp_resets_timeout, path=["response"]) + + assert cast(Any, response.is_closed) is True