2
2
3
3
from __future__ import annotations
4
4
5
- from typing import Type , Union , Optional , cast
5
+ from typing import Type , Union , Iterable , Optional , cast
6
6
from datetime import datetime
7
7
8
8
import httpx
23
23
from ....._wrappers import ResultWrapper
24
24
from .....pagination import SyncV4PagePaginationArray , AsyncV4PagePaginationArray
25
25
from ....._base_client import AsyncPaginator , make_request_options
26
- from .....types .zero_trust .access .infrastructure import target_list_params , target_create_params , target_update_params
26
+ from .....types .zero_trust .access .infrastructure import (
27
+ target_list_params ,
28
+ target_create_params ,
29
+ target_update_params ,
30
+ target_bulk_update_params ,
31
+ )
27
32
from .....types .zero_trust .access .infrastructure .target_get_response import TargetGetResponse
28
33
from .....types .zero_trust .access .infrastructure .target_list_response import TargetListResponse
29
34
from .....types .zero_trust .access .infrastructure .target_create_response import TargetCreateResponse
30
35
from .....types .zero_trust .access .infrastructure .target_update_response import TargetUpdateResponse
36
+ from .....types .zero_trust .access .infrastructure .target_bulk_update_response import TargetBulkUpdateResponse
31
37
32
38
__all__ = ["TargetsResource" , "AsyncTargetsResource" ]
33
39
@@ -286,6 +292,79 @@ def delete(
286
292
cast_to = NoneType ,
287
293
)
288
294
295
+ def bulk_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
+ ) -> None :
306
+ """
307
+ Removes one or more targets.
308
+
309
+ Args:
310
+ account_id: Account identifier
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
+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
323
+ return self ._delete (
324
+ f"/accounts/{ account_id } /infrastructure/targets/batch" ,
325
+ options = make_request_options (
326
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
327
+ ),
328
+ cast_to = NoneType ,
329
+ )
330
+
331
+ def bulk_update (
332
+ self ,
333
+ * ,
334
+ ac
10000
count_id : str ,
335
+ body : Iterable [target_bulk_update_params .Body ],
336
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
337
+ # The extra values given here take precedence over values defined on the client or passed to this method.
338
+ extra_headers : Headers | None = None ,
339
+ extra_query : Query | None = None ,
340
+ extra_body : Body | None = None ,
341
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
342
+ ) -> TargetBulkUpdateResponse :
343
+ """
344
+ Adds one or more targets.
345
+
346
+ Args:
347
+ account_id: Account identifier
348
+
349
+ extra_headers: Send extra headers
350
+
351
+ extra_query: Add additional query parameters to the request
352
+
353
+ extra_body: Add additional JSON properties to the request
354
+
355
+ timeout: Override the client-level default timeout for this request, in seconds
356
+ """
357
+ if not account_id :
358
+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
359
+ return self ._put (
360
+ f"/accounts/{ account_id } /infrastructure/targets/batch" ,
361
+ body = maybe_transform (body , Iterable [target_bulk_update_params .Body ]),
362
+ options = make_request_options (
363
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
364
+ ),
365
+ cast_to = TargetBulkUpdateResponse ,
366
+ )
367
+
289
368
def get (
290
369
self ,
291
370
target_id : str ,
@@ -585,6 +664,79 @@ async def delete(
585
664
cast_to = NoneType ,
586
665
)
587
666
667
+ async def bulk_delete (
668
+ self ,
669
+ * ,
670
+ account_id : str ,
671
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
672
+ # The extra values given here take precedence over values defined on the client or passed to this method.
673
+ extra_headers : Headers | None = None ,
674
+ extra_query : Query | None = None ,
675
+ extra_body : Body | None = None ,
676
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
677
+ ) -> None :
678
+ """
679
+ Removes one or more targets.
680
+
681
+ Args:
682
+ account_id: Account identifier
683
+
684
+ extra_headers: Send extra headers
685
+
686
+ extra_query: Add additional query parameters to the request
687
+
688
+ extra_body: Add additional JSON properties to the request
689
+
690
+ timeout: Override the client-level default timeout for this request, in seconds
691
+ """
692
+ if not account_id :
693
+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
694
+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
695
+ return await self ._delete (
696
+ f"/accounts/{ account_id } /infrastructure/targets/batch" ,
697
+ options = make_request_options (
698
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
699
+ ),
700
+ cast_to = NoneType ,
701
+ )
702
+
703
+ async def bulk_update (
704
+ self ,
705
+ * ,
706
+ account_id : str ,
707
+ body : Iterable [target_bulk_update_params .Body ],
708
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
709
+ # The extra values given here take precedence over values defined on the client or passed to this method.
710
+ extra_headers : Headers | None = None ,
711
+ extra_query : Query | None = None ,
712
+ extra_body : Body | None = None ,
713
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
714
+ ) -> TargetBulkUpdateResponse :
715
+ """
716
+ Adds one or more targets.
717
+
718
+ Args:
719
+ account_id: Account identifier
720
+
721
+ extra_headers: Send extra headers
722
+
723
+ extra_query: Add additional query parameters to the request
724
+
725
+ extra_body: Add additional JSON properties to the request
726
+
727
+ timeout: Override the client-level default timeout for this request, in seconds
728
+ """
729
+ if not account_id :
730
+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
731
+ return await self ._put (
732
+ f"/accounts/{ account_id } /infrastructure/targets/batch" ,
733
+ body = await async_maybe_transform (body , Iterable [target_bulk_update_params .Body ]),
734
+ options = make_request_options (
735
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
736
+ ),
737
+ cast_to = TargetBulkUpdateResponse ,
738
+ )
739
+
588
740
async def get (
589
741
self ,
590
742
target_id : str ,
@@ -646,6 +798,12 @@ def __init__(self, targets: TargetsResource) -> None:
646
798
self .delete = to_raw_response_wrapper (
647
799
targets .delete ,
648
800
)
801
+ self .bulk_delete = to_raw_response_wrapper (
802
+ targets .bulk_delete ,
803
+ )
804
+ self .bulk_update = to_raw_response_wrapper (
805
+ targets .bulk_update ,
806
+ )
649
807
self .get = to_raw_response_wrapper (
650
808
targets .get ,
651
809
)
@@ -667,6 +825,12 @@ def __init__(self, targets: AsyncTargetsResource) -> None:
667
825
self .delete = async_to_raw_response_wrapper (
668
826
targets .delete ,
669
827
)
828
+ self .bulk_delete = async_to_raw_response_wrapper (
829
+ targets .bulk_delete ,
830
+ )
831
+ self .bulk_update = async_to_raw_response_wrapper (
832
+ targets .bulk_update ,
833
+ )
670
834
self .get = async_to_raw_response_wrapper (
671
835
targets .get ,
672
836
)
@@ -688,6 +852,12 @@ def __init__(self, targets: TargetsResource) -> None:
688
852
self .delete = to_streamed_response_wrapper (
689
853
targets .delete ,
690
854
)
855
+ self .bulk_delete = to_streamed_response_wrapper (
856
+ targets .bulk_delete ,
857
+ )
858
+ self .bulk_update = to_streamed_response_wrapper (
859
+ targets .bulk_update ,
860
+ )
691
861
self .get = to_streamed_response_wrapper (
692
862
targets .get ,
693
863
)
@@ -709,6 +879,12 @@ def __init__(self, targets: AsyncTargetsResource) -> None:
709
879
self .delete = async_to_streamed_response_wrapper (
710
880
targets .delete ,
711
881
)
882
+ self .bulk_delete = async_to_streamed_response_wrapper (
883
+ targets .bulk_delete ,
884
+ )
885
+ self .bulk_update = async_to_streamed_response_wrapper (
886
+ targets .bulk_update ,
887
+ )
712
888
self .get = async_to_streamed_response_wrapper (
713
889
targets .get ,
714
890
)
0 commit comments