Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6bae2c2

Browse files
committedMar 14, 2025·
feat(api): api update (#2534)
1 parent 591c3a4 commit 6bae2c2

File tree

14 files changed

+83
-583
lines changed

14 files changed

+83
-583
lines changed
 

‎.stats.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 1610
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8ed21394026c60d07e8c553e5422efda783d7879400d5ae67dc7e646e3fd9b2d.yml
1+
configured_endpoints: 1608
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c783ff4859e993bc421f709c3334be3d24de77db096fd6e2fbc611347568335d.yml

‎api.md

+2-19
Original file line numberDiff line numberDiff line change
@@ -8377,35 +8377,18 @@ Methods:
83778377

83788378
## Scans
83798379

8380-
### Results
8381-
8382-
Types:
8383-
8384-
```python
8385-
from cloudflare.types.cloudforce_one.scans import ScanResult, ResultListResponse
8386-
```
8387-
8388-
Methods:
8389-
8390-
- <code title="get /accounts/{account_id}/cloudforce-one/scans/results">client.cloudforce_one.scans.results.<a href="./src/cloudflare/resources/cloudforce_one/scans/results.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/cloudforce_one/scans/result_list_response.py">ResultListResponse</a></code>
8391-
83928380
### Config
83938381

83948382
Types:
83958383

83968384
```python
8397-
from cloudflare.types.cloudforce_one.scans import (
8398-
ConfigCreateResponse,
8399-
ConfigListResponse,
8400-
ConfigDeleteResponse,
8401-
)
8385+
from cloudflare.types.cloudforce_one.scans import ConfigCreateResponse, ConfigListResponse
84028386
```
84038387

84048388
Methods:
84058389

84068390
- <code title="post /accounts/{account_id}/cloudforce-one/scans/config">client.cloudforce_one.scans.config.<a href="./src/cloudflare/resources/cloudforce_one/scans/config.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/cloudforce_one/scans/config_create_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/scans/config_create_response.py">Optional[ConfigCreateResponse]</a></code>
8407-
- <code title="get /accounts/{account_id}/cloudforce-one/scans/config">client.cloudforce_one.scans.config.<a href="./src/cloudflare/resources/cloudforce_one/scans/config.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/cloudforce_one/scans/config_list_response.py">Optional[ConfigListResponse]</a></code>
8408-
- <code title="delete /accounts/{account_id}/cloudforce-one/scans/config">client.cloudforce_one.scans.config.<a href="./src/cloudflare/resources/cloudforce_one/scans/config.py">delete</a>(\*, account_id) -> <a href="./src/cloudflare/types/cloudforce_one/scans/config_delete_response.py">object</a></code>
8391+
- <code title="get /accounts/{account_id}/cloudforce-one/scans/config">client.cloudforce_one.scans.config.<a href="./src/cloudflare/resources/cloudforce_one/scans/config.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/cloudforce_one/scans/config_list_response.py">SyncSinglePage[ConfigListResponse]</a></code>
84098392

84108393
## Requests
84118394

‎src/cloudflare/resources/cloudforce_one/scans/__init__.py

-14
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,8 @@
1616
ConfigResourceWithStreamingResponse,
1717
AsyncConfigResourceWithStreamingResponse,
1818
)
19-
from .results import (
20-
ResultsResource,
21-
AsyncResultsResource,
22-
ResultsResourceWithRawResponse,
23-
AsyncResultsResourceWithRawResponse,
24-
ResultsResourceWithStreamingResponse,
25-
AsyncResultsResourceWithStreamingResponse,
26-
)
2719

