8000 feat(api): api update · cloudflare/cloudflare-python@af68ef6 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit af68ef6

Browse files
feat(api): api update
1 parent e749879 commit af68ef6

File tree

5 files changed

+58
-4
lines changed

5 files changed

+58
-4
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1706
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-14ce9a841f2635d4ce59537b8af42c7eaf5ad3b1712f683d732ce6b4a05d60e8.yml
3-
openapi_spec_hash: 26bdd2430ea50730a71fed734df6a3bc
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e7688c36f1fba4d4c25e57392d5ee3e22962bcee03e7cabab8e33fa56ff1dfe1.yml
3+
openapi_spec_hash: 32bbb0f396a4be356992e51f673d4c1a
44
config_hash: 67f412c990647f3cb598378fa22a9db5

src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ def edit(
146146
*,
147147
account_id: str,
148148
prefix_id: str,
149+
asn_prepend_count: int | NotGiven = NOT_GIVEN,
149150
on_demand: bgp_prefix_edit_params.OnDemand | NotGiven = NOT_GIVEN,
151+
withdraw_if_no_route: bool | NotGiven = NOT_GIVEN,
150152
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
151153
# The extra values given here take precedence over values defined on the client or passed to this method.
152154
extra_headers: Headers | None = None,
@@ -165,6 +167,12 @@ def edit(
165167
166168
bgp_prefix_id: Identifier of BGP Prefix.
167169
170+
asn_prepend_count: Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute
171+
172+
withdraw_if_no_route: Controls whether the BGP prefix is automatically withdrawn when prefix is
173+
withdrawn from Magic routing table (for Magic Transit customers using Direct
174+
CNI)
175+< 8000 /span>
168176
extra_headers: Send extra headers
169177
170178
extra_query: Add additional query parameters to the request
@@ -181,7 +189,14 @@ def edit(
181189
raise ValueError(f"Expected a non-empty value for `bgp_prefix_id` but received {bgp_prefix_id!r}")
182190
return self._patch(
183191
f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}",
184-
body=maybe_transform({"on_demand": on_demand}, bgp_prefix_edit_params.BGPPrefixEditParams),
192+
body=maybe_transform(
193+
{
194+
"asn_prepend_count": asn_prepend_count,
195+
"on_demand": on_demand,
196+
"withdraw_if_no_route": withdraw_if_no_route,
197+
},
198+
bgp_prefix_edit_params.BGPPrefixEditParams,
199+
),
185200
options=make_request_options(
186201
extra_headers=extra_headers,
187202
extra_query=extra_query,
@@ -363,7 +378,9 @@ async def edit(
363378
*,
364379
account_id: str,
365380
prefix_id: str,
381+
asn_prepend_count: int | NotGiven = NOT_GIVEN,
366382
on_demand: bgp_prefix_edit_params.OnDemand | NotGiven = NOT_GIVEN,
383+
withdraw_if_no_route: bool | NotGiven = NOT_GIVEN,
367384
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
368385
# The extra values given here take precedence over values defined on the client or passed to this method.
369386
extra_headers: Headers | None = None,
@@ -382,6 +399,12 @@ async def edit(
382399
383400
bgp_prefix_id: Identifier of BGP Prefix.
384401
402+
asn_prepend_count: Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute
403+
404+
withdraw_if_no_route: Controls whether the BGP prefix is automatically withdrawn when prefix is
405+
withdrawn from Magic routing table (for Magic Transit customers using Direct
406+
CNI)
407+
385408
extra_headers: Send extra headers
386409
387410
extra_query: Add additional query parameters to the request
@@ -398,7 +421,14 @@ async def edit(
398421
raise ValueError(f"Expected a non-empty value for `bgp_prefix_id` but received {bgp_prefix_id!r}")
399422
return await self._patch(
400423
f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}",
401-
body=await async_maybe_transform({"on_demand": on_demand}, bgp_prefix_edit_params.BGPPrefixEditParams),
424+
body=await async_maybe_transform(
425+
{
426+
"asn_prepend_count": asn_prepend_count,
427+
"on_demand": on_demand,
428+
"withdraw_if_no_route": withdraw_if_no_route,
429+
},
430+
bgp_prefix_edit_params.BGPPrefixEditParams,
431+
),
402432
options=make_request_options(
403433
extra_headers=extra_headers,
404434
extra_query=extra_query,

src/cloudflare/types/addressing/prefixes/bgp_prefix.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class BGPPrefix(BaseModel):
5555
asn: Optional[int] = None
5656
"""Autonomous System Number (ASN) the prefix will be advertised under."""
5757

58+
asn_prepend_count: Optional[int] = None
59+
"""Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute"""
60+
5861
bgp_signal_opts: Optional[BGPSignalOpts] = None
5962

6063
cidr: Optional[str] = None
@@ -65,3 +68,10 @@ class BGPPrefix(BaseModel):
6568
modified_at: Optional[datetime] = None
6669

6770
on_demand: Optional[OnDemand] = None
71+
72+
withdraw_if_no_route: Optional[bool] = None
73+
"""
74+
Controls whether the BGP prefix is automatically withdrawn when prefix is
75+
withdrawn from Magic routing table (for Magic Transit customers using Direct
76+
CNI)
77+
"""

src/cloudflare/types/addressing/prefixes/bgp_prefix_edit_params.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@ class BGPPrefixEditParams(TypedDict, total=False):
1414
prefix_id: Required[str]
1515
"""Identifier of an IP Prefix."""
1616

17+
asn_prepend_count: int
18+
"""Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute"""
19+
1720
on_demand: OnDemand
1821

22+
withdraw_if_no_route: bool
23+
"""
24+
Controls whether the BGP prefix is automatically withdrawn when prefix is
25+
withdrawn from Magic routing table (for Magic Transit customers using Direct
26+
CNI)
27+
"""
28+
1929

2030
class OnDemand(TypedDict, total=False):
2131
advertised: bool

tests/api_resources/addressing/prefixes/test_bgp_prefixes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
138138
bgp_prefix_id="7009ba364c7a5760798ceb430e603b74",
139139
account_id="258def64c72dae45f3e4c8516e2111f2",
140140
prefix_id="2af39739cc4e3b5910c918468bb89828",
141+
asn_prepend_count=2,
141142
on_demand={"advertised": True},
143+
withdraw_if_no_route=True,
142144
)
143145
assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"])
144146

@@ -377,7 +379,9 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare)
377379
bgp_prefix_id="7009ba364c7a5760798ceb430e603b74",
378380
account_id="258def64c72dae45f3e4c8516e2111f2",
379381
prefix_id="2af39739cc4e3b5910c918468bb89828",
382+
asn_prepend_count=2,
380383
on_demand={"advertised": True},
384+
withdraw_if_no_route=True,
381385
)
382386
assert_matches_type(Optional[BGPPrefix], bgp_prefix, path=["response"])
383387

0 commit comments

Comments
 (0)
0