Skip to content

Commit 68721f4

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat: OpenAPI spec update via Stainless API (#76)
1 parent a1abed6 commit 68721f4

File tree

7 files changed

+147
-32
lines changed

7 files changed

+147
-32
lines changed

api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2370,7 +2370,7 @@ Methods:
23702370
- <code title="post /{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules">client.firewall.access_rules.<a href="./src/cloudflare/resources/firewall/access_rules.py">create</a>(\*, account_id, zone_id, \*\*<a href="src/cloudflare/types/firewall/access_rule_create_params.py">params</a>) -> <a href="./src/cloudflare/types/firewall/access_rule_create_response.py">Optional</a></code>
23712371
- <code title="get /{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules">client.firewall.access_rules.<a href="./src/cloudflare/resources/firewall/access_rules.py">list</a>(\*, account_id, zone_id, \*\*<a href="src/cloudflare/types/firewall/access_rule_list_params.py">params</a>) -> <a href="./src/cloudflare/types/firewall/access_rule_list_response.py">SyncV4PagePaginationArray[object]</a></code>
23722372
- <code title="delete /{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}">client.firewall.access_rules.<a href="./src/cloudflare/resources/firewall/access_rules.py">delete</a>(identifier, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/firewall/access_rule_delete_response.py">Optional</a></code>
2373-
- <code title="patch /{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}">client.firewall.access_rules.<a href="./src/cloudflare/resources/firewall/access_rules.py">edit</a>(identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/firewall/access_rule_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/firewall/access_rule_edit_response.py">Optional</a></code>
2373+
- <code title="patch /{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}">client.firewall.access_rules.<a href="./src/cloudflare/resources/firewall/access_rules.py">edit</a>(identifier, \*, account_id, zone_id, \*\*<a href="src/cloudflare/types/firewall/access_rule_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/firewall/access_rule_edit_response.py">Optional</a></code>
23742374
- <code title="get /{account_or_zone}/{account_or_zone_id}/firewall/access_rules/rules/{identifier}">client.firewall.access_rules.<a href="./src/cloudflare/resources/firewall/access_rules.py">get</a>(identifier, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/firewall/access_rule_get_response.py">Optional</a></code>
23752375

23762376
## UARules
@@ -3660,7 +3660,7 @@ Methods:
36603660

36613661
- <code title="post /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules">client.rulesets.rules.<a href="./src/cloudflare/resources/rulesets/rules.py">create</a>(ruleset_id, \*, account_id, zone_id, \*\*<a href="src/cloudflare/types/rulesets/rule_create_params.py">params</a>) -> <a href="./src/cloudflare/types/rulesets/rule_create_response.py">RuleCreateResponse</a></code>
36623662
- <code title="delete /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}">client.rulesets.rules.<a href="./src/cloudflare/resources/rulesets/rules.py">delete</a>(rule_id, \*, account_id, zone_id, ruleset_id) -> <a href="./src/cloudflare/types/rulesets/rule_delete_response.py">RuleDeleteResponse</a></code>
3663-
- <code title="patch /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}">client.rulesets.rules.<a href="./src/cloudflare/resources/rulesets/rules.py">edit</a>(rule_id, \*, account_id, ruleset_id, \*\*<a href="src/cloudflare/types/rulesets/rule_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/rulesets/rule_edit_response.py">RuleEditResponse</a></code>
3663+
- <code title="patch /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}">client.rulesets.rules.<a href="./src/cloudflare/resources/rulesets/rules.py">edit</a>(rule_id, \*, account_id, zone_id, ruleset_id, \*\*<a href="src/cloudflare/types/rulesets/rule_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/rulesets/rule_edit_response.py">RuleEditResponse</a></code>
36643664

36653665
## Versions
36663666

src/cloudflare/resources/firewall/access_rules.py

+22-4
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ def edit(
239239
self,
240240
identifier: object,
241241
*,
242-
account_identifier: object,
242+
account_id: str,
243+
zone_id: str,
243244
configuration: access_rule_edit_params.Configuration,
244245
mode: Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"],
245246
notes: str | NotGiven = NOT_GIVEN,
@@ -256,6 +257,10 @@ def edit(
256257
Note: This operation will affect all zones in the account.
257258
258259
Args:
260+
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
261+
262+
zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
263+
259264
configuration: The rule configuration.
260265
261266
mode: The action to apply to a matched request.
@@ -270,10 +275,14 @@ def edit(
270275
271276
timeout: Override the client-level default timeout for this request, in seconds
272277
"""
278+
if not account_id:
279+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
280+
if not zone_id:
281+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
273282
return cast(
274283
Optional[AccessRuleEditResponse],
275284
self._patch(
276-
f"/{account_identifier}/{identifier}/firewall/access_rules/rules/:identifier",
285+
f"/{account_id}/{zone_id}/firewall/access_rules/rules/{identifier}",
277286
body=maybe_transform(
278287
{
279288
"configuration": configuration,
@@ -549,7 +558,8 @@ async def edit(
549558
self,
550559
identifier: object,
551560
*,
552-
account_identifier: object,
561+
account_id: str,
562+
zone_id: str,
553563
configuration: access_rule_edit_params.Configuration,
554564
mode: Literal["block", "challenge", "whitelist", "js_challenge", "managed_challenge"],
555565
notes: str | NotGiven = NOT_GIVEN,
@@ -566,6 +576,10 @@ async def edit(
566576
Note: This operation will affect all zones in the account.
567577
568578
Args:
579+
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
580+
581+
zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
582+
569583
configuration: The rule configuration.
570584
571585
mode: The action to apply to a matched request.
@@ -580,10 +594,14 @@ async def edit(
580594
581595
timeout: Override the client-level default timeout for this request, in seconds
582596
"""
597+
if not account_id:
598+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
599+
if not zone_id:
600+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
583601
return cast(
584602
Optional[AccessRuleEditResponse],
585603
await self._patch(
586-
f"/{account_identifier}/{identifier}/firewall/access_rules/rules/:identifier",
604+
f"/{account_id}/{zone_id}/firewall/access_rules/rules/{identifier}",
587605
body=maybe_transform(
588606
{
589607
"configuration": configuration,

src/cloudflare/resources/rulesets/rules.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def edit(
154154
rule_id: str,
155155
*,
156156
account_id: str,
157+
zone_id: str,
157158
ruleset_id: str,
158159
position: rule_edit_params.Position | NotGiven = NOT_GIVEN,
159160
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -167,7 +168,9 @@ def edit(
167168
Updates an existing rule in an account ruleset.
168169
169170
Args:
170-
account_id: The unique ID of the account.
171+
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
172+
173+
zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
171174
172175
ruleset_id: The unique ID of the ruleset.
173176
@@ -185,12 +188,14 @@ def edit(
185188
"""
186189
if not account_id:
187190
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
191+
if not zone_id:
192+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
188193
if not ruleset_id:
189194
raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}")
190195
if not rule_id:
191196
raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}")
192197
return self._patch(
193-
f"/{account_id}/{ruleset_id}/rulesets/{rule_id}/rules/:rule_id",
198+
f"/{account_id}/{zone_id}/rulesets/{ruleset_id}/rules/{rule_id}",
194199
body=maybe_transform({"position": position}, rule_edit_params.RuleEditParams),
195200
options=make_request_options(
196201
extra_headers=extra_headers,
@@ -326,6 +331,7 @@ async def edit(
326331
rule_id: str,
327332
*,
328333
account_id: str,
334+
zone_id: str,
329335
ruleset_id: str,
330336
position: rule_edit_params.Position | NotGiven = NOT_GIVEN,
331337
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -339,7 +345,9 @@ async def edit(
339345
Updates an existing rule in an account ruleset.
340346
341347
Args:
342-
account_id: The unique ID of the account.
348+
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
349+
350+
zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
343351
344352
ruleset_id: The unique ID of the ruleset.
345353
@@ -357,12 +365,14 @@ async def edit(
357365
"""
358366
if not account_id:
359367
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
368+
if not zone_id:
369+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
360370
if not ruleset_id:
361371
raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}")
362372
if not rule_id:
363373
raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}")
364374
return await self._patch(
365-
f"/{account_id}/{ruleset_id}/rulesets/{rule_id}/rules/:rule_id",
375+
f"/{account_id}/{zone_id}/rulesets/{ruleset_id}/rules/{rule_id}",
366376
body=maybe_transform({"position": position}, rule_edit_params.RuleEditParams),
367377
options=make_request_options(
368378
extra_headers=extra_headers,

src/cloudflare/types/firewall/access_rule_edit_params.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717

1818

1919
class AccessRuleEditParams(TypedDict, total=False):
20-
account_identifier: Required[object]
20+
account_id: Required[str]
21+
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
22+
23+
zone_id: Required[str]
24+
"""The Zone ID to use for this endpoint. Mutually exclusive with the Account ID."""
2125

2226
configuration: Required[Configuration]
2327
"""The rule configuration."""

src/cloudflare/types/rulesets/rule_edit_params.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
class RuleEditParams(TypedDict, total=False):
1212
account_id: Required[str]
13-
"""The unique ID of the account."""
13+
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
14+
15+
zone_id: Required[str]
16+
"""The Zone ID to use for this endpoint. Mutually exclusive with the Account ID."""
1417

1518
ruleset_id: Required[str]
1619
"""The unique ID of the ruleset."""

tests/api_resources/firewall/test_access_rules.py

+58-8
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ def test_path_params_delete(self, client: Cloudflare) -> None:
240240
def test_method_edit(self, client: Cloudflare) -> None:
241241
access_rule = client.firewall.access_rules.edit(
242242
{},
243-
account_identifier={},
243+
account_id="string",
244+
zone_id="string",
244245
configuration={},
245246
mode="challenge",
246247
)
@@ -251,7 +252,8 @@ def test_method_edit(self, client: Cloudflare) -> None:
251252
def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
252253
access_rule = client.firewall.access_rules.edit(
253254
{},
254-
account_identifier={},
255+
account_id="string",
256+
zone_id="string",
255257
configuration={
256258
"target": "ip",
257259
"value": "198.51.100.4",
@@ -266,7 +268,8 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
266268
def test_raw_response_edit(self, client: Cloudflare) -> None:
267269
response = client.firewall.access_rules.with_raw_response.edit(
268270
{},
269-
account_identifier={},
271+
account_id="string",
272+
zone_id="string",
270273
configuration={},
271274
mode="challenge",
272275
)
@@ -281,7 +284,8 @@ def test_raw_response_edit(self, client: Cloudflare) -> None:
281284
def test_streaming_response_edit(self, client: Cloudflare) -> None:
282285
with client.firewall.access_rules.with_streaming_response.edit(
283286
{},
284-
account_identifier={},
287+
account_id="string",
288+
zone_id="string",
285289
configuration={},
286290
mode="challenge",
287291
) as response:
@@ -293,6 +297,27 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None:
293297

294298
assert cast(Any, response.is_closed) is True
295299

300+
@pytest.mark.skip()
301+
@parametrize
302+
def test_path_params_edit(self, client: Cloudflare) -> None:
303+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
304+
client.firewall.access_rules.with_raw_response.edit(
305+
{},
306+
account_id="",
307+
zone_id="string",
308+
configuration={},
309+
mode="challenge",
310+
)
311+
312+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
313+
client.firewall.access_rules.with_raw_response.edit(
314+
{},
315+
account_id="string",
316+
zone_id="",
317+
configuration={},
318+
mode="challenge",
319+
)
320+
296321
@pytest.mark.skip()
297322
@parametrize
298323
def test_method_get(self, client: Cloudflare) -> None:
@@ -571,7 +596,8 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
571596
async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
572597
access_rule = await async_client.firewall.access_rules.edit(
573598
{},
574-
account_identifier={},
599+
account_id="string",
600+
zone_id="string",
575601
configuration={},
576602
mode="challenge",
577603
)
@@ -582,7 +608,8 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
582608
async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None:
583609
access_rule = await async_client.firewall.access_rules.edit(
584610
{},
585-
account_identifier={},
611+
account_id="string",
612+
zone_id="string",
586613
configuration={
587614
"target": "ip",
588615
"value": "198.51.100.4",
@@ -597,7 +624,8 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare)
597624
async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
598625
response = await async_client.firewall.access_rules.with_raw_response.edit(
599626
{},
600-
account_identifier={},
627+
account_id="string",
628+
zone_id="string",
601629
configuration={},
602630
mode="challenge",
603631
)
@@ -612,7 +640,8 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
612640
async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
613641
async with async_client.firewall.access_rules.with_streaming_response.edit(
614642
{},
615-
account_identifier={},
643+
account_id="string",
644+
zone_id="string",
616645
configuration={},
617646
mode="challenge",
618647
) as response:
@@ -624,6 +653,27 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N
624653

625654
assert cast(Any, response.is_closed) is True
626655

656+
@pytest.mark.skip()
657+
@parametrize
658+
async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None:
659+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
660+
await async_client.firewall.access_rules.with_raw_response.edit(
661+
{},
662+
account_id="",
663+
zone_id="string",
664+
configuration={},
665+
mode="challenge",
666+
)
667+
668+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
669+
await async_client.firewall.access_rules.with_raw_response.edit(
670+
{},
671+
account_id="string",
672+
zone_id="",
673+
configuration={},
674+
mode="challenge",
675+
)
676+
627677
@pytest.mark.skip()
628678
@parametrize
629679
async def test_method_get(self, async_client: AsyncCloudflare) -> None:

0 commit comments

Comments
 (0)