Skip to content

Commit 5c94245

Browse files
feat(api): api update (#2131)
1 parent 0e8799f commit 5c94245

File tree

4 files changed

+29
-79
lines changed

4 files changed

+29
-79
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1397
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a139ab241e810768035bd12ba862cd60f33591339da49b4fb8bccb36e012802c.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cedc346a76dfdf50768c01a48e573dfaeddfe35be8910188d42fe3c5afaaa5bb.yml
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Union
3+
from typing import List, Union
44
from typing_extensions import TypeAlias
55

66
from .lockdown_ip_configuration import LockdownIPConfiguration
77
from .lockdown_cidr_configuration import LockdownCIDRConfiguration
88

9-
__all__ = ["Configuration"]
9+
__all__ = ["Configuration", "ConfigurationItem"]
1010

11-
Configuration: TypeAlias = Union[LockdownIPConfiguration, LockdownCIDRConfiguration]
11+
ConfigurationItem: TypeAlias = Union[LockdownIPConfiguration, LockdownCIDRConfiguration]
12+
13+
Configuration: TypeAlias = List[ConfigurationItem]

src/cloudflare/types/firewall/configuration_param.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import List, Union
66
from typing_extensions import TypeAlias
77

88
from .lockdown_ip_configuration_param import LockdownIPConfigurationParam
99
from .lockdown_cidr_configuration_param import LockdownCIDRConfigurationParam
1010

11-
__all__ = ["ConfigurationParam"]
11+
__all__ = ["ConfigurationParam", "ConfigurationParamItem"]
1212

13-
ConfigurationParam: TypeAlias = Union[LockdownIPConfigurationParam, LockdownCIDRConfigurationParam]
13+
ConfigurationParamItem: TypeAlias = Union[LockdownIPConfigurationParam, LockdownCIDRConfigurationParam]
14+
15+
ConfigurationParam: TypeAlias = List[ConfigurationParamItem]

tests/api_resources/firewall/test_lockdowns.py

+18-72
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,7 @@ class TestLockdowns:
2727
def test_method_create(self, client: Cloudflare) -> None:
2828
lockdown = client.firewall.lockdowns.create(
2929
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
30-
configurations={},
31-
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
32-
)
33-
assert_matches_type(Lockdown, lockdown, path=["response"])
34-
35-
@pytest.mark.skip(reason="TODO: investigate broken test")
36-
@parametrize
37-
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
38-
lockdown = client.firewall.lockdowns.create(
39-
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
40-
configurations={
41-
"target": "ip",
42-
"value": "198.51.100.4",
43-
},
30+
configurations=[{}, {}, {}],
4431
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
4532
)
4633
assert_matches_type(Lockdown, lockdown, path=["response"])
@@ -50,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
5037
def test_raw_response_create(self, client: Cloudflare) -> None:
5138
response = client.firewall.lockdowns.with_raw_response.create(
5239
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
53-
configurations={},
40+
configurations=[{}, {}, {}],
5441
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
5542
)
5643

@@ -64,7 +51,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
6451
def test_streaming_response_create(self, client: Cloudflare) -> None:
6552
with client.firewall.lockdowns.with_streaming_response.create(
6653
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
67-
configurations={},
54+
configurations=[{}, {}, {}],
6855
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
6956
) as response:
7057
assert not response.is_closed
@@ -81,7 +68,7 @@ def test_path_params_create(self, client: Cloudflare) -> None:
8168
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
8269
client.firewall.lockdowns.with_raw_response.create(
8370
zone_id="",
84-
configurations={},
71+
configurations=[{}, {}, {}],
8572
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
8673
)
8774

@@ -91,21 +78,7 @@ def test_method_update(self, client: Cloudflare) -> None:
9178
lockdown = client.firewall.lockdowns.update(
9279
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
9380
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
94-
configurations={},
95-
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
96-
)
97-
assert_matches_type(Lockdown, lockdown, path=["response"])
98-
99-
@pytest.mark.skip(reason="TODO: investigate broken test")
100-
@parametrize
101-
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
102-
lockdown = client.firewall.lockdowns.update(
103-
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
104-
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
105-
configurations={
106-
"target": "ip",
107-
"value": "198.51.100.4",
108-
},
81+
configurations=[{}, {}, {}],
10982
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
11083
)
11184
assert_matches_type(Lockdown, lockdown, path=["response"])
@@ -116,7 +89,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None:
11689
response = client.firewall.lockdowns.with_raw_response.update(
11790
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
11891
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
119-
configurations={},
92+
configurations=[{}, {}, {}],
12093
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
12194
)
12295

@@ -131,7 +104,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None:
131104
with client.firewall.lockdowns.with_streaming_response.update(
132105
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
133106
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
134-
configurations={},
107+
configurations=[{}, {}, {}],
135108
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
136109
) as response:
137110
assert not response.is_closed
@@ -149,15 +122,15 @@ def test_path_params_update(self, client: Cloudflare) -> None:
149122
client.firewall.lockdowns.with_raw_response.update(
150123
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
151124
zone_id="",
152-
configurations={},
125+
configurations=[{}, {}, {}],
153126
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
154127
)
155128

156129
with pytest.raises(ValueError, match=r"Expected a non-empty value for `lock_downs_id` but received ''"):
157130
client.firewall.lockdowns.with_raw_response.update(
158131
lock_downs_id="",
159132
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
160-
configurations={},
133+
configurations=[{}, {}, {}],
161134
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
162135
)
163136

@@ -322,20 +295,7 @@ class TestAsyncLockdowns:
322295
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
323296
lockdown = await async_client.firewall.lockdowns.create(
324297
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
325-
configurations={},
326-
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
327-
)
328-
assert_matches_type(Lockdown, lockdown, path=["response"])
329-
330-
@pytest.mark.skip(reason="TODO: investigate broken test")
331-
@parametrize
332-
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
333-
lockdown = await async_client.firewall.lockdowns.create(
334-
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
335-
configurations={
336-
"target": "ip",
337-
"value": "198.51.100.4",
338-
},
298+
configurations=[{}, {}, {}],
339299
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
340300
)
341301
assert_matches_type(Lockdown, lockdown, path=["response"])
@@ -345,7 +305,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
345305
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
346306
response = await async_client.firewall.lockdowns.with_raw_response.create(
347307
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
348-
configurations={},
308+
configurations=[{}, {}, {}],
349309
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
350310
)
351311

@@ -359,7 +319,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
359319
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
360320
async with async_client.firewall.lockdowns.with_streaming_response.create(
361321
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
362-
configurations={},
322+
configurations=[{}, {}, {}],
363323
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
364324
) as response:
365325
assert not response.is_closed
@@ -376,7 +336,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
376336
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
377337
await async_client.firewall.lockdowns.with_raw_response.create(
378338
zone_id="",
379-
configurations={},
339+
configurations=[{}, {}, {}],
380340
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
381341
)
382342

@@ -386,21 +346,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
386346
lockdown = await async_client.firewall.lockdowns.update(
387347
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
388348
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
389-
configurations={},
390-
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
391-
)
392-
assert_matches_type(Lockdown, lockdown, path=["response"])
393-
394-
@pytest.mark.skip(reason="TODO: investigate broken test")
395-
@parametrize
396-
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
397-
lockdown = await async_client.firewall.lockdowns.update(
398-
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
399-
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
400-
configurations={
401-
"target": "ip",
402-
"value": "198.51.100.4",
403-
},
349+
configurations=[{}, {}, {}],
404350
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
405351
)
406352
assert_matches_type(Lockdown, lockdown, path=["response"])
@@ -411,7 +357,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
411357
response = await async_client.firewall.lockdowns.with_raw_response.update(
412358
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
413359
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
414-
configurations={},
360+
configurations=[{}, {}, {}],
415361
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
416362
)
417363

@@ -426,7 +372,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) ->
426372
async with async_client.firewall.lockdowns.with_streaming_response.update(
427373
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
428374
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
429-
configurations={},
375+
configurations=[{}, {}, {}],
430376
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
431377
) as response:
432378
assert not response.is_closed
@@ -444,15 +390,15 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
444390
await async_client.firewall.lockdowns.with_raw_response.update(
445391
lock_downs_id="372e67954025e0ba6aaa6d586b9e0b59",
446392
zone_id="",
447-
configurations={},
393+
configurations=[{}, {}, {}],
448394
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
449395
)
450396

451397
with pytest.raises(ValueError, match=r"Expected a non-empty value for `lock_downs_id` but received ''"):
452398
await async_client.firewall.lockdowns.with_raw_response.update(
453399
lock_downs_id="",
454400
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
455-
configurations={},
401+
configurations=[{}, {}, {}],
456402
urls=["shop.example.com/*", "shop.example.com/*", "shop.example.com/*"],
457403
)
458404

0 commit comments

Comments
 (0)