From 6a321d34b825d9217d847be1ea56cf611defe111 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:45:26 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#1176) --- .stats.yml | 4 +- api.md | 16 - src/cloudflare/resources/radar/__init__.py | 14 - .../resources/radar/connection_tampering.py | 432 ------------------ src/cloudflare/resources/radar/radar.py | 32 -- src/cloudflare/types/radar/__init__.py | 10 - .../connection_tampering_summary_params.py | 53 --- .../connection_tampering_summary_response.py | 89 ---- ...tion_tampering_timeseries_groups_params.py | 60 --- ...on_tampering_timeseries_groups_response.py | 95 ---- .../radar/test_connection_tampering.py | 216 --------- 11 files changed, 2 insertions(+), 1019 deletions(-) delete mode 100644 src/cloudflare/resources/radar/connection_tampering.py delete mode 100644 src/cloudflare/types/radar/connection_tampering_summary_params.py delete mode 100644 src/cloudflare/types/radar/connection_tampering_summary_response.py delete mode 100644 src/cloudflare/types/radar/connection_tampering_timeseries_groups_params.py delete mode 100644 src/cloudflare/types/radar/connection_tampering_timeseries_groups_response.py delete mode 100644 tests/api_resources/radar/test_connection_tampering.py diff --git a/.stats.yml b/.stats.yml index f92b447ada3..aa5b891ae18 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1254 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-095c75ce419923a8f7a92dc55b139890dfd0ad55f642c1abe42f63bc124a047c.yml +configured_endpoints: 1252 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-08160758435c3d32f9f1d296fcd9664e5b67e7c453403bf02ac81f023ec470a3.yml diff --git a/api.md b/api.md index 5fd9ada828f..1945f0c0c95 100644 --- a/api.md +++ b/api.md @@ -6125,22 +6125,6 @@ Methods: - client.radar.as112.top.ip_version(ip_version, \*\*params) -> TopIPVersionResponse - client.radar.as112.top.locations(\*\*params) -> TopLocationsResponse -## ConnectionTampering - -Types: - -```python -from cloudflare.types.radar import ( - ConnectionTamperingSummaryResponse, - ConnectionTamperingTimeseriesGroupsResponse, -) -``` - -Methods: - -- client.radar.connection_tampering.summary(\*\*params) -> ConnectionTamperingSummaryResponse -- client.radar.connection_tampering.timeseries_groups(\*\*params) -> ConnectionTamperingTimeseriesGroupsResponse - ## Email Types: diff --git a/src/cloudflare/resources/radar/__init__.py b/src/cloudflare/resources/radar/__init__.py index 00dd0bb0fcf..20485edccb2 100644 --- a/src/cloudflare/resources/radar/__init__.py +++ b/src/cloudflare/resources/radar/__init__.py @@ -128,14 +128,6 @@ TrafficAnomaliesResourceWithStreamingResponse, AsyncTrafficAnomaliesResourceWithStreamingResponse, ) -from .connection_tampering import ( - ConnectionTamperingResource, - AsyncConnectionTamperingResource, - ConnectionTamperingResourceWithRawResponse, - AsyncConnectionTamperingResourceWithRawResponse, - ConnectionTamperingResourceWithStreamingResponse, - AsyncConnectionTamperingResourceWithStreamingResponse, -) __all__ = [ "AnnotationsResource", @@ -186,12 +178,6 @@ "AsyncAS112ResourceWithRawResponse", "AS112ResourceWithStreamingResponse", "AsyncAS112ResourceWithStreamingResponse", - "ConnectionTamperingResource", - "AsyncConnectionTamperingResource", - "ConnectionTamperingResourceWithRawResponse", - "AsyncConnectionTamperingResourceWithRawResponse", - "ConnectionTamperingResourceWithStreamingResponse", - "AsyncConnectionTamperingResourceWithStreamingResponse", "EmailResource", "AsyncEmailResource", "EmailResourceWithRawResponse", diff --git a/src/cloudflare/resources/radar/connection_tampering.py b/src/cloudflare/resources/radar/connection_tampering.py deleted file mode 100644 index 1371c2288ee..00000000000 --- a/src/cloudflare/resources/radar/connection_tampering.py +++ /dev/null @@ -1,432 +0,0 @@ -# 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 connection_tampering_summary_params, connection_tampering_timeseries_groups_params -from ..._base_client import make_request_options -from ...types.radar.connection_tampering_summary_response import ConnectionTamperingSummaryResponse -from ...types.radar.connection_tampering_timeseries_groups_response import ConnectionTamperingTimeseriesGroupsResponse - -__all__ = ["ConnectionTamperingResource", "AsyncConnectionTamperingResource"] - - -class ConnectionTamperingResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ConnectionTamperingResourceWithRawResponse: - return ConnectionTamperingResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ConnectionTamperingResourceWithStreamingResponse: - return ConnectionTamperingResourceWithStreamingResponse(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, - ) -> ConnectionTamperingSummaryResponse: - """ - Distribution of connection tampering types over 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/connection_tampering/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, - }, - connection_tampering_summary_params.ConnectionTamperingSummaryParams, - ), - post_parser=ResultWrapper[ConnectionTamperingSummaryResponse]._unwrapper, - ), - cast_to=cast(Type[ConnectionTamperingSummaryResponse], ResultWrapper[ConnectionTamperingSummaryResponse]), - ) - - 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, - ) -> ConnectionTamperingTimeseriesGroupsResponse: - """ - Distribution of connection tampering types 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/connection_tampering/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, - }, - connection_tampering_timeseries_groups_params.ConnectionTamperingTimeseriesGroupsParams, - ), - post_parser=ResultWrapper[ConnectionTamperingTimeseriesGroupsResponse]._unwrapper, - ), - cast_to=cast( - Type[ConnectionTamperingTimeseriesGroupsResponse], - ResultWrapper[ConnectionTamperingTimeseriesGroupsResponse], - ), - ) - - -class AsyncConnectionTamperingResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncConnectionTamperingResourceWithRawResponse: - return AsyncConnectionTamperingResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncConnectionTamperingResourceWithStreamingResponse: - return AsyncConnectionTamperingResourceWithStreamingResponse(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, - ) -> ConnectionTamperingSummaryResponse: - """ - Distribution of connection tampering types over 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/connection_tampering/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, - }, - connection_tampering_summary_params.ConnectionTamperingSummaryParams, - ), - post_parser=ResultWrapper[ConnectionTamperingSummaryResponse]._unwrapper, - ), - cast_to=cast(Type[ConnectionTamperingSummaryResponse], ResultWrapper[ConnectionTamperingSummaryResponse]), - ) - - 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, - ) -> ConnectionTamperingTimeseriesGroupsResponse: - """ - Distribution of connection tampering types 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/connection_tampering/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, - }, - connection_tampering_timeseries_groups_params.ConnectionTamperingTimeseriesGroupsParams, - ), - post_parser=ResultWrapper[ConnectionTamperingTimeseriesGroupsResponse]._unwrapper, - ), - cast_to=cast( - Type[ConnectionTamperingTimeseriesGroupsResponse], - ResultWrapper[ConnectionTamperingTimeseriesGroupsResponse], - ), - ) - - -class ConnectionTamperingResourceWithRawResponse: - def __init__(self, connection_tampering: ConnectionTamperingResource) -> None: - self._connection_tampering = connection_tampering - - self.summary = to_raw_response_wrapper( - connection_tampering.summary, - ) - self.timeseries_groups = to_raw_response_wrapper( - connection_tampering.timeseries_groups, - ) - - -class AsyncConnectionTamperingResourceWithRawResponse: - def __init__(self, connection_tampering: AsyncConnectionTamperingResource) -> None: - self._connection_tampering = connection_tampering - - self.summary = async_to_raw_response_wrapper( - connection_tampering.summary, - ) - self.timeseries_groups = async_to_raw_response_wrapper( - connection_tampering.timeseries_groups, - ) - - -class ConnectionTamperingResourceWithStreamingResponse: - def __init__(self, connection_tampering: ConnectionTamperingResource) -> None: - self._connection_tampering = connection_tampering - - self.summary = to_streamed_response_wrapper( - connection_tampering.summary, - ) - self.timeseries_groups = to_streamed_response_wrapper( - connection_tampering.timeseries_groups, - ) - - -class AsyncConnectionTamperingResourceWithStreamingResponse: - def __init__(self, connection_tampering: AsyncConnectionTamperingResource) -> None: - self._connection_tampering = connection_tampering - - self.summary = async_to_streamed_response_wrapper( - connection_tampering.summary, - ) - self.timeseries_groups = async_to_streamed_response_wrapper( - connection_tampering.timeseries_groups, - ) diff --git a/src/cloudflare/resources/radar/radar.py b/src/cloudflare/resources/radar/radar.py index c6859e8b70c..29a0fd5a913 100644 --- a/src/cloudflare/resources/radar/radar.py +++ b/src/cloudflare/resources/radar/radar.py @@ -134,14 +134,6 @@ TrafficAnomaliesResourceWithStreamingResponse, AsyncTrafficAnomaliesResourceWithStreamingResponse, ) -from .connection_tampering import ( - ConnectionTamperingResource, - AsyncConnectionTamperingResource, - ConnectionTamperingResourceWithRawResponse, - AsyncConnectionTamperingResourceWithRawResponse, - ConnectionTamperingResourceWithStreamingResponse, - AsyncConnectionTamperingResourceWithStreamingResponse, -) from .annotations.annotations import AnnotationsResource, AsyncAnnotationsResource from .verified_bots.verified_bots import VerifiedBotsResource, AsyncVerifiedBotsResource from .traffic_anomalies.traffic_anomalies import TrafficAnomaliesResource, AsyncTrafficAnomaliesResource @@ -182,10 +174,6 @@ def verified_bots(self) -> VerifiedBotsResource: def as112(self) -> AS112Resource: return AS112Resource(self._client) - @cached_property - def connection_tampering(self) -> ConnectionTamperingResource: - return ConnectionTamperingResource(self._client) - @cached_property def email(self) -> EmailResource: return EmailResource(self._client) @@ -256,10 +244,6 @@ def verified_bots(self) -> AsyncVerifiedBotsResource: def as112(self) -> AsyncAS112Resource: return AsyncAS112Resource(self._client) - @cached_property - def connection_tampering(self) -> AsyncConnectionTamperingResource: - return AsyncConnectionTamperingResource(self._client) - @cached_property def email(self) -> AsyncEmailResource: return AsyncEmailResource(self._client) @@ -333,10 +317,6 @@ def verified_bots(self) -> VerifiedBotsResourceWithRawResponse: def as112(self) -> AS112ResourceWithRawResponse: return AS112ResourceWithRawResponse(self._radar.as112) - @cached_property - def connection_tampering(self) -> ConnectionTamperingResourceWithRawResponse: - return ConnectionTamperingResourceWithRawResponse(self._radar.connection_tampering) - @cached_property def email(self) -> EmailResourceWithRawResponse: return EmailResourceWithRawResponse(self._radar.email) @@ -402,10 +382,6 @@ def verified_bots(self) -> AsyncVerifiedBotsResourceWithRawResponse: def as112(self) -> AsyncAS112ResourceWithRawResponse: return AsyncAS112ResourceWithRawResponse(self._radar.as112) - @cached_property - def connection_tampering(self) -> AsyncConnectionTamperingResourceWithRawResponse: - return AsyncConnectionTamperingResourceWithRawResponse(self._radar.connection_tampering) - @cached_property def email(self) -> AsyncEmailResourceWithRawResponse: return AsyncEmailResourceWithRawResponse(self._radar.email) @@ -471,10 +447,6 @@ def verified_bots(self) -> VerifiedBotsResourceWithStreamingResponse: def as112(self) -> AS112ResourceWithStreamingResponse: return AS112ResourceWithStreamingResponse(self._radar.as112) - @cached_property - def connection_tampering(self) -> ConnectionTamperingResourceWithStreamingResponse: - return ConnectionTamperingResourceWithStreamingResponse(self._radar.connection_tampering) - @cached_property def email(self) -> EmailResourceWithStreamingResponse: return EmailResourceWithStreamingResponse(self._radar.email) @@ -540,10 +512,6 @@ def verified_bots(self) -> AsyncVerifiedBotsResourceWithStreamingResponse: def as112(self) -> AsyncAS112ResourceWithStreamingResponse: return AsyncAS112ResourceWithStreamingResponse(self._radar.as112) - @cached_property - def connection_tampering(self) -> AsyncConnectionTamperingResourceWithStreamingResponse: - return AsyncConnectionTamperingResourceWithStreamingResponse(self._radar.connection_tampering) - @cached_property def email(self) -> AsyncEmailResourceWithStreamingResponse: return AsyncEmailResourceWithStreamingResponse(self._radar.email) diff --git a/src/cloudflare/types/radar/__init__.py b/src/cloudflare/types/radar/__init__.py index 63e479b1721..c41928c0014 100644 --- a/src/cloudflare/types/radar/__init__.py +++ b/src/cloudflare/types/radar/__init__.py @@ -27,13 +27,3 @@ from .traffic_anomaly_get_response import TrafficAnomalyGetResponse as TrafficAnomalyGetResponse from .ranking_timeseries_groups_params import RankingTimeseriesGroupsParams as RankingTimeseriesGroupsParams from .ranking_timeseries_groups_response import RankingTimeseriesGroupsResponse as RankingTimeseriesGroupsResponse -from .connection_tampering_summary_params import ConnectionTamperingSummaryParams as ConnectionTamperingSummaryParams -from .connection_tampering_summary_response import ( - ConnectionTamperingSummaryResponse as ConnectionTamperingSummaryResponse, -) -from .connection_tampering_timeseries_groups_params import ( - ConnectionTamperingTimeseriesGroupsParams as ConnectionTamperingTimeseriesGroupsParams, -) -from .connection_tampering_timeseries_groups_response import ( - ConnectionTamperingTimeseriesGroupsResponse as ConnectionTamperingTimeseriesGroupsResponse, -) diff --git a/src/cloudflare/types/radar/connection_tampering_summary_params.py b/src/cloudflare/types/radar/connection_tampering_summary_params.py deleted file mode 100644 index 8d20f6b54dd..00000000000 --- a/src/cloudflare/types/radar/connection_tampering_summary_params.py +++ /dev/null @@ -1,53 +0,0 @@ -# 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__ = ["ConnectionTamperingSummaryParams"] - - -class ConnectionTamperingSummaryParams(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/connection_tampering_summary_response.py b/src/cloudflare/types/radar/connection_tampering_summary_response.py deleted file mode 100644 index 4f093b99de1..00000000000 --- a/src/cloudflare/types/radar/connection_tampering_summary_response.py +++ /dev/null @@ -1,89 +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 pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = [ - "ConnectionTamperingSummaryResponse", - "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 - """ - Connections matching signatures for tampering later in the connection, after the - transfer of multiple data packets. - """ - - no_match: str - """Connections that do not match any tampering signatures.""" - - post_ack: str - """ - Connections matching signatures for tampering after the receipt of a SYN packet - and ACK packet, meaning the TCP connection was successfully established but the - server did not receive any subsequent packets. - """ - - post_psh: str - """ - Connections matching signatures for tampering after the receipt of a packet with - PSH flag set, following connection establishment. - """ - - post_syn: str - """ - Connections matching signatures for tampering after the receipt of only a single - SYN packet, and before the handshake completes. - """ - - -class ConnectionTamperingSummaryResponse(BaseModel): - meta: Meta - - summary_0: Summary0 diff --git a/src/cloudflare/types/radar/connection_tampering_timeseries_groups_params.py b/src/cloudflare/types/radar/connection_tampering_timeseries_groups_params.py deleted file mode 100644 index 176588e5de7..00000000000 --- a/src/cloudflare/types/radar/connection_tampering_timeseries_groups_params.py +++ /dev/null @@ -1,60 +0,0 @@ -# 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__ = ["ConnectionTamperingTimeseriesGroupsParams"] - - -class ConnectionTamperingTimeseriesGroupsParams(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/connection_tampering_timeseries_groups_response.py b/src/cloudflare/types/radar/connection_tampering_timeseries_groups_response.py deleted file mode 100644 index f6aeb05577b..00000000000 --- a/src/cloudflare/types/radar/connection_tampering_timeseries_groups_response.py +++ /dev/null @@ -1,95 +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 pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = [ - "ConnectionTamperingTimeseriesGroupsResponse", - "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] - """ - Connections matching signatures for tampering later in the connection, after the - transfer of multiple data packets. - """ - - no_match: List[str] - """Connections that do not match any tampering signatures.""" - - post_ack: List[str] - """ - Connections matching signatures for tampering after the receipt of a SYN packet - and ACK packet, meaning the TCP connection was successfully established but the - server did not receive any subsequent packets. - """ - - post_psh: List[str] - """ - Connections matching signatures for tampering after the receipt of a packet with - PSH flag set, following connection establishment. - """ - - post_syn: List[str] - """ - Connections matching signatures for tampering after the receipt of only a single - SYN packet, and before the handshake completes. - """ - - timestamps: List[datetime] - - -class ConnectionTamperingTimeseriesGroupsResponse(BaseModel): - meta: Meta - - serie_0: Serie0 diff --git a/tests/api_resources/radar/test_connection_tampering.py b/tests/api_resources/radar/test_connection_tampering.py deleted file mode 100644 index 159469316ed..00000000000 --- a/tests/api_resources/radar/test_connection_tampering.py +++ /dev/null @@ -1,216 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, 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 ( - ConnectionTamperingSummaryResponse, - ConnectionTamperingTimeseriesGroupsResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestConnectionTampering: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_summary(self, client: Cloudflare) -> None: - connection_tampering = client.radar.connection_tampering.summary() - assert_matches_type(ConnectionTamperingSummaryResponse, connection_tampering, path=["response"]) - - @parametrize - def test_method_summary_with_all_params(self, client: Cloudflare) -> None: - connection_tampering = client.radar.connection_tampering.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(ConnectionTamperingSummaryResponse, connection_tampering, path=["response"]) - - @parametrize - def test_raw_response_summary(self, client: Cloudflare) -> None: - response = client.radar.connection_tampering.with_raw_response.summary() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - connection_tampering = response.parse() - assert_matches_type(ConnectionTamperingSummaryResponse, connection_tampering, path=["response"]) - - @parametrize - def test_streaming_response_summary(self, client: Cloudflare) -> None: - with client.radar.connection_tampering.with_streaming_response.summary() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - connection_tampering = response.parse() - assert_matches_type(ConnectionTamperingSummaryResponse, connection_tampering, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_timeseries_groups(self, client: Cloudflare) -> None: - connection_tampering = client.radar.connection_tampering.timeseries_groups() - assert_matches_type(ConnectionTamperingTimeseriesGroupsResponse, connection_tampering, path=["response"]) - - @parametrize - def test_method_timeseries_groups_with_all_params(self, client: Cloudflare) -> None: - connection_tampering = client.radar.connection_tampering.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(ConnectionTamperingTimeseriesGroupsResponse, connection_tampering, path=["response"]) - - @parametrize - def test_raw_response_timeseries_groups(self, client: Cloudflare) -> None: - response = client.radar.connection_tampering.with_raw_response.timeseries_groups() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - connection_tampering = response.parse() - assert_matches_type(ConnectionTamperingTimeseriesGroupsResponse, connection_tampering, path=["response"]) - - @parametrize - def test_streaming_response_timeseries_groups(self, client: Cloudflare) -> None: - with client.radar.connection_tampering.with_streaming_response.timeseries_groups() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - connection_tampering = response.parse() - assert_matches_type(ConnectionTamperingTimeseriesGroupsResponse, connection_tampering, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncConnectionTampering: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_summary(self, async_client: AsyncCloudflare) -> None: - connection_tampering = await async_client.radar.connection_tampering.summary() - assert_matches_type(ConnectionTamperingSummaryResponse, connection_tampering, path=["response"]) - - @parametrize - async def test_method_summary_with_all_params(self, async_client: AsyncCloudflare) -> None: - connection_tampering = await async_client.radar.connection_tampering.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(ConnectionTamperingSummaryResponse, connection_tampering, path=["response"]) - - @parametrize - async def test_raw_response_summary(self, async_client: AsyncCloudflare) -> None: - response = await async_client.radar.connection_tampering.with_raw_response.summary() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - connection_tampering = await response.parse() - assert_matches_type(ConnectionTamperingSummaryResponse, connection_tampering, path=["response"]) - - @parametrize - async def test_streaming_response_summary(self, async_client: AsyncCloudflare) -> None: - async with async_client.radar.connection_tampering.with_streaming_response.summary() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - connection_tampering = await response.parse() - assert_matches_type(ConnectionTamperingSummaryResponse, connection_tampering, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_timeseries_groups(self, async_client: AsyncCloudflare) -> None: - connection_tampering = await async_client.radar.connection_tampering.timeseries_groups() - assert_matches_type(ConnectionTamperingTimeseriesGroupsResponse, connection_tampering, path=["response"]) - - @parametrize - async def test_method_timeseries_groups_with_all_params(self, async_client: AsyncCloudflare) -> None: - connection_tampering = await async_client.radar.connection_tampering.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(ConnectionTamperingTimeseriesGroupsResponse, connection_tampering, path=["response"]) - - @parametrize - async def test_raw_response_timeseries_groups(self, async_client: AsyncCloudflare) -> None: - response = await async_client.radar.connection_tampering.with_raw_response.timeseries_groups() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - connection_tampering = await response.parse() - assert_matches_type(ConnectionTamperingTimeseriesGroupsResponse, connection_tampering, path=["response"]) - - @parametrize - async def test_streaming_response_timeseries_groups(self, async_client: AsyncCloudflare) -> None: - async with async_client.radar.connection_tampering.with_streaming_response.timeseries_groups() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - connection_tampering = await response.parse() - assert_matches_type(ConnectionTamperingTimeseriesGroupsResponse, connection_tampering, path=["response"]) - - assert cast(Any, response.is_closed) is True