2020 async_to_streamed_response_wrapper ,
2121)
2222from ...._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
2425from ....types .cloudforce_one .scans import config_create_params
2526from ....types .cloudforce_one .scans .config_list_response import ConfigListResponse
2627from ....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
350276class 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
365288class 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
380300class 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- )
0 commit comments