Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:

- <code title="post /accounts/{account_id}/pcaps/ownership">client.magic_transit.pcaps.ownership.<a href="./src/cloudflare/resources/magic_transit/pcaps/ownership.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/pcaps/ownership_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/pcaps/ownership_create_response.py">OwnershipCreateResponse</a></code>
- <code title="post /accounts/{account_id}/pcaps/ownership">client.magic_transit.pcaps.ownership.<a href="./src/cloudflare/resources/magic_transit/pcaps/ownership.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/pcaps/ownership_create_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/pcaps/ownership.py">Ownership</a></code>
- <code title="delete /accounts/{account_id}/pcaps/ownership/{ownership_id}">client.magic_transit.pcaps.ownership.<a href="./src/cloudflare/resources/magic_transit/pcaps/ownership.py">delete</a>(ownership_id, \*, account_id) -> None</code>
- <code title="get /accounts/{account_id}/pcaps/ownership">client.magic_transit.pcaps.ownership.<a href="./src/cloudflare/resources/magic_transit/pcaps/ownership.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/magic_transit/pcaps/ownership_get_response.py">Optional</a></code>
- <code title="post /accounts/{account_id}/pcaps/ownership/validate">client.magic_transit.pcaps.ownership.<a href="./src/cloudflare/resources/magic_transit/pcaps/ownership.py">validate</a>(\*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/pcaps/ownership_validate_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/pcaps/ownership_validate_response.py">OwnershipValidateResponse</a></code>
- <code title="post /accounts/{account_id}/pcaps/ownership/validate">client.magic_transit.pcaps.ownership.<a href="./src/cloudflare/resources/magic_transit/pcaps/ownership.py">validate</a>(\*, account_id, \*\*<a href="src/cloudflare/types/magic_transit/pcaps/ownership_validate_params.py">params</a>) -> <a href="./src/cloudflare/types/magic_transit/pcaps/ownership.py">Ownership</a></code>

### Download

Expand Down
27 changes: 13 additions & 14 deletions src/cloudflare/resources/magic_transit/pcaps/ownership.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down Expand Up @@ -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.

Expand All @@ -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(
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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]),
)


Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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]),
)


Expand Down
13 changes: 7 additions & 6 deletions src/cloudflare/resources/magic_transit/pcaps/pcaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/cloudflare/types/magic_transit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
40 changes: 40 additions & 0 deletions src/cloudflare/types/magic_transit/pcap.py
Original file line number Diff line number Diff line change
@@ -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.
"""
48 changes: 5 additions & 43 deletions src/cloudflare/types/magic_transit/pcap_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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"""
Expand Down Expand Up @@ -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]
Loading