2820
__all__ = [
29-
"ResultsResource",
30-
"AsyncResultsResource",
31-
"ResultsResourceWithRawResponse",
32-
"AsyncResultsResourceWithRawResponse",
33-
"ResultsResourceWithStreamingResponse",
34-
"AsyncResultsResourceWithStreamingResponse",
3521
"ConfigResource",
3622
"AsyncConfigResource",
3723
"ConfigResourceWithRawResponse",

‎src/cloudflare/resources/cloudforce_one/scans/config.py

+33-116
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
async_to_streamed_response_wrapper,
2121
)
2222
from ...._wrappers import ResultWrapper
23-
from ...._base_client import make_request_options
23+
from ....pagination import SyncSinglePage, AsyncSinglePage
24+
from ...._base_client import AsyncPaginator, make_request_options
2425
from ....types.cloudforce_one.scans import config_create_params
2526
from ....types.cloudforce_one.scans.config_list_response import ConfigListResponse
2627
from ....types.cloudforce_one.scans.config_create_response import ConfigCreateResponse
@@ -52,8 +53,9 @@ def create(
5253
self,
5354
*,
5455
account_id: str,
55-
frequency: float,
5656
ips: List[str],
57+
frequency: float | NotGiven = NOT_GIVEN,
58+
ports: List[str] | NotGiven = NOT_GIVEN,
5759
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5860
# The extra values given here take precedence over values defined on the client or passed to this method.
5961
extra_headers: Headers | None = None,
@@ -67,11 +69,15 @@ def create(
6769
Args:
6870
account_id: Account ID
6971
70-
frequency: The number of days between each scan (0 = no recurring scans)
71-
7272
ips: A list of IP addresses or CIDR blocks to scan. The maximum number of total IP
7373
addresses allowed is 5000.
7474
75+
frequency: The number of days between each scan (0 = no recurring scans).
76+
77+
ports: A list of ports to scan. Allowed values:"default", "all", or a comma-separated
78+
list of ports or range of ports (e.g. ["1-80", "443"]). Default will scan the
79+
100 most commonly open ports.
80+
7581
extra_headers: Send extra headers
7682
7783
extra_query: Add additional query parameters to the request
@@ -86,8 +92,9 @@ def create(
8692
f"/accounts/{account_id}/cloudforce-one/scans/config",
8793
body=maybe_transform(
8894
{
89-
"frequency": frequency,
9095
"ips": ips,
96+
"frequency": frequency,
97+
"ports": ports,
9198
},
9299
config_create_params.ConfigCreateParams,
93100
),
@@ -111,7 +118,7 @@ def list(
111118
extra_query: Query | None = None,
112119
extra_body: Body | None = None,
113120
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
114-
) -> Optional[ConfigListResponse]:
121+
) -> SyncSinglePage[ConfigListResponse]:
115122
"""
116123
Get the Scan Config for An Account
117124
@@ -128,55 +135,13 @@ def list(
128135
"""
129136
if not account_id:
130137
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
131-
return self._get(
138+
return self._get_api_list(
132139
f"/accounts/{account_id}/cloudforce-one/scans/config",
140+
page=SyncSinglePage[ConfigListResponse],
133141
options=make_request_options(
134-
extra_headers=extra_headers,
135-
extra_query=extra_query,
136-
extra_body=extra_body,
137-
timeout=timeout,
138-
post_parser=ResultWrapper[Optional[ConfigListResponse]]._unwrapper,
142+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
139143
),
140-
cast_to=cast(Type[Optional[ConfigListResponse]], ResultWrapper[ConfigListResponse]),
141-
)
142-
143-
def delete(
144-
self,
145-
*,
146-
account_id: str,
147-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
148-
# The extra values given here take precedence over values defined on the client or passed to this method.
149-
extra_headers: Headers | None = None,
150-
extra_query: Query | None = None,
151-
extra_body: Body | None = None,
152-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
153-
) -> object:
154-
"""
155-
Delete the Scan Config for an Account
156-
157-
Args:
158-
account_id: Account ID
159-
160-
extra_headers: Send extra headers
161-
162-
extra_query: Add additional query parameters to the request
163-
164-
extra_body: Add additional JSON properties to the request
165-
166-
timeout: Override the client-level default timeout for this request, in seconds
167-
"""
168-
if not account_id:
169-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
170-
return self._delete(
171-
f"/accounts/{account_id}/cloudforce-one/scans/config",
172-
options=make_request_options(
173-
extra_headers=extra_headers,
174-
extra_query=extra_query,
175-
extra_body=extra_body,
176-
timeout=timeout,
177-
post_parser=ResultWrapper[object]._unwrapper,
178-
),
179-
cast_to=cast(Type[object], ResultWrapper[object]),
144+
model=ConfigListResponse,
180145
)
181146

182147

@@ -204,8 +169,9 @@ async def create(
204169
self,
205170
*,
206171
account_id: str,
207-
frequency: float,
208172
ips: List[str],
173+
frequency: float | NotGiven = NOT_GIVEN,
174+
ports: List[str] | NotGiven = NOT_GIVEN,
209175
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
210176
# The extra values given here take precedence over values defined on the client or passed to this method.
211177
extra_headers: Headers | None = None,
@@ -219,11 +185,15 @@ async def create(
219185
Args:
220186
account_id: Account ID
221187
222-
frequency: The number of days between each scan (0 = no recurring scans)
223-
224188
ips: A list of IP addresses or CIDR blocks to scan. The maximum number of total IP
225189
addresses allowed is 5000.
226190
191+
frequency: The number of days between each scan (0 = no recurring scans).
192+
193+
ports: A list of ports to scan. Allowed values:"default", "all", or a comma-separated
194+
list of ports or range of ports (e.g. ["1-80", "443"]). Default will scan the
195+
100 most commonly open ports.
196+
227197
extra_headers: Send extra headers
228198
229199
extra_query: Add additional query parameters to the request
@@ -238,8 +208,9 @@ async def create(
238208
f"/accounts/{account_id}/cloudforce-one/scans/config",
239209
body=await async_maybe_transform(
240210
{
241-
"frequency": frequency,
242211
"ips": ips,
212+
"frequency": frequency,
213+
"ports": ports,
243214
},
244215
config_create_params.ConfigCreateParams,
245216
),
@@ -253,7 +224,7 @@ async def create(
253224
cast_to=cast(Type[Optional[ConfigCreateResponse]], ResultWrapper[ConfigCreateResponse]),
254225
)
255226

256-
async def list(
227+
def list(
257228
self,
258229
*,
259230
account_id: str,
@@ -263,7 +234,7 @@ async def list(
263234
extra_query: Query | None = None,
264235
extra_body: Body | None = None,
265236
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
266-
) -> Optional[ConfigListResponse]:
237+
) -> AsyncPaginator[ConfigListResponse, AsyncSinglePage[ConfigListResponse]]:
267238
"""
268239
Get the Scan Config for An Account
269240
@@ -280,55 +251,13 @@ async def list(
280251
"""
281252
if not account_id:
282253
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
283-
return await self._get(
284-
f"/accounts/{account_id}/cloudforce-one/scans/config",
285-
options=make_request_options(
286-
extra_headers=extra_headers,
287-
extra_query=extra_query,
288-
extra_body=extra_body,
289-
timeout=timeout,
290-
post_parser=ResultWrapper[Optional[ConfigListResponse]]._unwrapper,
291-
),
292-
cast_to=cast(Type[Optional[ConfigListResponse]], ResultWrapper[ConfigListResponse]),
293-
)
294-
295-
async def delete(
296-
self,
297-
*,
298-
account_id: str,
299-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
300-
# The extra values given here take precedence over values defined on the client or passed to this method.
301-
extra_headers: Headers | None = None,
302-
extra_query: Query | None = None,
303-
extra_body: Body | None = None,
304-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
305-
) -> object:
306-
"""
307-
Delete the Scan Config for an Account
308-
309-
Args:
310-
account_id: Account ID
311-
312-
extra_headers: Send extra headers
313-
314-
extra_query: Add additional query parameters to the request
315-
316-
extra_body: Add additional JSON properties to the request
317-
318-
timeout: Override the client-level default timeout for this request, in seconds
319-
"""
320-
if not account_id:
321-
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
322-
return await self._delete(
254+
return self._get_api_list(
323255
f"/accounts/{account_id}/cloudforce-one/scans/config",
256+
page=AsyncSinglePage[ConfigListResponse],
324257
options=make_request_options(
325-
extra_headers=extra_headers,
326-
extra_query=extra_query,
327-
extra_body=extra_body,
328-
timeout=timeout,
329-
post_parser=ResultWrapper[object]._unwrapper,
258+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
330259
),
331-
cast_to=cast(Type[object], ResultWrapper[object]),
260+
model=ConfigListResponse,
332261
)
333262

334263

@@ -342,9 +271,6 @@ def __init__(self, config: ConfigResource) -> None:
342271
self.list = to_raw_response_wrapper(
343272
config.list,
344273
)
345-
self.delete = to_raw_response_wrapper(
346-
config.delete,
347-
)
348274

349275

350276
class AsyncConfigResourceWithRawResponse:
@@ -357,9 +283,6 @@ def __init__(self, config: AsyncConfigResource) -> None:
357283
self.list = async_to_raw_response_wrapper(
358284
config.list,
359285
)
360-
self.delete = async_to_raw_response_wrapper(
361-
config.delete,
362-
)
363286

364287

365288
class ConfigResourceWithStreamingResponse:
@@ -372,9 +295,6 @@ def __init__(self, config: ConfigResource) -> None:
372295
self.list = to_streamed_response_wrapper(
373296
config.list,
374297
)
375-
self.delete = to_streamed_response_wrapper(
376-
config.delete,
377-
)
378298

379299

380300
class AsyncConfigResourceWithStreamingResponse:
@@ -387,6 +307,3 @@ def __init__(self, config: AsyncConfigResource) -> None:
387307
self.list = async_to_streamed_response_wrapper(
388308
config.list,
389309
)
390-
self.delete = async_to_streamed_response_wrapper(
391-
config.delete,
392-
)

‎src/cloudflare/resources/cloudforce_one/scans/results.py

-178
This file was deleted.

‎src/cloudflare/resources/cloudforce_one/scans/scans.py

-32
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,13 @@
1010
ConfigResourceWithStreamingResponse,
1111
AsyncConfigResourceWithStreamingResponse,
1212
)
13-
from .results import (
14-
ResultsResource,
15-
AsyncResultsResource,
16-
ResultsResourceWithRawResponse,
17-
AsyncResultsResourceWithRawResponse,
18-
ResultsResourceWithStreamingResponse,
19-
AsyncResultsResourceWithStreamingResponse,
20-
)
2113
from ...._compat import cached_property
2214
from ...._resource import SyncAPIResource, AsyncAPIResource
2315

2416
__all__ = ["ScansResource", "AsyncScansResource"]
2517

2618

2719
class ScansResource(SyncAPIResource):
28-
@cached_property
29-
def results(self) -> ResultsResource:
30-
return ResultsResource(self._client)
31-
3220
@cached_property
3321
def config(self) -> ConfigResource:
3422
return ConfigResource(self._client)
@@ -54,10 +42,6 @@ def with_streaming_response(self) -> ScansResourceWithStreamingResponse:
5442

5543

5644
class AsyncScansResource(AsyncAPIResource):
57-
@cached_property
58-
def results(self) -> AsyncResultsResource:
59-
return AsyncResultsResource(self._client)
60-
6145
@cached_property
6246
def config(self) -> AsyncConfigResource:
6347
return AsyncConfigResource(self._client)
@@ -86,10 +70,6 @@ class ScansResourceWithRawResponse:
8670
def __init__(self, scans: ScansResource) -> None:
8771
self._scans = scans
8872

89-
@cached_property
90-
def results(self) -> ResultsResourceWithRawResponse:
91-
return ResultsResourceWithRawResponse(self._scans.results)
92-
9373
@cached_property
9474
def config(self) -> ConfigResourceWithRawResponse:
9575
return ConfigResourceWithRawResponse(self._scans.config)
@@ -99,10 +79,6 @@ class AsyncScansResourceWithRawResponse:
9979
def __init__(self, scans: AsyncScansResource) -> None:
10080
self._scans = scans
10181

102-
@cached_property
103-
def results(self) -> AsyncResultsResourceWithRawResponse:
104-
return AsyncResultsResourceWithRawResponse(self._scans.results)
105-
10682
@cached_property
10783
def config(self) -> AsyncConfigResourceWithRawResponse:
10884
return AsyncConfigResourceWithRawResponse(self._scans.config)
@@ -112,10 +88,6 @@ class ScansResourceWithStreamingResponse:
11288
def __init__(self, scans: ScansResource) -> None:
11389
self._scans = scans
11490

115-
@cached_property
116-
def results(self) -> ResultsResourceWithStreamingResponse:
117-
return ResultsResourceWithStreamingResponse(self._scans.results)
118-
11991
@cached_property
12092
def config(self) -> ConfigResourceWithStreamingResponse:
12193
return ConfigResourceWithStreamingResponse(self._scans.config)
@@ -125,10 +97,6 @@ class AsyncScansResourceWithStreamingResponse:
12597
def __init__(self, scans: AsyncScansResource) -> None:
12698
self._scans = scans
12799

128-
@cached_property
129-
def results(self) -> AsyncResultsResourceWithStreamingResponse:
130-
return AsyncResultsResourceWithStreamingResponse(self._scans.results)
131-
132100
@cached_property
133101
def config(self) -> AsyncConfigResourceWithStreamingResponse:
134102
return AsyncConfigResourceWithStreamingResponse(self._scans.config)

‎src/cloudflare/types/cloudforce_one/scans/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from __future__ import annotations
44

5-
from .scan_result import ScanResult as ScanResult
65
from .config_create_params import ConfigCreateParams as ConfigCreateParams
76
from .config_list_response import ConfigListResponse as ConfigListResponse
8-
from .result_list_response import ResultListResponse as ResultListResponse
97
from .config_create_response import ConfigCreateResponse as ConfigCreateResponse

‎src/cloudflare/types/cloudforce_one/scans/config_create_params.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@ class ConfigCreateParams(TypedDict, total=False):
1212
account_id: Required[str]
1313
"""Account ID"""
1414

15-
frequency: Required[float]
16-
"""The number of days between each scan (0 = no recurring scans)"""
17-
1815
ips: Required[List[str]]
1916
"""A list of IP addresses or CIDR blocks to scan.
2017
2118
The maximum number of total IP addresses allowed is 5000.
2219
"""
20+
21+
frequency: float
22+
"""The number of days between each scan (0 = no recurring scans)."""
23+
24+
ports: List[str]
25+
"""A list of ports to scan.
26+
27+
Allowed values:"default", "all", or a comma-separated list of ports or range of
28+
ports (e.g. ["1-80", "443"]). Default will scan the 100 most commonly open
29+
ports.
30+
"""

‎src/cloudflare/types/cloudforce_one/scans/config_create_response.py

+4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88

99

1010
class ConfigCreateResponse(BaseModel):
11+
id: str
12+
1113
account_id: str
1214

1315
frequency: float
1416

1517
ips: List[str]
18+
19+
ports: List[str]

‎src/cloudflare/types/cloudforce_one/scans/config_list_response.py

+4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88

99

1010
class ConfigListResponse(BaseModel):
11+
id: str
12+
1113
account_id: str
1214

1315
frequency: float
1416

1517
ips: List[str]
18+
19+
ports: List[str]

‎src/cloudflare/types/cloudforce_one/scans/result_list_response.py

-14
This file was deleted.

‎src/cloudflare/types/cloudforce_one/scans/scan_result.py

-15
This file was deleted.

‎tests/api_resources/cloudforce_one/scans/test_config.py

+27-90
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.pagination import SyncSinglePage, AsyncSinglePage
1213
from cloudflare.types.cloudforce_one.scans import ConfigListResponse, ConfigCreateResponse
1314

1415
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -21,16 +22,24 @@ class TestConfig:
2122
def test_method_create(self, client: Cloudflare) -> None:
2223
config = client.cloudforce_one.scans.config.create(
2324
account_id="account_id",
24-
frequency=7,
2525
ips=["1.1.1.1"],
2626
)
2727
assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"])
2828

29+
@parametrize
30+
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
31+
config = client.cloudforce_one.scans.config.create(
32+
account_id="account_id",
33+
ips=["1.1.1.1"],
34+
frequency=7,
35+
ports=["default"],
36+
)
37+
assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"])
38+
2939
@parametrize
3040
def test_raw_response_create(self, client: Cloudflare) -> None:
3141
response = client.cloudforce_one.scans.config.with_raw_response.create(
3242
account_id="account_id",
33-
frequency=7,
3443
ips=["1.1.1.1"],
3544
)
3645

@@ -43,7 +52,6 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
4352
def test_streaming_response_create(self, client: Cloudflare) -> None:
4453
with client.cloudforce_one.scans.config.with_streaming_response.create(
4554
account_id="account_id",
46-
frequency=7,
4755
ips=["1.1.1.1"],
4856
) as response:
4957
assert not response.is_closed
@@ -59,7 +67,6 @@ def test_path_params_create(self, client: Cloudflare) -> None:
5967
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
6068
client.cloudforce_one.scans.config.with_raw_response.create(
6169
account_id="",
62-
frequency=7,
6370
ips=["1.1.1.1"],
6471
)
6572

@@ -68,7 +75,7 @@ def test_method_list(self, client: Cloudflare) -> None:
6875
config = client.cloudforce_one.scans.config.list(
6976
account_id="account_id",
7077
)
71-
assert_matches_type(Optional[ConfigListResponse], config, path=["response"])
78+
assert_matches_type(SyncSinglePage[ConfigListResponse], config, path=["response"])
7279

7380
@parametrize
7481
def test_raw_response_list(self, client: Cloudflare) -> None:
@@ -79,7 +86,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None:
7986
assert response.is_closed is True
8087
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
8188
config = response.parse()
82-
assert_matches_type(Optional[ConfigListResponse], config, path=["response"])
89+
assert_matches_type(SyncSinglePage[ConfigListResponse], config, path=["response"])
8390

8491
@parametrize
8592
def test_streaming_response_list(self, client: Cloudflare) -> None:
@@ -90,7 +97,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None:
9097
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
9198

9299
config = response.parse()
93-
assert_matches_type(Optional[ConfigListResponse], config, path=["response"])
100+
assert_matches_type(SyncSinglePage[ConfigListResponse], config, path=["response"])
94101

95102
assert cast(Any, response.is_closed) is True
96103

@@ -101,44 +108,6 @@ def test_path_params_list(self, client: Cloudflare) -> None:
101108
account_id="",
102109
)
103110

104-
@parametrize
105-
def test_method_delete(self, client: Cloudflare) -> None:
106-
config = client.cloudforce_one.scans.config.delete(
107-
account_id="account_id",
108-
)
109-
assert_matches_type(object, config, path=["response"])
110-
111-
@parametrize
112-
def test_raw_response_delete(self, client: Cloudflare) -> None:
113-
response = client.cloudforce_one.scans.config.with_raw_response.delete(
114-
account_id="account_id",
115-
)
116-
117-
assert response.is_closed is True
118-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
119-
config = response.parse()
120-
assert_matches_type(object, config, path=["response"])
121-
122-
@parametrize
123-
def test_streaming_response_delete(self, client: Cloudflare) -> None:
124-
with client.cloudforce_one.scans.config.with_streaming_response.delete(
125-
account_id="account_id",
126-
) as response:
127-
assert not response.is_closed
128-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
129-
130-
config = response.parse()
131-
assert_matches_type(object, config, path=["response"])
132-
133-
assert cast(Any, response.is_closed) is True
134-
135-
@parametrize
136-
def test_path_params_delete(self, client: Cloudflare) -> None:
137-
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
138-
client.cloudforce_one.scans.config.with_raw_response.delete(
139-
account_id="",
140-
)
141-
142111

143112
class TestAsyncConfig:
144113
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -147,16 +116,24 @@ class TestAsyncConfig:
147116
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
148117
config = await async_client.cloudforce_one.scans.config.create(
149118
account_id="account_id",
150-
frequency=7,
151119
ips=["1.1.1.1"],
152120
)
153121
assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"])
154122

123+
@parametrize
124+
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
125+
config = await async_client.cloudforce_one.scans.config.create(
126+
account_id="account_id",
127+
ips=["1.1.1.1"],
128+
frequency=7,
129+
ports=["default"],
130+
)
131+
assert_matches_type(Optional[ConfigCreateResponse], config, path=["response"])
132+
155133
@parametrize
156134
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
157135
response = await async_client.cloudforce_one.scans.config.with_raw_response.create(
158136
account_id="account_id",
159-
frequency=7,
160137
ips=["1.1.1.1"],
161138
)
162139

@@ -169,7 +146,6 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
169146
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
170147
async with async_client.cloudforce_one.scans.config.with_streaming_response.create(
171148
account_id="account_id",
172-
frequency=7,
173149
ips=["1.1.1.1"],
174150
) as response:
175151
assert not response.is_closed
@@ -185,7 +161,6 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
185161
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
186162
await async_client.cloudforce_one.scans.config.with_raw_response.create(
187163
account_id="",
188-
frequency=7,
189164
ips=["1.1.1.1"],
190165
)
191166

@@ -194,7 +169,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
194169
config = await async_client.cloudforce_one.scans.config.list(
195170
account_id="account_id",
196171
)
197-
assert_matches_type(Optional[ConfigListResponse], config, path=["response"])
172+
assert_matches_type(AsyncSinglePage[ConfigListResponse], config, path=["response"])
198173

199174
@parametrize
200175
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
@@ -205,7 +180,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
205180
assert response.is_closed is True
206181
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
207182
config = await response.parse()
208-
assert_matches_type(Optional[ConfigListResponse], config, path=["response"])
183+
assert_matches_type(AsyncSinglePage[ConfigListResponse], config, path=["response"])
209184

210185
@parametrize
211186
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
@@ -216,7 +191,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N
216191
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
217192

218193
config = await response.parse()
219-
assert_matches_type(Optional[ConfigListResponse], config, path=["response"])
194+
assert_matches_type(AsyncSinglePage[ConfigListResponse], config, path=["response"])
220195

221196
assert cast(Any, response.is_closed) is True
222197

@@ -226,41 +201,3 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
226201
await async_client.cloudforce_one.scans.config.with_raw_response.list(
227202
account_id="",
228203
)
229-
230-
@parametrize
231-
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
232-
config = await async_client.cloudforce_one.scans.config.delete(
233-
account_id="account_id",
234-
)
235-
assert_matches_type(object, config, path=["response"])
236-
237-
@parametrize
238-
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
239-
response = await async_client.cloudforce_one.scans.config.with_raw_response.delete(
240-
account_id="account_id",
241-
)
242-
243-
assert response.is_closed is True
244-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
245-
config = await response.parse()
246-
assert_matches_type(object, config, path=["response"])
247-
248-
@parametrize
249-
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
250-
async with async_client.cloudforce_one.scans.config.with_streaming_response.delete(
251-
account_id="account_id",
252-
) as response:
253-
assert not response.is_closed
254-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
255-
256-
config = await response.parse()
257-
assert_matches_type(object, config, path=["response"])
258-
259-
assert cast(Any, response.is_closed) is True
260-
261-
@parametrize
262-
async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
263-
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
264-
await async_client.cloudforce_one.scans.config.with_raw_response.delete(
265-
account_id="",
266-
)

‎tests/api_resources/cloudforce_one/scans/test_results.py

-98
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.