diff --git a/api.md b/api.md index 98a284741b3..4501b1b0e80 100644 --- a/api.md +++ b/api.md @@ -3754,7 +3754,13 @@ Methods: Types: ```python -from cloudflare.types.magic_transit import PCAPCreateResponse, PCAPListResponse, PCAPGetResponse +from cloudflare.types.magic_transit import ( + PCAP, + PCAPFilter, + PCAPCreateResponse, + PCAPListResponse, + PCAPGetResponse, +) ``` Methods: @@ -3768,19 +3774,15 @@ Methods: Types: ```python -from cloudflare.types.magic_transit.pcaps import ( - OwnershipCreateResponse, - OwnershipGetResponse, - OwnershipValidateResponse, -) +from cloudflare.types.magic_transit.pcaps import Ownership, OwnershipGetResponse ``` Methods: -- client.magic_transit.pcaps.ownership.create(\*, account_id, \*\*params) -> OwnershipCreateResponse +- client.magic_transit.pcaps.ownership.create(\*, account_id, \*\*params) -> Ownership - client.magic_transit.pcaps.ownership.delete(ownership_id, \*, account_id) -> None - client.magic_transit.pcaps.ownership.get(\*, account_id) -> Optional -- client.magic_transit.pcaps.ownership.validate(\*, account_id, \*\*params) -> OwnershipValidateResponse +- client.magic_transit.pcaps.ownership.validate(\*, account_id, \*\*params) -> Ownership ### Download diff --git a/src/cloudflare/resources/magic_transit/pcaps/ownership.py b/src/cloudflare/resources/magic_transit/pcaps/ownership.py index 1937ea785ce..9b6c8aa9deb 100644 --- a/src/cloudflare/resources/magic_transit/pcaps/ownership.py +++ b/src/cloudflare/resources/magic_transit/pcaps/ownership.py @@ -22,9 +22,8 @@ from ...._wrappers import ResultWrapper from ...._base_client import make_request_options from ....types.magic_transit.pcaps import ownership_create_params, ownership_validate_params +from ....types.magic_transit.pcaps.ownership import Ownership from ....types.magic_transit.pcaps.ownership_get_response import OwnershipGetResponse -from ....types.magic_transit.pcaps.ownership_create_response import OwnershipCreateResponse -from ....types.magic_transit.pcaps.ownership_validate_response import OwnershipValidateResponse __all__ = ["OwnershipResource", "AsyncOwnershipResource"] @@ -60,7 +59,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OwnershipCreateResponse: + ) -> Ownership: """ Adds an AWS or GCP bucket to use with full packet captures. @@ -87,9 +86,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[OwnershipCreateResponse]._unwrapper, + post_parser=ResultWrapper[Ownership]._unwrapper, ), - cast_to=cast(Type[OwnershipCreateResponse], ResultWrapper[OwnershipCreateResponse]), + cast_to=cast(Type[Ownership], ResultWrapper[Ownership]), ) def delete( @@ -184,7 +183,7 @@ def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OwnershipValidateResponse: + ) -> Ownership: """ Validates buckets added to the packet captures API. @@ -219,9 +218,9 @@ def validate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[OwnershipValidateResponse]._unwrapper, + post_parser=ResultWrapper[Ownership]._unwrapper, ), - cast_to=cast(Type[OwnershipValidateResponse], ResultWrapper[OwnershipValidateResponse]), + cast_to=cast(Type[Ownership], ResultWrapper[Ownership]), ) @@ -256,7 +255,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OwnershipCreateResponse: + ) -> Ownership: """ Adds an AWS or GCP bucket to use with full packet captures. @@ -285,9 +284,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[OwnershipCreateResponse]._unwrapper, + post_parser=ResultWrapper[Ownership]._unwrapper, ), - cast_to=cast(Type[OwnershipCreateResponse], ResultWrapper[OwnershipCreateResponse]), + cast_to=cast(Type[Ownership], ResultWrapper[Ownership]), ) async def delete( @@ -382,7 +381,7 @@ async def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OwnershipValidateResponse: + ) -> Ownership: """ Validates buckets added to the packet captures API. @@ -417,9 +416,9 @@ async def validate( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[OwnershipValidateResponse]._unwrapper, + post_parser=ResultWrapper[Ownership]._unwrapper, ), - cast_to=cast(Type[OwnershipValidateResponse], ResultWrapper[OwnershipValidateResponse]), + cast_to=cast(Type[Ownership], ResultWrapper[Ownership]), ) diff --git a/src/cloudflare/resources/magic_transit/pcaps/pcaps.py b/src/cloudflare/resources/magic_transit/pcaps/pcaps.py index 558501ae59d..952a6bb2750 100644 --- a/src/cloudflare/resources/magic_transit/pcaps/pcaps.py +++ b/src/cloudflare/resources/magic_transit/pcaps/pcaps.py @@ -41,6 +41,7 @@ from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import AsyncPaginator, make_request_options from ....types.magic_transit import pcap_create_params +from ....types.magic_transit.pcap_filter_param import PCAPFilterParam from ....types.magic_transit.pcap_get_response import PCAPGetResponse from ....types.magic_transit.pcap_list_response import PCAPListResponse from ....types.magic_transit.pcap_create_response import PCAPCreateResponse @@ -85,7 +86,7 @@ def create( system: Literal["magic-transit"], time_limit: float, type: Literal["simple", "full"], - filter_v1: pcap_create_params.MagicVisibilityPCAPsPCAPsRequestSimpleFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | 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, @@ -131,7 +132,7 @@ def create( time_limit: float, type: Literal["simple", "full"], byte_limit: float | NotGiven = NOT_GIVEN, - filter_v1: pcap_create_params.MagicVisibilityPCAPsPCAPsRequestFullFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN, packet_limit: float | 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. @@ -188,7 +189,7 @@ def create( system: Literal["magic-transit"], time_limit: float, type: Literal["simple", "full"], - filter_v1: pcap_create_params.MagicVisibilityPCAPsPCAPsRequestSimpleFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN, colo_name: str | NotGiven = NOT_GIVEN, destination_conf: str | NotGiven = NOT_GIVEN, byte_limit: float | NotGiven = NOT_GIVEN, @@ -354,7 +355,7 @@ async def create( system: Literal["magic-transit"], time_limit: float, type: Literal["simple", "full"], - filter_v1: pcap_create_params.MagicVisibilityPCAPsPCAPsRequestSimpleFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | 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, @@ -400,7 +401,7 @@ async def create( time_limit: float, type: Literal["simple", "full"], byte_limit: float | NotGiven = NOT_GIVEN, - filter_v1: pcap_create_params.MagicVisibilityPCAPsPCAPsRequestFullFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN, packet_limit: float | 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. @@ -457,7 +458,7 @@ async def create( system: Literal["magic-transit"], time_limit: float, type: Literal["simple", "full"], - filter_v1: pcap_create_params.MagicVisibilityPCAPsPCAPsRequestSimpleFilterV1 | NotGiven = NOT_GIVEN, + filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN, colo_name: str | NotGiven = NOT_GIVEN, destination_conf: str | NotGiven = NOT_GIVEN, byte_limit: float | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/types/magic_transit/__init__.py b/src/cloudflare/types/magic_transit/__init__.py index 238c1e0a884..099059832ec 100644 --- a/src/cloudflare/types/magic_transit/__init__.py +++ b/src/cloudflare/types/magic_transit/__init__.py @@ -2,8 +2,10 @@ from __future__ import annotations +from .pcap import PCAP as PCAP from .site import Site as Site from .scope import Scope as Scope +from .pcap_filter import PCAPFilter as PCAPFilter from .scope_param import ScopeParam as ScopeParam from .health_check import HealthCheck as HealthCheck from .psk_metadata import PSKMetadata as PSKMetadata @@ -15,6 +17,7 @@ from .app_update_params import AppUpdateParams as AppUpdateParams from .health_check_rate import HealthCheckRate as HealthCheckRate from .health_check_type import HealthCheckType as HealthCheckType +from .pcap_filter_param import PCAPFilterParam as PCAPFilterParam from .pcap_get_response import PCAPGetResponse as PCAPGetResponse from .health_check_param import HealthCheckParam as HealthCheckParam from .pcap_create_params import PCAPCreateParams as PCAPCreateParams diff --git a/src/cloudflare/types/magic_transit/pcap.py b/src/cloudflare/types/magic_transit/pcap.py new file mode 100644 index 00000000000..849b466015c --- /dev/null +++ b/src/cloudflare/types/magic_transit/pcap.py @@ -0,0 +1,40 @@ +# 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 +from .pcap_filter import PCAPFilter + +__all__ = ["PCAP"] + + +class PCAP(BaseModel): + id: Optional[str] = None + """The ID for the packet capture.""" + + filter_v1: Optional[PCAPFilter] = None + """The packet capture filter. When this field is empty, all packets are captured.""" + + status: Optional[ + Literal[ + "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" + ] + ] = None + """The status of the packet capture request.""" + + submitted: Optional[str] = None + """The RFC 3339 timestamp when the packet capture was created.""" + + system: Optional[Literal["magic-transit"]] = None + """The system used to collect packet captures.""" + + time_limit: Optional[float] = None + """The packet capture duration in seconds.""" + + type: Optional[Literal["simple", "full"]] = None + """The type of packet capture. + + `Simple` captures sampled packets, and `full` captures entire payloads and + non-sampled packets. + """ diff --git a/src/cloudflare/types/magic_transit/pcap_create_params.py b/src/cloudflare/types/magic_transit/pcap_create_params.py index 2695dfc5eb1..b84be410701 100644 --- a/src/cloudflare/types/magic_transit/pcap_create_params.py +++ b/src/cloudflare/types/magic_transit/pcap_create_params.py @@ -5,13 +5,9 @@ from typing import Union from typing_extensions import Literal, Required, TypeAlias, TypedDict -__all__ = [ - "PCAPCreateParams", - "MagicVisibilityPCAPsPCAPsRequestSimple", - "MagicVisibilityPCAPsPCAPsRequestSimpleFilterV1", - "MagicVisibilityPCAPsPCAPsRequestFull", - "MagicVisibilityPCAPsPCAPsRequestFullFilterV1", -] +from .pcap_filter_param import PCAPFilterParam + +__all__ = ["PCAPCreateParams", "MagicVisibilityPCAPsPCAPsRequestSimple", "MagicVisibilityPCAPsPCAPsRequestFull"] class MagicVisibilityPCAPsPCAPsRequestSimple(TypedDict, total=False): @@ -34,27 +30,10 @@ class MagicVisibilityPCAPsPCAPsRequestSimple(TypedDict, total=False): non-sampled packets. """ - filter_v1: MagicVisibilityPCAPsPCAPsRequestSimpleFilterV1 + filter_v1: PCAPFilterParam """The packet capture filter. When this field is empty, all packets are captured.""" -class MagicVisibilityPCAPsPCAPsRequestSimpleFilterV1(TypedDict, total=False): - destination_address: str - """The destination IP address of the packet.""" - - destination_port: float - """The destination port of the packet.""" - - protocol: float - """The protocol number of the packet.""" - - source_address: str - """The source IP address of the packet.""" - - source_port: float - """The source port of the packet.""" - - class MagicVisibilityPCAPsPCAPsRequestFull(TypedDict, total=False): account_id: Required[str] """Identifier""" @@ -88,28 +67,11 @@ class MagicVisibilityPCAPsPCAPsRequestFull(TypedDict, total=False): This field only applies to `full` packet captures. """ - filter_v1: MagicVisibilityPCAPsPCAPsRequestFullFilterV1 + filter_v1: PCAPFilterParam """The packet capture filter. When this field is empty, all packets are captured.""" packet_limit: float """The limit of packets contained in a packet capture.""" -class MagicVisibilityPCAPsPCAPsRequestFullFilterV1(TypedDict, total=False): - destination_address: str - """The destination IP address of the packet.""" - - destination_port: float - """The destination port of the packet.""" - - protocol: float - """The protocol number of the packet.""" - - source_address: str - """The source IP address of the packet.""" - - source_port: float - """The source port of the packet.""" - - PCAPCreateParams: TypeAlias = Union[MagicVisibilityPCAPsPCAPsRequestSimple, MagicVisibilityPCAPsPCAPsRequestFull] diff --git a/src/cloudflare/types/magic_transit/pcap_create_response.py b/src/cloudflare/types/magic_transit/pcap_create_response.py index 24c5fd3295c..d39103834ba 100644 --- a/src/cloudflare/types/magic_transit/pcap_create_response.py +++ b/src/cloudflare/types/magic_transit/pcap_create_response.py @@ -3,80 +3,11 @@ from typing import Union, Optional from typing_extensions import Literal, TypeAlias +from .pcap import PCAP from ..._models import BaseModel +from .pcap_filter import PCAPFilter -__all__ = [ - "PCAPCreateResponse", - "MagicVisibilityPCAPsPCAPsResponseSimple", - "MagicVisibilityPCAPsPCAPsResponseSimpleFilterV1", - "MagicVisibilityPCAPsPCAPsResponseFull", - "MagicVisibilityPCAPsPCAPsResponseFullFilterV1", -] - - -class MagicVisibilityPCAPsPCAPsResponseSimpleFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" - - -class MagicVisibilityPCAPsPCAPsResponseSimple(BaseModel): - id: Optional[str] = None - """The ID for the packet capture.""" - - filter_v1: Optional[MagicVisibilityPCAPsPCAPsResponseSimpleFilterV1] = None - """The packet capture filter. When this field is empty, all packets are captured.""" - - status: Optional[ - Literal[ - "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" - ] - ] = None - """The status of the packet capture request.""" - - submitted: Optional[str] = None - """The RFC 3339 timestamp when the packet capture was created.""" - - system: Optional[Literal["magic-transit"]] = None - """The system used to collect packet captures.""" - - time_limit: Optional[float] = None - """The packet capture duration in seconds.""" - - type: Optional[Literal["simple", "full"]] = None - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - -class MagicVisibilityPCAPsPCAPsResponseFullFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" +__all__ = ["PCAPCreateResponse", "MagicVisibilityPCAPsPCAPsResponseFull"] class MagicVisibilityPCAPsPCAPsResponseFull(BaseModel): @@ -105,7 +36,7 @@ class MagicVisibilityPCAPsPCAPsResponseFull(BaseModel): This field only applies to `full` packet captures. """ - filter_v1: Optional[MagicVisibilityPCAPsPCAPsResponseFullFilterV1] = None + filter_v1: Optional[PCAPFilter] = None """The packet capture filter. When this field is empty, all packets are captured.""" status: Optional[ @@ -132,4 +63,4 @@ class MagicVisibilityPCAPsPCAPsResponseFull(BaseModel): """ -PCAPCreateResponse: TypeAlias = Union[MagicVisibilityPCAPsPCAPsResponseSimple, MagicVisibilityPCAPsPCAPsResponseFull] +PCAPCreateResponse: TypeAlias = Union[PCAP, MagicVisibilityPCAPsPCAPsResponseFull] diff --git a/src/cloudflare/types/magic_transit/pcap_filter.py b/src/cloudflare/types/magic_transit/pcap_filter.py new file mode 100644 index 00000000000..edc1d8d3402 --- /dev/null +++ b/src/cloudflare/types/magic_transit/pcap_filter.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["PCAPFilter"] + + +class PCAPFilter(BaseModel): + destination_address: Optional[str] = None + """The destination IP address of the packet.""" + + destination_port: Optional[float] = None + """The destination port of the packet.""" + + protocol: Optional[float] = None + """The protocol number of the packet.""" + + source_address: Optional[str] = None + """The source IP address of the packet.""" + + source_port: Optional[float] = None + """The source port of the packet.""" diff --git a/src/cloudflare/types/magic_transit/pcap_filter_param.py b/src/cloudflare/types/magic_transit/pcap_filter_param.py new file mode 100644 index 00000000000..5808477bfc9 --- /dev/null +++ b/src/cloudflare/types/magic_transit/pcap_filter_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["PCAPFilterParam"] + + +class PCAPFilterParam(TypedDict, total=False): + destination_address: str + """The destination IP address of the packet.""" + + destination_port: float + """The destination port of the packet.""" + + protocol: float + """The protocol number of the packet.""" + + source_address: str + """The source IP address of the packet.""" + + source_port: float + """The source port of the packet.""" diff --git a/src/cloudflare/types/magic_transit/pcap_get_response.py b/src/cloudflare/types/magic_transit/pcap_get_response.py index 2bff5b45fdd..ec683eecf3d 100644 --- a/src/cloudflare/types/magic_transit/pcap_get_response.py +++ b/src/cloudflare/types/magic_transit/pcap_get_response.py @@ -3,80 +3,11 @@ from typing import Union, Optional from typing_extensions import Literal, TypeAlias +from .pcap import PCAP from ..._models import BaseModel +from .pcap_filter import PCAPFilter -__all__ = [ - "PCAPGetResponse", - "MagicVisibilityPCAPsPCAPsResponseSimple", - "MagicVisibilityPCAPsPCAPsResponseSimpleFilterV1", - "MagicVisibilityPCAPsPCAPsResponseFull", - "MagicVisibilityPCAPsPCAPsResponseFullFilterV1", -] - - -class MagicVisibilityPCAPsPCAPsResponseSimpleFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" - - -class MagicVisibilityPCAPsPCAPsResponseSimple(BaseModel): - id: Optional[str] = None - """The ID for the packet capture.""" - - filter_v1: Optional[MagicVisibilityPCAPsPCAPsResponseSimpleFilterV1] = None - """The packet capture filter. When this field is empty, all packets are captured.""" - - status: Optional[ - Literal[ - "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" - ] - ] = None - """The status of the packet capture request.""" - - submitted: Optional[str] = None - """The RFC 3339 timestamp when the packet capture was created.""" - - system: Optional[Literal["magic-transit"]] = None - """The system used to collect packet captures.""" - - time_limit: Optional[float] = None - """The packet capture duration in seconds.""" - - type: Optional[Literal["simple", "full"]] = None - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - -class MagicVisibilityPCAPsPCAPsResponseFullFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" +__all__ = ["PCAPGetResponse", "MagicVisibilityPCAPsPCAPsResponseFull"] class MagicVisibilityPCAPsPCAPsResponseFull(BaseModel): @@ -105,7 +36,7 @@ class MagicVisibilityPCAPsPCAPsResponseFull(BaseModel): This field only applies to `full` packet captures. """ - filter_v1: Optional[MagicVisibilityPCAPsPCAPsResponseFullFilterV1] = None + filter_v1: Optional[PCAPFilter] = None """The packet capture filter. When this field is empty, all packets are captured.""" status: Optional[ @@ -132,4 +63,4 @@ class MagicVisibilityPCAPsPCAPsResponseFull(BaseModel): """ -PCAPGetResponse: TypeAlias = Union[MagicVisibilityPCAPsPCAPsResponseSimple, MagicVisibilityPCAPsPCAPsResponseFull] +PCAPGetResponse: TypeAlias = Union[PCAP, MagicVisibilityPCAPsPCAPsResponseFull] diff --git a/src/cloudflare/types/magic_transit/pcap_list_response.py b/src/cloudflare/types/magic_transit/pcap_list_response.py index 632c73e6508..907efbe1ecb 100644 --- a/src/cloudflare/types/magic_transit/pcap_list_response.py +++ b/src/cloudflare/types/magic_transit/pcap_list_response.py @@ -3,80 +3,11 @@ from typing import Union, Optional from typing_extensions import Literal, TypeAlias +from .pcap import PCAP from ..._models import BaseModel +from .pcap_filter import PCAPFilter -__all__ = [ - "PCAPListResponse", - "MagicVisibilityPCAPsPCAPsResponseSimple", - "MagicVisibilityPCAPsPCAPsResponseSimpleFilterV1", - "MagicVisibilityPCAPsPCAPsResponseFull", - "MagicVisibilityPCAPsPCAPsResponseFullFilterV1", -] - - -class MagicVisibilityPCAPsPCAPsResponseSimpleFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" - - -class MagicVisibilityPCAPsPCAPsResponseSimple(BaseModel): - id: Optional[str] = None - """The ID for the packet capture.""" - - filter_v1: Optional[MagicVisibilityPCAPsPCAPsResponseSimpleFilterV1] = None - """The packet capture filter. When this field is empty, all packets are captured.""" - - status: Optional[ - Literal[ - "unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed" - ] - ] = None - """The status of the packet capture request.""" - - submitted: Optional[str] = None - """The RFC 3339 timestamp when the packet capture was created.""" - - system: Optional[Literal["magic-transit"]] = None - """The system used to collect packet captures.""" - - time_limit: Optional[float] = None - """The packet capture duration in seconds.""" - - type: Optional[Literal["simple", "full"]] = None - """The type of packet capture. - - `Simple` captures sampled packets, and `full` captures entire payloads and - non-sampled packets. - """ - - -class MagicVisibilityPCAPsPCAPsResponseFullFilterV1(BaseModel): - destination_address: Optional[str] = None - """The destination IP address of the packet.""" - - destination_port: Optional[float] = None - """The destination port of the packet.""" - - protocol: Optional[float] = None - """The protocol number of the packet.""" - - source_address: Optional[str] = None - """The source IP address of the packet.""" - - source_port: Optional[float] = None - """The source port of the packet.""" +__all__ = ["PCAPListResponse", "MagicVisibilityPCAPsPCAPsResponseFull"] class MagicVisibilityPCAPsPCAPsResponseFull(BaseModel): @@ -105,7 +36,7 @@ class MagicVisibilityPCAPsPCAPsResponseFull(BaseModel): This field only applies to `full` packet captures. """ - filter_v1: Optional[MagicVisibilityPCAPsPCAPsResponseFullFilterV1] = None + filter_v1: Optional[PCAPFilter] = None """The packet capture filter. When this field is empty, all packets are captured.""" status: Optional[ @@ -132,4 +63,4 @@ class MagicVisibilityPCAPsPCAPsResponseFull(BaseModel): """ -PCAPListResponse: TypeAlias = Union[MagicVisibilityPCAPsPCAPsResponseSimple, MagicVisibilityPCAPsPCAPsResponseFull] +PCAPListResponse: TypeAlias = Union[PCAP, MagicVisibilityPCAPsPCAPsResponseFull] diff --git a/src/cloudflare/types/magic_transit/pcaps/__init__.py b/src/cloudflare/types/magic_transit/pcaps/__init__.py index 1029424029b..48f330a9b1a 100644 --- a/src/cloudflare/types/magic_transit/pcaps/__init__.py +++ b/src/cloudflare/types/magic_transit/pcaps/__init__.py @@ -2,8 +2,7 @@ from __future__ import annotations +from .ownership import Ownership as Ownership from .ownership_get_response import OwnershipGetResponse as OwnershipGetResponse from .ownership_create_params import OwnershipCreateParams as OwnershipCreateParams -from .ownership_create_response import OwnershipCreateResponse as OwnershipCreateResponse from .ownership_validate_params import OwnershipValidateParams as OwnershipValidateParams -from .ownership_validate_response import OwnershipValidateResponse as OwnershipValidateResponse diff --git a/src/cloudflare/types/magic_transit/pcaps/ownership_create_response.py b/src/cloudflare/types/magic_transit/pcaps/ownership.py similarity index 91% rename from src/cloudflare/types/magic_transit/pcaps/ownership_create_response.py rename to src/cloudflare/types/magic_transit/pcaps/ownership.py index b20db85089f..bb41edceeff 100644 --- a/src/cloudflare/types/magic_transit/pcaps/ownership_create_response.py +++ b/src/cloudflare/types/magic_transit/pcaps/ownership.py @@ -5,10 +5,10 @@ from ...._models import BaseModel -__all__ = ["OwnershipCreateResponse"] +__all__ = ["Ownership"] -class OwnershipCreateResponse(BaseModel): +class Ownership(BaseModel): id: str """The bucket ID associated with the packet captures API.""" diff --git a/src/cloudflare/types/magic_transit/pcaps/ownership_get_response.py b/src/cloudflare/types/magic_transit/pcaps/ownership_get_response.py index 1682724b1fd..d4b576046e6 100644 --- a/src/cloudflare/types/magic_transit/pcaps/ownership_get_response.py +++ b/src/cloudflare/types/magic_transit/pcaps/ownership_get_response.py @@ -1,31 +1,10 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from typing_extensions import Literal, TypeAlias +from typing import List +from typing_extensions import TypeAlias -from ...._models import BaseModel +from .ownership import Ownership -__all__ = ["OwnershipGetResponse", "OwnershipGetResponseItem"] +__all__ = ["OwnershipGetResponse"] - -class OwnershipGetResponseItem(BaseModel): - id: str - """The bucket ID associated with the packet captures API.""" - - destination_conf: str - """The full URI for the bucket. This field only applies to `full` packet captures.""" - - filename: str - """The ownership challenge filename stored in the bucket.""" - - status: Literal["pending", "success", "failed"] - """The status of the ownership challenge. Can be pending, success or failed.""" - - submitted: str - """The RFC 3339 timestamp when the bucket was added to packet captures API.""" - - validated: Optional[str] = None - """The RFC 3339 timestamp when the bucket was validated.""" - - -OwnershipGetResponse: TypeAlias = List[OwnershipGetResponseItem] +OwnershipGetResponse: TypeAlias = List[Ownership] diff --git a/src/cloudflare/types/magic_transit/pcaps/ownership_validate_response.py b/src/cloudflare/types/magic_transit/pcaps/ownership_validate_response.py deleted file mode 100644 index 5c04c3abb72..00000000000 --- a/src/cloudflare/types/magic_transit/pcaps/ownership_validate_response.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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__ = ["OwnershipValidateResponse"] - - -class OwnershipValidateResponse(BaseModel): - id: str - """The bucket ID associated with the packet captures API.""" - - destination_conf: str - """The full URI for the bucket. This field only applies to `full` packet captures.""" - - filename: str - """The ownership challenge filename stored in the bucket.""" - - status: Literal["pending", "success", "failed"] - """The status of the ownership challenge. Can be pending, success or failed.""" - - submitted: str - """The RFC 3339 timestamp when the bucket was added to packet captures API.""" - - validated: Optional[str] = None - """The RFC 3339 timestamp when the bucket was validated.""" diff --git a/tests/api_resources/magic_transit/pcaps/test_ownership.py b/tests/api_resources/magic_transit/pcaps/test_ownership.py index d237335a9af..a1d62b85d3c 100644 --- a/tests/api_resources/magic_transit/pcaps/test_ownership.py +++ b/tests/api_resources/magic_transit/pcaps/test_ownership.py @@ -10,9 +10,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.types.magic_transit.pcaps import ( + Ownership, OwnershipGetResponse, - OwnershipCreateResponse, - OwnershipValidateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +26,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", destination_conf="s3://pcaps-bucket?region=us-east-1", ) - assert_matches_type(OwnershipCreateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -39,7 +38,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = response.parse() - assert_matches_type(OwnershipCreateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -51,7 +50,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = response.parse() - assert_matches_type(OwnershipCreateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -156,7 +155,7 @@ def test_method_validate(self, client: Cloudflare) -> None: destination_conf="s3://pcaps-bucket?region=us-east-1", ownership_challenge="ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", ) - assert_matches_type(OwnershipValidateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @parametrize def test_raw_response_validate(self, client: Cloudflare) -> None: @@ -169,7 +168,7 @@ def test_raw_response_validate(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = response.parse() - assert_matches_type(OwnershipValidateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @parametrize def test_streaming_response_validate(self, client: Cloudflare) -> None: @@ -182,7 +181,7 @@ def test_streaming_response_validate(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = response.parse() - assert_matches_type(OwnershipValidateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -205,7 +204,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", destination_conf="s3://pcaps-bucket?region=us-east-1", ) - assert_matches_type(OwnershipCreateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -217,7 +216,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = await response.parse() - assert_matches_type(OwnershipCreateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -229,7 +228,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = await response.parse() - assert_matches_type(OwnershipCreateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -334,7 +333,7 @@ async def test_method_validate(self, async_client: AsyncCloudflare) -> None: destination_conf="s3://pcaps-bucket?region=us-east-1", ownership_challenge="ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", ) - assert_matches_type(OwnershipValidateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @parametrize async def test_raw_response_validate(self, async_client: AsyncCloudflare) -> None: @@ -347,7 +346,7 @@ async def test_raw_response_validate(self, async_client: AsyncCloudflare) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = await response.parse() - assert_matches_type(OwnershipValidateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) @parametrize async def test_streaming_response_validate(self, async_client: AsyncCloudflare) -> None: @@ -360,7 +359,7 @@ async def test_streaming_response_validate(self, async_client: AsyncCloudflare) assert response.http_request.headers.get("X-Stainless-Lang") == "python" ownership = await response.parse() - assert_matches_type(OwnershipValidateResponse, ownership, path=["response"]) + assert_matches_type(Ownership, ownership, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_transit/test_pcaps.py b/tests/api_resources/magic_transit/test_pcaps.py index 3cab7f4264d..71c0d0d2a0e 100644 --- a/tests/api_resources/magic_transit/test_pcaps.py +++ b/tests/api_resources/magic_transit/test_pcaps.py @@ -10,7 +10,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.magic_transit import PCAPGetResponse, PCAPListResponse, PCAPCreateResponse +from cloudflare.types.magic_transit import ( + PCAPGetResponse, + PCAPListResponse, + PCAPCreateResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")