From 96832503a555a976ffafde3c6bbebf55fd5f296b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:14:09 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#275) --- .stats.yml | 2 +- api.md | 6 +- src/cloudflare/_client.py | 8 - src/cloudflare/resources/__init__.py | 14 -- .../rules/advertisements.py | 14 +- .../magic_network_monitoring/rules/rules.py | 12 + .../resources/request_tracers/__init__.py | 33 --- .../request_tracers/request_tracers.py | 80 ------ .../resources/request_tracers/traces.py | 232 ------------------ .../magic_network_monitoring_rule.py | 1 + .../types/request_tracers/__init__.py | 5 - src/cloudflare/types/request_tracers/trace.py | 11 - .../request_tracers/trace_create_params.py | 80 ------ .../request_tracers/trace_create_response.py | 25 -- .../types/request_tracers/trace_item.py | 49 ---- .../request_tracers/test_traces.py | 206 ---------------- 16 files changed, 25 insertions(+), 753 deletions(-) delete mode 100644 src/cloudflare/resources/request_tracers/__init__.py delete mode 100644 src/cloudflare/resources/request_tracers/request_tracers.py delete mode 100644 src/cloudflare/resources/request_tracers/traces.py delete mode 100644 src/cloudflare/types/request_tracers/trace.py delete mode 100644 src/cloudflare/types/request_tracers/trace_create_params.py delete mode 100644 src/cloudflare/types/request_tracers/trace_create_response.py delete mode 100644 src/cloudflare/types/request_tracers/trace_item.py delete mode 100644 tests/api_resources/request_tracers/test_traces.py diff --git a/.stats.yml b/.stats.yml index 0818ecbb822..a9d90133735 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1251 +configured_endpoints: 1250 diff --git a/api.md b/api.md index 73a84772792..97a4a41bf3c 100644 --- a/api.md +++ b/api.md @@ -4174,13 +4174,9 @@ Methods: Types: ```python -from cloudflare.types.request_tracers import Trace, TraceItem, TraceCreateResponse +from cloudflare.types.request_tracers import Trace, TraceItem ``` -Methods: - -- client.request_tracers.traces.create(account_identifier, \*\*params) -> TraceCreateResponse - # Rules ## Lists diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index d85574035e0..dfd01609e7c 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -103,7 +103,6 @@ class Cloudflare(SyncAPIClient): pages: resources.Pages pcaps: resources.PCAPs registrar: resources.Registrar - request_tracers: resources.RequestTracers rules: resources.Rules storage: resources.Storage stream: resources.Stream @@ -258,7 +257,6 @@ def __init__( self.pages = resources.Pages(self) self.pcaps = resources.PCAPs(self) self.registrar = resources.Registrar(self) - self.request_tracers = resources.RequestTracers(self) self.rules = resources.Rules(self) self.storage = resources.Storage(self) self.stream = resources.Stream(self) @@ -516,7 +514,6 @@ class AsyncCloudflare(AsyncAPIClient): pages: resources.AsyncPages pcaps: resources.AsyncPCAPs registrar: resources.AsyncRegistrar - request_tracers: resources.AsyncRequestTracers rules: resources.AsyncRules storage: resources.AsyncStorage stream: resources.AsyncStream @@ -671,7 +668,6 @@ def __init__( self.pages = resources.AsyncPages(self) self.pcaps = resources.AsyncPCAPs(self) self.registrar = resources.AsyncRegistrar(self) - self.request_tracers = resources.AsyncRequestTracers(self) self.rules = resources.AsyncRules(self) self.storage = resources.AsyncStorage(self) self.stream = resources.AsyncStream(self) @@ -930,7 +926,6 @@ def __init__(self, client: Cloudflare) -> None: self.pages = resources.PagesWithRawResponse(client.pages) self.pcaps = resources.PCAPsWithRawResponse(client.pcaps) self.registrar = resources.RegistrarWithRawResponse(client.registrar) - self.request_tracers = resources.RequestTracersWithRawResponse(client.request_tracers) self.rules = resources.RulesWithRawResponse(client.rules) self.storage = resources.StorageWithRawResponse(client.storage) self.stream = resources.StreamWithRawResponse(client.stream) @@ -1020,7 +1015,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.pages = resources.AsyncPagesWithRawResponse(client.pages) self.pcaps = resources.AsyncPCAPsWithRawResponse(client.pcaps) self.registrar = resources.AsyncRegistrarWithRawResponse(client.registrar) - self.request_tracers = resources.AsyncRequestTracersWithRawResponse(client.request_tracers) self.rules = resources.AsyncRulesWithRawResponse(client.rules) self.storage = resources.AsyncStorageWithRawResponse(client.storage) self.stream = resources.AsyncStreamWithRawResponse(client.stream) @@ -1110,7 +1104,6 @@ def __init__(self, client: Cloudflare) -> None: self.pages = resources.PagesWithStreamingResponse(client.pages) self.pcaps = resources.PCAPsWithStreamingResponse(client.pcaps) self.registrar = resources.RegistrarWithStreamingResponse(client.registrar) - self.request_tracers = resources.RequestTracersWithStreamingResponse(client.request_tracers) self.rules = resources.RulesWithStreamingResponse(client.rules) self.storage = resources.StorageWithStreamingResponse(client.storage) self.stream = resources.StreamWithStreamingResponse(client.stream) @@ -1204,7 +1197,6 @@ def __init__(self, client: AsyncCloudflare) -> None: self.pages = resources.AsyncPagesWithStreamingResponse(client.pages) self.pcaps = resources.AsyncPCAPsWithStreamingResponse(client.pcaps) self.registrar = resources.AsyncRegistrarWithStreamingResponse(client.registrar) - self.request_tracers = resources.AsyncRequestTracersWithStreamingResponse(client.request_tracers) self.rules = resources.AsyncRulesWithStreamingResponse(client.rules) self.storage = resources.AsyncStorageWithStreamingResponse(client.storage) self.stream = resources.AsyncStreamWithStreamingResponse(client.stream) diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index 096d7cfd8ea..19790921911 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -520,14 +520,6 @@ ManagedHeadersWithStreamingResponse, AsyncManagedHeadersWithStreamingResponse, ) -from .request_tracers import ( - RequestTracers, - AsyncRequestTracers, - RequestTracersWithRawResponse, - AsyncRequestTracersWithRawResponse, - RequestTracersWithStreamingResponse, - AsyncRequestTracersWithStreamingResponse, -) from .brand_protection import ( BrandProtection, AsyncBrandProtection, @@ -978,12 +970,6 @@ "AsyncRegistrarWithRawResponse", "RegistrarWithStreamingResponse", "AsyncRegistrarWithStreamingResponse", - "RequestTracers", - "AsyncRequestTracers", - "RequestTracersWithRawResponse", - "AsyncRequestTracersWithRawResponse", - "RequestTracersWithStreamingResponse", - "AsyncRequestTracersWithStreamingResponse", "Rules", "AsyncRules", "RulesWithRawResponse", diff --git a/src/cloudflare/resources/magic_network_monitoring/rules/advertisements.py b/src/cloudflare/resources/magic_network_monitoring/rules/advertisements.py index e2ca1205ecf..2db69ec78ac 100644 --- a/src/cloudflare/resources/magic_network_monitoring/rules/advertisements.py +++ b/src/cloudflare/resources/magic_network_monitoring/rules/advertisements.py @@ -50,10 +50,13 @@ def edit( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[Advertisement]: - """ - Update advertisement for rule. + """Update advertisement for rule. Args: + rule_id: The id of the rule. + + Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -102,10 +105,13 @@ async def edit( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[Advertisement]: - """ - Update advertisement for rule. + """Update advertisement for rule. Args: + rule_id: The id of the rule. + + Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/cloudflare/resources/magic_network_monitoring/rules/rules.py b/src/cloudflare/resources/magic_network_monitoring/rules/rules.py index 7759a7b2f19..2cc9c053e75 100644 --- a/src/cloudflare/resources/magic_network_monitoring/rules/rules.py +++ b/src/cloudflare/resources/magic_network_monitoring/rules/rules.py @@ -188,6 +188,8 @@ def delete( Delete a network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -230,6 +232,8 @@ def edit( Update a network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -271,6 +275,8 @@ def get( List a single network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -440,6 +446,8 @@ async def delete( Delete a network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -482,6 +490,8 @@ async def edit( Update a network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -523,6 +533,8 @@ async def get( List a single network monitoring rule for account. Args: + rule_id: The id of the rule. Must be unique. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/cloudflare/resources/request_tracers/__init__.py b/src/cloudflare/resources/request_tracers/__init__.py deleted file mode 100644 index f19a11ba800..00000000000 --- a/src/cloudflare/resources/request_tracers/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .traces import ( - Traces, - AsyncTraces, - TracesWithRawResponse, - AsyncTracesWithRawResponse, - TracesWithStreamingResponse, - AsyncTracesWithStreamingResponse, -) -from .request_tracers import ( - RequestTracers, - AsyncRequestTracers, - RequestTracersWithRawResponse, - AsyncRequestTracersWithRawResponse, - RequestTracersWithStreamingResponse, - AsyncRequestTracersWithStreamingResponse, -) - -__all__ = [ - "Traces", - "AsyncTraces", - "TracesWithRawResponse", - "AsyncTracesWithRawResponse", - "TracesWithStreamingResponse", - "AsyncTracesWithStreamingResponse", - "RequestTracers", - "AsyncRequestTracers", - "RequestTracersWithRawResponse", - "AsyncRequestTracersWithRawResponse", - "RequestTracersWithStreamingResponse", - "AsyncRequestTracersWithStreamingResponse", -] diff --git a/src/cloudflare/resources/request_tracers/request_tracers.py b/src/cloudflare/resources/request_tracers/request_tracers.py deleted file mode 100644 index bf03ddeaa5e..00000000000 --- a/src/cloudflare/resources/request_tracers/request_tracers.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .traces import ( - Traces, - AsyncTraces, - TracesWithRawResponse, - AsyncTracesWithRawResponse, - TracesWithStreamingResponse, - AsyncTracesWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["RequestTracers", "AsyncRequestTracers"] - - -class RequestTracers(SyncAPIResource): - @cached_property - def traces(self) -> Traces: - return Traces(self._client) - - @cached_property - def with_raw_response(self) -> RequestTracersWithRawResponse: - return RequestTracersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RequestTracersWithStreamingResponse: - return RequestTracersWithStreamingResponse(self) - - -class AsyncRequestTracers(AsyncAPIResource): - @cached_property - def traces(self) -> AsyncTraces: - return AsyncTraces(self._client) - - @cached_property - def with_raw_response(self) -> AsyncRequestTracersWithRawResponse: - return AsyncRequestTracersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRequestTracersWithStreamingResponse: - return AsyncRequestTracersWithStreamingResponse(self) - - -class RequestTracersWithRawResponse: - def __init__(self, request_tracers: RequestTracers) -> None: - self._request_tracers = request_tracers - - @cached_property - def traces(self) -> TracesWithRawResponse: - return TracesWithRawResponse(self._request_tracers.traces) - - -class AsyncRequestTracersWithRawResponse: - def __init__(self, request_tracers: AsyncRequestTracers) -> None: - self._request_tracers = request_tracers - - @cached_property - def traces(self) -> AsyncTracesWithRawResponse: - return AsyncTracesWithRawResponse(self._request_tracers.traces) - - -class RequestTracersWithStreamingResponse: - def __init__(self, request_tracers: RequestTracers) -> None: - self._request_tracers = request_tracers - - @cached_property - def traces(self) -> TracesWithStreamingResponse: - return TracesWithStreamingResponse(self._request_tracers.traces) - - -class AsyncRequestTracersWithStreamingResponse: - def __init__(self, request_tracers: AsyncRequestTracers) -> None: - self._request_tracers = request_tracers - - @cached_property - def traces(self) -> AsyncTracesWithStreamingResponse: - return AsyncTracesWithStreamingResponse(self._request_tracers.traces) diff --git a/src/cloudflare/resources/request_tracers/traces.py b/src/cloudflare/resources/request_tracers/traces.py deleted file mode 100644 index faac2d45376..00000000000 --- a/src/cloudflare/resources/request_tracers/traces.py +++ /dev/null @@ -1,232 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Type, 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 ..._base_client import ( - make_request_options, -) -from ...types.request_tracers import TraceCreateResponse, trace_create_params - -__all__ = ["Traces", "AsyncTraces"] - - -class Traces(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TracesWithRawResponse: - return TracesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TracesWithStreamingResponse: - return TracesWithStreamingResponse(self) - - def create( - self, - account_identifier: str, - *, - method: str, - url: str, - body: trace_create_params.Body | NotGiven = NOT_GIVEN, - context: trace_create_params.Context | NotGiven = NOT_GIVEN, - cookies: Dict[str, str] | NotGiven = NOT_GIVEN, - headers: Dict[str, str] | NotGiven = NOT_GIVEN, - protocol: str | NotGiven = NOT_GIVEN, - skip_response: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TraceCreateResponse: - """ - Request Trace - - Args: - account_identifier: Identifier - - method: HTTP Method of tracing request - - url: URL to which perform tracing request - - context: Additional request parameters - - cookies: Cookies added to tracing request - - headers: Headers added to tracing request - - protocol: HTTP Protocol of tracing request - - skip_response: Skip sending the request to the Origin server after all rules evaluation - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return self._post( - f"/accounts/{account_identifier}/request-tracer/trace", - body=maybe_transform( - { - "method": method, - "url": url, - "body": body, - "context": context, - "cookies": cookies, - "headers": headers, - "protocol": protocol, - "skip_response": skip_response, - }, - trace_create_params.TraceCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[TraceCreateResponse], ResultWrapper[TraceCreateResponse]), - ) - - -class AsyncTraces(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTracesWithRawResponse: - return AsyncTracesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTracesWithStreamingResponse: - return AsyncTracesWithStreamingResponse(self) - - async def create( - self, - account_identifier: str, - *, - method: str, - url: str, - body: trace_create_params.Body | NotGiven = NOT_GIVEN, - context: trace_create_params.Context | NotGiven = NOT_GIVEN, - cookies: Dict[str, str] | NotGiven = NOT_GIVEN, - headers: Dict[str, str] | NotGiven = NOT_GIVEN, - protocol: str | NotGiven = NOT_GIVEN, - skip_response: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TraceCreateResponse: - """ - Request Trace - - Args: - account_identifier: Identifier - - method: HTTP Method of tracing request - - url: URL to which perform tracing request - - context: Additional request parameters - - cookies: Cookies added to tracing request - - headers: Headers added to tracing request - - protocol: HTTP Protocol of tracing request - - skip_response: Skip sending the request to the Origin server after all rules evaluation - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return await self._post( - f"/accounts/{account_identifier}/request-tracer/trace", - body=await async_maybe_transform( - { - "method": method, - "url": url, - "body": body, - "context": context, - "cookies": cookies, - "headers": headers, - "protocol": protocol, - "skip_response": skip_response, - }, - trace_create_params.TraceCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[TraceCreateResponse], ResultWrapper[TraceCreateResponse]), - ) - - -class TracesWithRawResponse: - def __init__(self, traces: Traces) -> None: - self._traces = traces - - self.create = to_raw_response_wrapper( - traces.create, - ) - - -class AsyncTracesWithRawResponse: - def __init__(self, traces: AsyncTraces) -> None: - self._traces = traces - - self.create = async_to_raw_response_wrapper( - traces.create, - ) - - -class TracesWithStreamingResponse: - def __init__(self, traces: Traces) -> None: - self._traces = traces - - self.create = to_streamed_response_wrapper( - traces.create, - ) - - -class AsyncTracesWithStreamingResponse: - def __init__(self, traces: AsyncTraces) -> None: - self._traces = traces - - self.create = async_to_streamed_response_wrapper( - traces.create, - ) diff --git a/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_rule.py b/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_rule.py index 8421ef7df0d..3dbb9d85afa 100644 --- a/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_rule.py +++ b/src/cloudflare/types/magic_network_monitoring/magic_network_monitoring_rule.py @@ -35,6 +35,7 @@ class MagicNetworkMonitoringRule(BaseModel): prefixes: List[str] id: Optional[str] = None + """The id of the rule. Must be unique.""" bandwidth_threshold: Optional[float] = None """The number of bits per second for the rule. diff --git a/src/cloudflare/types/request_tracers/__init__.py b/src/cloudflare/types/request_tracers/__init__.py index 40a59470259..f8ee8b14b1c 100644 --- a/src/cloudflare/types/request_tracers/__init__.py +++ b/src/cloudflare/types/request_tracers/__init__.py @@ -1,8 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .trace import Trace as Trace -from .trace_item import TraceItem as TraceItem -from .trace_create_params import TraceCreateParams as TraceCreateParams -from .trace_create_response import TraceCreateResponse as TraceCreateResponse diff --git a/src/cloudflare/types/request_tracers/trace.py b/src/cloudflare/types/request_tracers/trace.py deleted file mode 100644 index 4687762c7f8..00000000000 --- a/src/cloudflare/types/request_tracers/trace.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List - -__all__ = ["Trace"] - -Trace = List["TraceItem"] - -from .trace_item import TraceItem diff --git a/src/cloudflare/types/request_tracers/trace_create_params.py b/src/cloudflare/types/request_tracers/trace_create_params.py deleted file mode 100644 index d817af499b3..00000000000 --- a/src/cloudflare/types/request_tracers/trace_create_params.py +++ /dev/null @@ -1,80 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict -from typing_extensions import Required, TypedDict - -__all__ = ["TraceCreateParams", "Body", "Context", "ContextGeoloc"] - - -class TraceCreateParams(TypedDict, total=False): - method: Required[str] - """HTTP Method of tracing request""" - - url: Required[str] - """URL to which perform tracing request""" - - body: Body - - context: Context - """Additional request parameters""" - - cookies: Dict[str, str] - """Cookies added to tracing request""" - - headers: Dict[str, str] - """Headers added to tracing request""" - - protocol: str - """HTTP Protocol of tracing request""" - - skip_response: bool - """Skip sending the request to the Origin server after all rules evaluation""" - - -class Body(TypedDict, total=False): - base64: str - """Base64 encoded request body""" - - json: object - """Arbitrary json as request body""" - - plain_text: str - """Request body as plain text""" - - -class ContextGeoloc(TypedDict, total=False): - city: str - - continent: str - - is_eu_country: bool - - iso_code: str - - latitude: float - - longitude: float - - postal_code: str - - region_code: str - - subdivision_2_iso_code: str - - timezone: str - - -class Context(TypedDict, total=False): - bot_score: int - """Bot score used for evaluating tracing request processing""" - - geoloc: ContextGeoloc - """Geodata for tracing request""" - - skip_challenge: bool - """Whether to skip any challenges for tracing request (e.g.: captcha)""" - - threat_score: int - """Threat score used for evaluating tracing request processing""" diff --git a/src/cloudflare/types/request_tracers/trace_create_response.py b/src/cloudflare/types/request_tracers/trace_create_response.py deleted file mode 100644 index 3e72c080e9a..00000000000 --- a/src/cloudflare/types/request_tracers/trace_create_response.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional - -from ..._compat import PYDANTIC_V2 -from ..._models import BaseModel - -__all__ = ["TraceCreateResponse"] - - -class TraceCreateResponse(BaseModel): - status_code: Optional[int] = None - """HTTP Status code of zone response""" - - trace: Optional["Trace"] = None - - -from .trace import Trace - -if PYDANTIC_V2: - TraceCreateResponse.model_rebuild() -else: - TraceCreateResponse.update_forward_refs() # type: ignore diff --git a/src/cloudflare/types/request_tracers/trace_item.py b/src/cloudflare/types/request_tracers/trace_item.py deleted file mode 100644 index 2830764115e..00000000000 --- a/src/cloudflare/types/request_tracers/trace_item.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional - -from ..._compat import PYDANTIC_V2 -from ..._models import BaseModel - -__all__ = ["TraceItem"] - - -class TraceItem(BaseModel): - action: Optional[str] = None - """If step type is rule, then action performed by this rule""" - - action_parameters: Optional[object] = None - """If step type is rule, then action parameters of this rule as JSON""" - - description: Optional[str] = None - """If step type is rule or ruleset, the description of this entity""" - - expression: Optional[str] = None - """If step type is rule, then expression used to match for this rule""" - - kind: Optional[str] = None - """If step type is ruleset, then kind of this ruleset""" - - matched: Optional[bool] = None - """Whether tracing step affected tracing request/response""" - - name: Optional[str] = None - """If step type is ruleset, then name of this ruleset""" - - step_name: Optional[str] = None - """Tracing step identifying name""" - - trace: Optional["Trace"] = None - - type: Optional[str] = None - """Tracing step type""" - - -from .trace import Trace - -if PYDANTIC_V2: - TraceItem.model_rebuild() -else: - TraceItem.update_forward_refs() # type: ignore diff --git a/tests/api_resources/request_tracers/test_traces.py b/tests/api_resources/request_tracers/test_traces.py deleted file mode 100644 index a8deb3bbce2..00000000000 --- a/tests/api_resources/request_tracers/test_traces.py +++ /dev/null @@ -1,206 +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.types.request_tracers import TraceCreateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTraces: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_create(self, client: Cloudflare) -> None: - trace = client.request_tracers.traces.create( - "023e105f4ecef8ad9ca31a8372d0c353", - method="PUT", - url="https://some.zone/some_path", - ) - assert_matches_type(TraceCreateResponse, trace, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - trace = client.request_tracers.traces.create( - "023e105f4ecef8ad9ca31a8372d0c353", - method="PUT", - url="https://some.zone/some_path", - body={ - "base64": "c29tZV9yZXF1ZXN0X2JvZHk=", - "json": {}, - "plain_text": "string", - }, - context={ - "bot_score": 0, - "geoloc": { - "city": "London", - "continent": "string", - "is_eu_country": True, - "iso_code": "string", - "latitude": 0, - "longitude": 0, - "postal_code": "string", - "region_code": "string", - "subdivision_2_iso_code": "string", - "timezone": "string", - }, - "skip_challenge": True, - "threat_score": 0, - }, - cookies={ - "cookie_name_1": "cookie_value_1", - "cookie_name_2": "cookie_value_2", - }, - headers={ - "header_name_1": "header_value_1", - "header_name_2": "header_value_2", - }, - protocol="HTTP/1.1", - skip_response=True, - ) - assert_matches_type(TraceCreateResponse, trace, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.request_tracers.traces.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - method="PUT", - url="https://some.zone/some_path", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trace = response.parse() - assert_matches_type(TraceCreateResponse, trace, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.request_tracers.traces.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - method="PUT", - url="https://some.zone/some_path", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trace = response.parse() - assert_matches_type(TraceCreateResponse, trace, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.request_tracers.traces.with_raw_response.create( - "", - method="PUT", - url="https://some.zone/some_path", - ) - - -class TestAsyncTraces: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: - trace = await async_client.request_tracers.traces.create( - "023e105f4ecef8ad9ca31a8372d0c353", - method="PUT", - url="https://some.zone/some_path", - ) - assert_matches_type(TraceCreateResponse, trace, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - trace = await async_client.request_tracers.traces.create( - "023e105f4ecef8ad9ca31a8372d0c353", - method="PUT", - url="https://some.zone/some_path", - body={ - "base64": "c29tZV9yZXF1ZXN0X2JvZHk=", - "json": {}, - "plain_text": "string", - }, - context={ - "bot_score": 0, - "geoloc": { - "city": "London", - "continent": "string", - "is_eu_country": True, - "iso_code": "string", - "latitude": 0, - "longitude": 0, - "postal_code": "string", - "region_code": "string", - "subdivision_2_iso_code": "string", - "timezone": "string", - }, - "skip_challenge": True, - "threat_score": 0, - }, - cookies={ - "cookie_name_1": "cookie_value_1", - "cookie_name_2": "cookie_value_2", - }, - headers={ - "header_name_1": "header_value_1", - "header_name_2": "header_value_2", - }, - protocol="HTTP/1.1", - skip_response=True, - ) - assert_matches_type(TraceCreateResponse, trace, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.request_tracers.traces.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - method="PUT", - url="https://some.zone/some_path", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trace = await response.parse() - assert_matches_type(TraceCreateResponse, trace, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.request_tracers.traces.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - method="PUT", - url="https://some.zone/some_path", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trace = await response.parse() - assert_matches_type(TraceCreateResponse, trace, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.request_tracers.traces.with_raw_response.create( - "", - method="PUT", - url="https://some.zone/some_path", - )