33from __future__ import annotations
44
55from typing import Any , Type , Iterable , Optional , cast
6- from typing_extensions import overload
76
87import httpx
98
109from ....._types import NOT_GIVEN , Body , Query , Headers , NotGiven
11- from ....._utils import required_args , maybe_transform , async_maybe_transform
10+ from ....._utils import maybe_transform , async_maybe_transform
1211from ....._compat import cached_property
1312from ....._resource import SyncAPIResource , AsyncAPIResource
1413from ....._response import (
2221from .....types .zero_trust .dlp .profile import Profile
2322from .....types .zero_trust .dlp .profiles import custom_create_params , custom_update_params
2423from .....types .zero_trust .dlp .context_awareness_param import ContextAwarenessParam
25- from .....types .zero_trust .dlp .profiles .custom_create_response import CustomCreateResponse
2624
2725__all__ = ["CustomResource" , "AsyncCustomResource" ]
2826
@@ -47,54 +45,26 @@ def with_streaming_response(self) -> CustomResourceWithStreamingResponse:
4745 """
4846 return CustomResourceWithStreamingResponse (self )
4947
50- @overload
5148 def create (
5249 self ,
5350 * ,
5451 account_id : str ,
55- profiles : Iterable [custom_create_params .Variant0Profile ],
56- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
57- # The extra values given here take precedence over values defined on the client or passed to this method.
58- extra_headers : Headers | None = None ,
59- extra_query : Query | None = None ,
60- extra_body : Body | None = None ,
61- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
62- ) -> Optional [CustomCreateResponse ]:
63- """
64- Creates a DLP custom profile.
65-
66- Args:
67- extra_headers: Send extra headers
68-
69- extra_query: Add additional query parameters to the request
70-
71- extra_body: Add additional JSON properties to the request
72-
73- timeout: Override the client-level default timeout for this request, in seconds
74- """
75- ...
76-
77- @overload
78- def create (
79- self ,
80- * ,
81- account_id : str ,
82- entries : Iterable [custom_create_params .DLPNewCustomProfileEntry ],
52+ entries : Iterable [custom_create_params .Entry ],
8353 name : str ,
8454 ai_context_enabled : bool | NotGiven = NOT_GIVEN ,
8555 allowed_match_count : int | NotGiven = NOT_GIVEN ,
8656 confidence_threshold : Optional [str ] | NotGiven = NOT_GIVEN ,
8757 context_awareness : ContextAwarenessParam | NotGiven = NOT_GIVEN ,
8858 description : Optional [str ] | NotGiven = NOT_GIVEN ,
8959 ocr_enabled : bool | NotGiven = NOT_GIVEN ,
90- shared_entries : Iterable [custom_create_params .DLPNewCustomProfileSharedEntry ] | NotGiven = NOT_GIVEN ,
60+ shared_entries : Iterable [custom_create_params .SharedEntry ] | NotGiven = NOT_GIVEN ,
9161 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
9262 # The extra values given here take precedence over values defined on the client or passed to this method.
9363 extra_headers : Headers | None = None ,
9464 extra_query : Query | None = None ,
9565 extra_body : Body | None = None ,
9666 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
97- ) -> Optional [CustomCreateResponse ]:
67+ ) -> Optional [Profile ]:
9868 """
9969 Creates a DLP custom profile.
10070
@@ -117,39 +87,14 @@ def create(
11787
11888 timeout: Override the client-level default timeout for this request, in seconds
11989 """
120- ...
121-
122- @required_args (["account_id" , "profiles" ], ["account_id" , "entries" , "name" ])
123- def create (
124- self ,
125- * ,
126- account_id : str ,
127- profiles : Iterable [custom_create_params .Variant0Profile ] | NotGiven = NOT_GIVEN ,
128- entries : Iterable [custom_create_params .DLPNewCustomProfileEntry ] | NotGiven = NOT_GIVEN ,
129- name : str | NotGiven = NOT_GIVEN ,
130- ai_context_enabled : bool | NotGiven = NOT_GIVEN ,
131- allowed_match_count : int | NotGiven = NOT_GIVEN ,
132- confidence_threshold : Optional [str ] | NotGiven = NOT_GIVEN ,
133- context_awareness : ContextAwarenessParam | NotGiven = NOT_GIVEN ,
134- description : Optional [str ] | NotGiven = NOT_GIVEN ,
135- ocr_enabled : bool | NotGiven = NOT_GIVEN ,
136- shared_entries : Iterable [custom_create_params .DLPNewCustomProfileSharedEntry ] | NotGiven = NOT_GIVEN ,
137- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
138- # The extra values given here take precedence over values defined on the client or passed to this method.
139- extra_headers : Headers | None = None ,
140- extra_query : Query | None = None ,
141- extra_body : Body | None = None ,
142- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
143- ) -> Optional [CustomCreateResponse ]:
14490 if not account_id :
14591 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
14692 return cast (
147- Optional [CustomCreateResponse ],
93+ Optional [Profile ],
14894 self ._post (
14995 f"/accounts/{ account_id } /dlp/profiles/custom" ,
15096 body = maybe_transform (
15197 {
152- "profiles" : profiles ,
15398 "entries" : entries ,
15499 "name" : name ,
155100 "ai_context_enabled" : ai_context_enabled ,
@@ -167,10 +112,10 @@ def create(
167112 extra_query = extra_query ,
168113 extra_body = extra_body ,
169114 timeout = timeout ,
170- post_parser = ResultWrapper [Optional [CustomCreateResponse ]]._unwrapper ,
115+ post_parser = ResultWrapper [Optional [Profile ]]._unwrapper ,
171116 ),
172117 cast_to = cast (
173- Any , ResultWrapper [CustomCreateResponse ]
118+ Any , ResultWrapper [Profile ]
174119 ), # Union types cannot be passed in as arguments in the type system
175120 ),
176121 )
@@ -359,54 +304,26 @@ def with_streaming_response(self) -> AsyncCustomResourceWithStreamingResponse:
359304 """
360305 return AsyncCustomResourceWithStreamingResponse (self )
361306
362- @overload
363307 async def create (
364308 self ,
365309 * ,
366310 account_id : str ,
367- profiles : Iterable [custom_create_params .Variant0Profile ],
368- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
369- # The extra values given here take precedence over values defined on the client or passed to this method.
370- extra_headers : Headers | None = None ,
371- extra_query : Query | None = None ,
372- extra_body : Body | None = None ,
373- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
374- ) -> Optional [CustomCreateResponse ]:
375- """
376- Creates a DLP custom profile.
377-
378- Args:
379- extra_headers: Send extra headers
380-
381- extra_query: Add additional query parameters to the request
382-
383- extra_body: Add additional JSON properties to the request
384-
385- timeout: Override the client-level default timeout for this request, in seconds
386- """
387- ...
388-
389- @overload
390- async def create (
391- self ,
392- * ,
393- account_id : str ,
394- entries : Iterable [custom_create_params .DLPNewCustomProfileEntry ],
311+ entries : Iterable [custom_create_params .Entry ],
395312 name : str ,
396313 ai_context_enabled : bool | NotGiven = NOT_GIVEN ,
397314 allowed_match_count : int | NotGiven = NOT_GIVEN ,
398315 confidence_threshold : Optional [str ] | NotGiven = NOT_GIVEN ,
399316 context_awareness : ContextAwarenessParam | NotGiven = NOT_GIVEN ,
400317 description : Optional [str ] | NotGiven = NOT_GIVEN ,
401318 ocr_enabled : bool | NotGiven = NOT_GIVEN ,
402- shared_entries : Iterable [custom_create_params .DLPNewCustomProfileSharedEntry ] | NotGiven = NOT_GIVEN ,
319+ shared_entries : Iterable [custom_create_params .SharedEntry ] | NotGiven = NOT_GIVEN ,
403320 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
404321 # The extra values given here take precedence over values defined on the client or passed to this method.
405322 extra_headers : Headers | None = None ,
406323 extra_query : Query | None = None ,
407324 extra_body : Body | None = None ,
408325 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
409- ) -> Optional [CustomCreateResponse ]:
326+ ) -> Optional [Profile ]:
410327 """
411328 Creates a DLP custom profile.
412329
@@ -429,39 +346,14 @@ async def create(
429346
430347 timeout: Override the client-level default timeout for this request, in seconds
431348 """
432- ...
433-
434- @required_args (["account_id" , "profiles" ], ["account_id" , "entries" , "name" ])
435- async def create (
436- self ,
437- * ,
438- account_id : str ,
439- profiles : Iterable [custom_create_params .Variant0Profile ] | NotGiven = NOT_GIVEN ,
440- entries : Iterable [custom_create_params .DLPNewCustomProfileEntry ] | NotGiven = NOT_GIVEN ,
441- name : str | NotGiven = NOT_GIVEN ,
442- ai_context_enabled : bool | NotGiven = NOT_GIVEN ,
443- allowed_match_count : int | NotGiven = NOT_GIVEN ,
444- confidence_threshold : Optional [str ] | NotGiven = NOT_GIVEN ,
445- context_awareness : ContextAwarenessParam | NotGiven = NOT_GIVEN ,
446- description : Optional [str ] | NotGiven = NOT_GIVEN ,
447- ocr_enabled : bool | NotGiven = NOT_GIVEN ,
448- shared_entries : Iterable [custom_create_params .DLPNewCustomProfileSharedEntry ] | NotGiven = NOT_GIVEN ,
449- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
450- # The extra values given here take precedence over values defined on the client or passed to this method.
451- extra_headers : Headers | None = None ,
452- extra_query : Query | None = None ,
453- extra_body : Body | None = None ,
454- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
455- ) -> Optional [CustomCreateResponse ]:
456349 if not account_id :
457350 raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
458351 return cast (
459- Optional [CustomCreateResponse ],
352+ Optional [Profile ],
460353 await self ._post (
461354 f"/accounts/{ account_id } /dlp/profiles/custom" ,
462355 body = await async_maybe_transform (
463356 {
464- "profiles" : profiles ,
465357 "entries" : entries ,
466358 "name" : name ,
467359 "ai_context_enabled" : ai_context_enabled ,
@@ -479,10 +371,10 @@ async def create(
479371 extra_query = extra_query ,
480372 extra_body = extra_body ,
481373 timeout = timeout ,
482- post_parser = ResultWrapper [Optional [CustomCreateResponse ]]._unwrapper ,
374+ post_parser = ResultWrapper [Optional [Profile ]]._unwrapper ,
483375 ),
484376 cast_to = cast (
485- Any , ResultWrapper [CustomCreateResponse ]
377+ Any , ResultWrapper [Profile ]
486378 ), # Union types cannot be passed in as arguments in the type system
487379 ),
488380 )
0 commit comments