20
20
async_to_streamed_response_wrapper ,
21
21
)
22
22
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
24
25
from ....types .cloudforce_one .scans import config_create_params
25
26
from ....types .cloudforce_one .scans .config_list_response import ConfigListResponse
26
27
from ....types .cloudforce_one .scans .config_create_response import ConfigCreateResponse
@@ -52,8 +53,9 @@ def create(
52
53
self ,
53
54
* ,
54
55
account_id : str ,
55
- frequency : float ,
56
56
ips : List [str ],
57
+ frequency : float | NotGiven = NOT_GIVEN ,
58
+ ports : List [str ] | NotGiven = NOT_GIVEN ,
57
59
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
58
60
# The extra values given here take precedence over values defined on the client or passed to this method.
59
61
extra_headers : Headers | None = None ,
@@ -67,11 +69,15 @@ def create(
67
69
Args:
68
70
account_id: Account ID
69
71
70
- frequency: The number of days between each scan (0 = no recurring scans)
71
-
72
72
ips: A list of IP addresses or CIDR blocks to scan. The maximum number of total IP
73
73
addresses allowed is 5000.
74
74
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
+
75
81
extra_headers: Send extra headers
76
82
77
83
extra_query: Add additional query parameters to the request
@@ -86,8 +92,9 @@ def create(
86
92
f"/accounts/{ account_id } /cloudforce-one/scans/config" ,
87
93
body = maybe_transform (
88
94
{
89
- "frequency" : frequency ,
90
95
"ips" : ips ,
96
+ "frequency" : frequency ,
97
+ "ports" : ports ,
91
98
},
92
99
config_create_params .ConfigCreateParams ,
93
100
),
@@ -111,7 +118,7 @@ def list(
111
118
extra_query : Query | None = None ,
112
119
extra_body : Body | None = None ,
113
120
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
114
- ) -> Optional [ConfigListResponse ]:
121
+ ) -> SyncSinglePage [ConfigListResponse ]:
115
122
"""
116
123
Get the Scan Config for An Account
117
124
@@ -128,55 +135,13 @@ def list(
128
135
"""
129
136
if not account_id :
130
137
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 (
132
139
f"/accounts/{ account_id } /cloudforce-one/scans/config" ,
140
+ page = SyncSinglePage [ConfigListResponse ],
133
141
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
139
143
),
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 ,
180
145
)
181
146
182
147
@@ -204,8 +169,9 @@ async def create(
204
169
self ,
205
170
* ,
206
171
account_id : str ,
207
- frequency : float ,
208
172
ips : List [str ],
173
+ frequency : float | NotGiven = NOT_GIVEN ,
174
+ ports : List [str ] | NotGiven = NOT_GIVEN ,
209
175
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
210
176
# The extra values given here take precedence over values defined on the client or passed to this method.
211
177
extra_headers : Headers | None = None ,
@@ -219,11 +185,15 @@ async def create(
219
185
Args:
220
186
account_id: Account ID
221
187
222
- frequency: The number of days between each scan (0 = no recurring scans)
223
-
224
188
ips: A list of IP addresses or CIDR blocks to scan. The maximum number of total IP
225
189
addresses allowed is 5000.
226
190
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
+
227
197
extra_headers: Send extra headers
228
198
229
199
extra_query: Add additional query parameters to the request
@@ -238,8 +208,9 @@ async def create(
238
208
f"/accounts/{ account_id } /cloudforce-one/scans/config" ,
239
209
body = await async_maybe_transform (
240
210
{
241
- "frequency" : frequency ,
242
211
"ips" : ips ,
212
+ "frequency" : frequency ,
213
+ "ports" : ports ,
243
214
},
244
215
config_create_params .ConfigCreateParams ,
245
216
),
@@ -253,7 +224,7 @@ async def create(
253
224
cast_to = cast (Type [Optional [ConfigCreateResponse ]], ResultWrapper [ConfigCreateResponse ]),
254
225
)
255
226
256
- async def list (
227
+ def list (
257
228
self ,
258
229
* ,
259
230
account_id : str ,
@@ -263,7 +234,7 @@ async def list(
263
234
extra_query : Query | None = None ,
264
235
extra_body : Body | None = None ,
265
236
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
266
- ) -> Optional [ConfigListResponse ]:
237
+ ) -> AsyncPaginator [ConfigListResponse , AsyncSinglePage [ ConfigListResponse ] ]:
267
238
"""
268
239
Get the Scan Config for An Account
269
240
@@ -280,55 +251,13 @@ async def list(
280
251
"""
281
252
if not account_id :
282
253
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 (
323
255
f"/accounts/{ account_id } /cloudforce-one/scans/config" ,
256
+ page = AsyncSinglePage [ConfigListResponse ],
324
257
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
330
259
),
331
- cast_to = cast ( Type [ object ], ResultWrapper [ object ]) ,
260
+ model = ConfigListResponse ,
332
261
)
333
262
334
263
@@ -342,9 +271,6 @@ def __init__(self, config: ConfigResource) -> None:
342
271
self .list = to_raw_response_wrapper (
343
272
config .list ,
344
273
)
345
- self .delete = to_raw_response_wrapper (
346
- config .delete ,
347
- )
348
274
349
275
350
276
class AsyncConfigResourceWithRawResponse :
@@ -357,9 +283,6 @@ def __init__(self, config: AsyncConfigResource) -> None:
357
283
self .list = async_to_raw_response_wrapper (
358
284
config .list ,
359
285
)
360
- self .delete = async_to_raw_response_wrapper (
361
- config .delete ,
362
- )
363
286
364
287
365
288
class ConfigResourceWithStreamingResponse :
@@ -372,9 +295,6 @@ def __init__(self, config: ConfigResource) -> None:
372
295
self .list = to_streamed_response_wrapper (
373
296
config .list ,
374
297
)
375
- self .delete = to_streamed_response_wrapper (
376
- config .delete ,
377
- )
378
298
379
299
380
300
class AsyncConfigResourceWithStreamingResponse :
@@ -387,6 +307,3 @@ def __init__(self, config: AsyncConfigResource) -> None:
387
307
self .list = async_to_streamed_response_wrapper (
388
308
config .list ,
389
309
)
390
- self .delete = async_to_streamed_response_wrapper (
391
- config .delete ,
392
- )
0 commit comments