22
33from __future__ import annotations
44
5- from typing import Type , Union , Optional , cast
5+ from typing import Type , Union , Iterable , Optional , cast
66from datetime import datetime
77
88import httpx
2323from ....._wrappers import ResultWrapper
2424from .....pagination import SyncV4PagePaginationArray , AsyncV4PagePaginationArray
2525from ....._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+ )
2732from .....types .zero_trust .access .infrastructure .target_get_response import TargetGetResponse
2833from .....types .zero_trust .access .infrastructure .target_list_response import TargetListResponse
2934from .....types .zero_trust .access .infrastructure .target_create_response import TargetCreateResponse
3035from .....types .zero_trust .access .infrastructure .target_update_response import TargetUpdateResponse
36+ from .....types .zero_trust .access .infrastructure .target_bulk_update_response import TargetBulkUpdateResponse
3137
3238__all__ = ["TargetsResource" , "AsyncTargetsResource" ]
3339
@@ -286,6 +292,79 @@ def delete(
286292 cast_to = NoneType ,
287293 )
288294
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+ account_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+
289368 def get (
290369 self ,
291370 target_id : str ,
@@ -585,6 +664,79 @@ async def delete(
585664 cast_to = NoneType ,
586665 )
587666
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+
588740 async def get (
589741 self ,
590742 target_id : str ,
@@ -646,6 +798,12 @@ def __init__(self, targets: TargetsResource) -> None:
646798 self .delete = to_raw_response_wrapper (
647799 targets .delete ,
648800 )
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+ )
649807 self .get = to_raw_response_wrapper (
650808 targets .get ,
651809 )
@@ -667,6 +825,12 @@ def __init__(self, targets: AsyncTargetsResource) -> None:
667825 self .delete = async_to_raw_response_wrapper (
668826 targets .delete ,
669827 )
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+ )
670834 self .get = async_to_raw_response_wrapper (
671835 targets .get ,
672836 )
@@ -688,6 +852,12 @@ def __init__(self, targets: TargetsResource) -> None:
688852 self .delete = to_streamed_response_wrapper (
689853 targets .delete ,
690854 )
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+ )
691861 self .get = to_streamed_response_wrapper (
692862 targets .get ,
693863 )
@@ -709,6 +879,12 @@ def __init__(self, targets: AsyncTargetsResource) -> None:
709879 self .delete = async_to_streamed_response_wrapper (
710880 targets .delete ,
711881 )
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+ )
712888 self .get = async_to_streamed_response_wrapper (
713889 targets .get ,
714890 )
0 commit comments