Skip to content

Commit 7a89e81

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#134)
1 parent 92ce29b commit 7a89e81

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

src/cloudflare/resources/radar/bgp/routes.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def pfx2as(
107107
self,
108108
*,
109109
format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN,
110+
longest_prefix_match: bool | NotGiven = NOT_GIVEN,
110111
origin: int | NotGiven = NOT_GIVEN,
111112
prefix: str | NotGiven = NOT_GIVEN,
112113
rpki_status: Literal["VALID", "INVALID", "UNKNOWN"] | NotGiven = NOT_GIVEN,
@@ -118,14 +119,17 @@ def pfx2as(
118119
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
119120
) -> RoutePfx2asResponse:
120121
"""
121-
Lookup prefix-to-origin mapping on global routing tables.
122+
Lookup prefix-to-ASN mapping on global routing tables.
122123
123124
Args:
124125
format: Format results are returned in.
125126
127+
longest_prefix_match: Return only results with the longest prefix match for the given prefix. For
128+
example, specify a /32 prefix to lookup the origin ASN for an IPv4 address.
129+
126130
origin: Lookup prefixes originated by the given ASN
127131
128-
prefix: Lookup origins of the given prefix
132+
prefix: Lookup origin ASNs of the given prefix
129133
130134
rpki_status: Return only results with matching rpki status: valid, invalid or unknown
131135
@@ -147,6 +151,7 @@ def pfx2as(
147151
query=maybe_transform(
148152
{
149153
"format": format,
154+
"longest_prefix_match": longest_prefix_match,
150155
"origin": origin,
151156
"prefix": prefix,
152157
"rpki_status": rpki_status,
@@ -356,6 +361,7 @@ async def pfx2as(
356361
self,
357362
*,
358363
format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN,
364+
longest_prefix_match: bool | NotGiven = NOT_GIVEN,
359365
origin: int | NotGiven = NOT_GIVEN,
360366
prefix: str | NotGiven = NOT_GIVEN,
361367
rpki_status: Literal["VALID", "INVALID", "UNKNOWN"] | NotGiven = NOT_GIVEN,
@@ -367,14 +373,17 @@ async def pfx2as(
367373
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
368374
) -> RoutePfx2asResponse:
369375
"""
370-
Lookup prefix-to-origin mapping on global routing tables.
376+
Lookup prefix-to-ASN mapping on global routing tables.
371377
372378
Args:
373379
format: Format results are returned in.
374380
381+
longest_prefix_match: Return only results with the longest prefix match for the given prefix. For
382+
example, specify a /32 prefix to lookup the origin ASN for an IPv4 address.
383+
375384
origin: Lookup prefixes originated by the given ASN
376385
377-
prefix: Lookup origins of the given prefix
386+
prefix: Lookup origin ASNs of the given prefix
378387
379388
rpki_status: Return only results with matching rpki status: valid, invalid or unknown
380389
@@ -396,6 +405,7 @@ async def pfx2as(
396405
query=await async_maybe_transform(
397406
{
398407
"format": format,
408+
"longest_prefix_match": longest_prefix_match,
399409
"origin": origin,
400410
"prefix": prefix,
401411
"rpki_status": rpki_status,

src/cloudflare/types/radar/bgp/route_pfx2as_params.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ class RoutePfx2asParams(TypedDict, total=False):
1313
format: Literal["JSON", "CSV"]
1414
"""Format results are returned in."""
1515

16+
longest_prefix_match: Annotated[bool, PropertyInfo(alias="longestPrefixMatch")]
17+
"""Return only results with the longest prefix match for the given prefix.
18+
19+
For example, specify a /32 prefix to lookup the origin ASN for an IPv4 address.
20+
"""
21+
1622
origin: int
1723
"""Lookup prefixes originated by the given ASN"""
1824

1925
prefix: str
20-
"""Lookup origins of the given prefix"""
26+
"""Lookup origin ASNs of the given prefix"""
2127

2228
rpki_status: Annotated[Literal["VALID", "INVALID", "UNKNOWN"], PropertyInfo(alias="rpkiStatus")]
2329
"""Return only results with matching rpki status: valid, invalid or unknown"""

tests/api_resources/radar/bgp/test_routes.py

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def test_method_pfx2as(self, client: Cloudflare) -> None:
7373
def test_method_pfx2as_with_all_params(self, client: Cloudflare) -> None:
7474
route = client.radar.bgp.routes.pfx2as(
7575
format="JSON",
76+
longest_prefix_match=True,
7677
origin=0,
7778
prefix="1.1.1.0/24",
7879
rpki_status="INVALID",
@@ -233,6 +234,7 @@ async def test_method_pfx2as(self, async_client: AsyncCloudflare) -> None:
233234
async def test_method_pfx2as_with_all_params(self, async_client: AsyncCloudflare) -> None:
234235
route = await async_client.radar.bgp.routes.pfx2as(
235236
format="JSON",
237+
longest_prefix_match=True,
236238
origin=0,
237239
prefix="1.1.1.0/24",
238240
rpki_status="INVALID",

0 commit comments

Comments
 (0)