Skip to content

Commit b181496

Browse files
feat(api): api update (#2459)
1 parent 25d39d1 commit b181496

File tree

5 files changed

+36
-3
lines changed

5 files changed

+36
-3
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1528
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a9e85bad713be0131dc6634e1c1e9b76c69f06887fffc104202fd7c18898dcb5.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-5ccb565ee8508335116b0ce9efa6068ddb775fe825726cf3fad2731c6f814f77.yml

src/cloudflare/resources/magic_transit/pcaps/pcaps.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, cast
5+
from typing import Any, Union, cast
6+
from datetime import datetime
67
from typing_extensions import Literal, overload
78

89
import httpx
@@ -87,6 +88,7 @@ def create(
8788
time_limit: float,
8889
type: Literal["simple", "full"],
8990
filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN,
91+
offset_time: Union[str, datetime] | NotGiven = NOT_GIVEN,
9092
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
9193
# The extra values given here take precedence over values defined on the client or passed to this method.
9294
extra_headers: Headers | None = None,
@@ -111,6 +113,9 @@ def create(
111113
112114
filter_v1: The packet capture filter. When this field is empty, all packets are captured.
113115
116+
offset_time: The RFC 3339 offset timestamp from which to query backwards for packets. Must be
117+
within the last 24h. When this field is empty, defaults to time of request.
118+
114119
extra_headers: Send extra headers
115120
116121
extra_query: Add additional query parameters to the request
@@ -190,6 +195,7 @@ def create(
190195
time_limit: float,
191196
type: Literal["simple", "full"],
192197
filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN,
198+
offset_time: Union[str, datetime] | NotGiven = NOT_GIVEN,
193199
colo_name: str | NotGiven = NOT_GIVEN,
194200
destination_conf: str | NotGiven = NOT_GIVEN,
195201
byte_limit: float | NotGiven = NOT_GIVEN,
@@ -213,6 +219,7 @@ def create(
213219
"time_limit": time_limit,
214220
"type": type,
215221
"filter_v1": filter_v1,
222+
"offset_time": offset_time,
216223
"colo_name": colo_name,
217224
"destination_conf": destination_conf,
218225
"byte_limit": byte_limit,
@@ -356,6 +363,7 @@ async def create(
356363
time_limit: float,
357364
type: Literal["simple", "full"],
358365
filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN,
366+
offset_time: Union[str, datetime] | NotGiven = NOT_GIVEN,
359367
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
360368
# The extra values given here take precedence over values defined on the client or passed to this method.
361369
extra_headers: Headers | None = None,
@@ -380,6 +388,9 @@ async def create(
380388
381389
filter_v1: The packet capture filter. When this field is empty, all packets are captured.
382390
391+
offset_time: The RFC 3339 offset timestamp from which to query backwards for packets. Must be
392+
within the last 24h. When this field is empty, defaults to time of request.
393+
383394
extra_headers: Send extra headers
384395
385396
extra_query: Add additional query parameters to the request
@@ -459,6 +470,7 @@ async def create(
459470
time_limit: float,
460471
type: Literal["simple", "full"],
461472
filter_v1: PCAPFilterParam | NotGiven = NOT_GIVEN,
473+
offset_time: Union[str, datetime] | NotGiven = NOT_GIVEN,
462474
colo_name: str | NotGiven = NOT_GIVEN,
463475
destination_conf: str | NotGiven = NOT_GIVEN,
464476
byte_limit: float | NotGiven = NOT_GIVEN,
@@ -482,6 +494,7 @@ async def create(
482494
"time_limit": time_limit,
483495
"type": type,
484496
"filter_v1": filter_v1,
497+
"offset_time": offset_time,
485498
"colo_name": colo_name,
486499
"destination_conf": destination_conf,
487500
"byte_limit": byte_limit,

src/cloudflare/types/magic_transit/pcap.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
from typing import Optional
4+
from datetime import datetime
45
from typing_extensions import Literal
56

67
from ..._models import BaseModel
@@ -16,6 +17,13 @@ class PCAP(BaseModel):
1617
filter_v1: Optional[PCAPFilter] = None
1718
"""The packet capture filter. When this field is empty, all packets are captured."""
1819

20+
offset_time: Optional[datetime] = None
21+
"""The RFC 3339 offset timestamp from which to query backwards for packets.
22+
23+
Must be within the last 24h. When this field is empty, defaults to time of
24+
request.
25+
"""
26+
1927
status: Optional[
2028
Literal[
2129
"unknown", "success", "pending", "running", "conversion_pending", "conversion_running", "complete", "failed"

src/cloudflare/types/magic_transit/pcap_create_params.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
from __future__ import annotations
44

55
from typing import Union
6-
from typing_extensions import Literal, Required, TypeAlias, TypedDict
6+
from datetime import datetime
7+
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
78

9+
from ..._utils import PropertyInfo
810
from .pcap_filter_param import PCAPFilterParam
911

1012
__all__ = ["PCAPCreateParams", "MagicVisibilityPCAPsPCAPsRequestSimple", "MagicVisibilityPCAPsPCAPsRequestFull"]
@@ -33,6 +35,13 @@ class MagicVisibilityPCAPsPCAPsRequestSimple(TypedDict, total=False):
3335
filter_v1: PCAPFilterParam
3436
"""The packet capture filter. When this field is empty, all packets are captured."""
3537

38+
offset_time: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
39+
"""The RFC 3339 offset timestamp from which to query backwards for packets.
40+
41+
Must be within the last 24h. When this field is empty, defaults to time of
42+
request.
43+
"""
44+
3645

3746
class MagicVisibilityPCAPsPCAPsRequestFull(TypedDict, total=False):
3847
account_id: Required[str]

tests/api_resources/magic_transit/test_pcaps.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from cloudflare import Cloudflare, AsyncCloudflare
1111
from tests.utils import assert_matches_type
12+
from cloudflare._utils import parse_datetime
1213
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
1314
from cloudflare.types.magic_transit import (
1415
PCAPGetResponse,
@@ -48,6 +49,7 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N
4849
"source_address": "1.2.3.4",
4950
"source_port": 123,
5051
},
52+
offset_time=parse_datetime("2020-01-01T08:00:00Z"),
5153
)
5254
assert_matches_type(PCAPCreateResponse, pcap, path=["response"])
5355

@@ -289,6 +291,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
289291
"source_address": "1.2.3.4",
290292
"source_port": 123,
291293
},
294+
offset_time=parse_datetime("2020-01-01T08:00:00Z"),
292295
)
293296
assert_matches_type(PCAPCreateResponse, pcap, path=["response"])
294297

0 commit comments

Comments
 (0)