Skip to content

Commit 784cbd8

Browse files
feat(api): api update
1 parent 4ec7918 commit 784cbd8

File tree

10 files changed

+73
-976
lines changed

10 files changed

+73
-976
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1751
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-fc63a97ecca4019f0327c7775a31644091d16f990ed592b1513b6a7ddcfb45c9.yml
3-
openapi_spec_hash: 4ee3e27392248c5290c1c6982beb313d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4855b99071a5844a4d1eb379451bbc298ed3c281444874e66769828d859cb7ff.yml
3+
openapi_spec_hash: ae06975ac0540aed98db451b9d336a67
44
config_hash: 259b5eeae0358ea7d7756b294847f140

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6492,12 +6492,12 @@ Methods:
64926492
Types:
64936493

64946494
```python
6495-
from cloudflare.types.zero_trust.dlp.profiles import CustomProfile, Pattern, CustomCreateResponse
6495+
from cloudflare.types.zero_trust.dlp.profiles import CustomProfile, Pattern
64966496
```
64976497

64986498
Methods:
64996499

6500-
- <code title="post /accounts/{account_id}/dlp/profiles/custom">client.zero_trust.dlp.profiles.custom.<a href="./src/cloudflare/resources/zero_trust/dlp/profiles/custom.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/dlp/profiles/custom_create_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/dlp/profiles/custom_create_response.py">Optional[CustomCreateResponse]</a></code>
6500+
- <code title="post /accounts/{account_id}/dlp/profiles/custom">client.zero_trust.dlp.profiles.custom.<a href="./src/cloudflare/resources/zero_trust/dlp/profiles/custom.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/dlp/profiles/custom_create_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/dlp/profile.py">Optional[Profile]</a></code>
65016501
- <code title="put /accounts/{account_id}/dlp/profiles/custom/{profile_id}">client.zero_trust.dlp.profiles.custom.<a href="./src/cloudflare/resources/zero_trust/dlp/profiles/custom.py">update</a>(profile_id, \*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/dlp/profiles/custom_update_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/dlp/profile.py">Optional[Profile]</a></code>
65026502
- <code title="delete /accounts/{account_id}/dlp/profiles/custom/{profile_id}">client.zero_trust.dlp.profiles.custom.<a href="./src/cloudflare/resources/zero_trust/dlp/profiles/custom.py">delete</a>(profile_id, \*, account_id) -> object</code>
65036503
- <code title="get /accounts/{account_id}/dlp/profiles/custom/{profile_id}">client.zero_trust.dlp.profiles.custom.<a href="./src/cloudflare/resources/zero_trust/dlp/profiles/custom.py">get</a>(profile_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/dlp/profile.py">Optional[Profile]</a></code>

src/cloudflare/resources/zero_trust/dlp/profiles/custom.py

Lines changed: 13 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
from __future__ import annotations
44

55
from typing import Any, Type, Iterable, Optional, cast
6-
from typing_extensions import overload
76

87
import httpx
98

109
from ....._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
1211
from ....._compat import cached_property
1312
from ....._resource import SyncAPIResource, AsyncAPIResource
1413
from ....._response import (
@@ -22,7 +21,6 @@
2221
from .....types.zero_trust.dlp.profile import Profile
2322
from .....types.zero_trust.dlp.profiles import custom_create_params, custom_update_params
2423
from .....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
)

src/cloudflare/resources/zero_trust/dlp/profiles/predefined.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ def update(
5050
profile_id: str,
5151
*,
5252
account_id: str,
53-
entries: Iterable[predefined_update_params.Entry],
5453
ai_context_enabled: bool | NotGiven = NOT_GIVEN,
5554
allowed_match_count: Optional[int] | NotGiven = NOT_GIVEN,
5655
confidence_threshold: Optional[str] | NotGiven = NOT_GIVEN,
5756
context_awareness: ContextAwarenessParam | NotGiven = NOT_GIVEN,
57+
entries: Iterable[predefined_update_params.Entry] | NotGiven = NOT_GIVEN,
5858
ocr_enabled: bool | NotGiven = NOT_GIVEN,
5959
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6060
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -89,11 +89,11 @@ def update(
8989
f"/accounts/{account_id}/dlp/profiles/predefined/{profile_id}",
9090
body=maybe_transform(
9191
{
92-
"entries": entries,
9392
"ai_context_enabled": ai_context_enabled,
9493
"allowed_match_count": allowed_match_count,
9594
"confidence_threshold": confidence_threshold,
9695
"context_awareness": context_awareness,
96+
"entries": entries,
9797
"ocr_enabled": ocr_enabled,
9898
},
9999
predefined_update_params.PredefinedUpdateParams,
@@ -182,11 +182,11 @@ async def update(
182182
profile_id: str,
183183
*,
184184
account_id: str,
185-
entries: Iterable[predefined_update_params.Entry],
186185
ai_context_enabled: bool | NotGiven = NOT_GIVEN,
187186
allowed_match_count: Optional[int] | NotGiven = NOT_GIVEN,
188187
confidence_threshold: Optional[str] | NotGiven = NOT_GIVEN,
189188
context_awareness: ContextAwarenessParam | NotGiven = NOT_GIVEN,
189+
entries: Iterable[predefined_update_params.Entry] | NotGiven = NOT_GIVEN,
190190
ocr_enabled: bool | NotGiven = NOT_GIVEN,
191191
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
192192
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -221,11 +221,11 @@ async def update(
221221
f"/accounts/{account_id}/dlp/profiles/predefined/{profile_id}",
222222
body=await async_maybe_transform(
223223
{
224-
"entries": entries,
225224
"ai_context_enabled": ai_context_enabled,
226225
"allowed_match_count": allowed_match_count,
227226
"confidence_threshold": confidence_threshold,
228227
"context_awareness": context_awareness,
228+
"entries": entries,
229229
"ocr_enabled": ocr_enabled,
230230
},
231231
predefined_update_params.PredefinedUpdateParams,

src/cloudflare/types/zero_trust/dlp/profiles/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
from .pattern_param import PatternParam as PatternParam
77
from .custom_create_params import CustomCreateParams as CustomCreateParams
88
from .custom_update_params import CustomUpdateParams as CustomUpdateParams
9-
from .custom_create_response import CustomCreateResponse as CustomCreateResponse
109
from .predefined_update_params import PredefinedUpdateParams as PredefinedUpdateParams

0 commit comments

Comments
 (0)