diff --git a/src/cloudflare/resources/dlp/profiles/customs.py b/src/cloudflare/resources/dlp/profiles/customs.py index ef4aadaa4d9..a3f040855f5 100644 --- a/src/cloudflare/resources/dlp/profiles/customs.py +++ b/src/cloudflare/resources/dlp/profiles/customs.py @@ -88,6 +88,7 @@ def update( *, account_id: str, allowed_match_count: float | NotGiven = NOT_GIVEN, + context_awareness: custom_update_params.ContextAwareness | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, entries: Iterable[custom_update_params.Entry] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, @@ -109,6 +110,9 @@ def update( allowed_match_count: Related DLP policies will trigger when the match count exceeds the number set. + context_awareness: Scan the context of predefined entries to only return matches surrounded by + keywords. + description: The description of the profile. entries: The custom entries for this profile. Array elements with IDs are modifying the @@ -137,6 +141,7 @@ def update( body=maybe_transform( { "allowed_match_count": allowed_match_count, + "context_awareness": context_awareness, "description": description, "entries": entries, "name": name, @@ -300,6 +305,7 @@ async def update( *, account_id: str, allowed_match_count: float | NotGiven = NOT_GIVEN, + context_awareness: custom_update_params.ContextAwareness | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, entries: Iterable[custom_update_params.Entry] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, @@ -321,6 +327,9 @@ async def update( allowed_match_count: Related DLP policies will trigger when the match count exceeds the number set. + context_awareness: Scan the context of predefined entries to only return matches surrounded by + keywords. + description: The description of the profile. entries: The custom entries for this profile. Array elements with IDs are modifying the @@ -349,6 +358,7 @@ async def update( body=maybe_transform( { "allowed_match_count": allowed_match_count, + "context_awareness": context_awareness, "description": description, "entries": entries, "name": name, diff --git a/src/cloudflare/resources/dlp/profiles/predefineds.py b/src/cloudflare/resources/dlp/profiles/predefineds.py index b190650c90d..f0330e4d812 100644 --- a/src/cloudflare/resources/dlp/profiles/predefineds.py +++ b/src/cloudflare/resources/dlp/profiles/predefineds.py @@ -40,6 +40,7 @@ def update( *, account_id: str, allowed_match_count: float | NotGiven = NOT_GIVEN, + context_awareness: predefined_update_params.ContextAwareness | NotGiven = NOT_GIVEN, entries: Iterable[predefined_update_params.Entry] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -59,6 +60,9 @@ def update( allowed_match_count: Related DLP policies will trigger when the match count exceeds the number set. + context_awareness: Scan the context of predefined entries to only return matches surrounded by + keywords. + entries: The entries for this profile. extra_headers: Send extra headers @@ -78,6 +82,7 @@ def update( body=maybe_transform( { "allowed_match_count": allowed_match_count, + "context_awareness": context_awareness, "entries": entries, }, predefined_update_params.PredefinedUpdateParams, @@ -148,6 +153,7 @@ async def update( *, account_id: str, allowed_match_count: float | NotGiven = NOT_GIVEN, + context_awareness: predefined_update_params.ContextAwareness | NotGiven = NOT_GIVEN, entries: Iterable[predefined_update_params.Entry] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -167,6 +173,9 @@ async def update( allowed_match_count: Related DLP policies will trigger when the match count exceeds the number set. + context_awareness: Scan the context of predefined entries to only return matches surrounded by + keywords. + entries: The entries for this profile. extra_headers: Send extra headers @@ -186,6 +195,7 @@ async def update( body=maybe_transform( { "allowed_match_count": allowed_match_count, + "context_awareness": context_awareness, "entries": entries, }, predefined_update_params.PredefinedUpdateParams, diff --git a/src/cloudflare/types/dlp/profile_get_response.py b/src/cloudflare/types/dlp/profile_get_response.py index e6a1e6b4cf9..6b1f5878aa4 100644 --- a/src/cloudflare/types/dlp/profile_get_response.py +++ b/src/cloudflare/types/dlp/profile_get_response.py @@ -9,8 +9,12 @@ __all__ = [ "ProfileGetResponse", "DLPPredefinedProfile", + "DLPPredefinedProfileContextAwareness", + "DLPPredefinedProfileContextAwarenessSkip", "DLPPredefinedProfileEntry", "DLPCustomProfile", + "DLPCustomProfileContextAwareness", + "DLPCustomProfileContextAwarenessSkip", "DLPCustomProfileEntry", "DLPCustomProfileEntryPattern", "DLPIntegrationProfile", @@ -18,6 +22,22 @@ ] +class DLPPredefinedProfileContextAwarenessSkip(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" + + +class DLPPredefinedProfileContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: DLPPredefinedProfileContextAwarenessSkip + """Content types to exclude from context analysis and return all matches.""" + + class DLPPredefinedProfileEntry(BaseModel): id: Optional[str] = None """The ID for this entry""" @@ -39,6 +59,12 @@ class DLPPredefinedProfile(BaseModel): allowed_match_count: Optional[float] = None """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: Optional[DLPPredefinedProfileContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + entries: Optional[List[DLPPredefinedProfileEntry]] = None """The entries for this profile.""" @@ -49,6 +75,22 @@ class DLPPredefinedProfile(BaseModel): """The type of the profile.""" +class DLPCustomProfileContextAwarenessSkip(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" + + +class DLPCustomProfileContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: DLPCustomProfileContextAwarenessSkip + """Content types to exclude from context analysis and return all matches.""" + + class DLPCustomProfileEntryPattern(BaseModel): regex: str """The regex pattern.""" @@ -89,6 +131,12 @@ class DLPCustomProfile(BaseModel): allowed_match_count: Optional[float] = None """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: Optional[DLPCustomProfileContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + created_at: Optional[datetime] = None description: Optional[str] = None diff --git a/src/cloudflare/types/dlp/profile_list_response.py b/src/cloudflare/types/dlp/profile_list_response.py index 3e013004a3c..6a46ee0609b 100644 --- a/src/cloudflare/types/dlp/profile_list_response.py +++ b/src/cloudflare/types/dlp/profile_list_response.py @@ -10,8 +10,12 @@ "ProfileListResponse", "ProfileListResponseItem", "ProfileListResponseItemDLPPredefinedProfile", + "ProfileListResponseItemDLPPredefinedProfileContextAwareness", + "ProfileListResponseItemDLPPredefinedProfileContextAwarenessSkip", "ProfileListResponseItemDLPPredefinedProfileEntry", "ProfileListResponseItemDLPCustomProfile", + "ProfileListResponseItemDLPCustomProfileContextAwareness", + "ProfileListResponseItemDLPCustomProfileContextAwarenessSkip", "ProfileListResponseItemDLPCustomProfileEntry", "ProfileListResponseItemDLPCustomProfileEntryPattern", "ProfileListResponseItemDLPIntegrationProfile", @@ -19,6 +23,22 @@ ] +class ProfileListResponseItemDLPPredefinedProfileContextAwarenessSkip(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" + + +class ProfileListResponseItemDLPPredefinedProfileContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: ProfileListResponseItemDLPPredefinedProfileContextAwarenessSkip + """Content types to exclude from context analysis and return all matches.""" + + class ProfileListResponseItemDLPPredefinedProfileEntry(BaseModel): id: Optional[str] = None """The ID for this entry""" @@ -40,6 +60,12 @@ class ProfileListResponseItemDLPPredefinedProfile(BaseModel): allowed_match_count: Optional[float] = None """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: Optional[ProfileListResponseItemDLPPredefinedProfileContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + entries: Optional[List[ProfileListResponseItemDLPPredefinedProfileEntry]] = None """The entries for this profile.""" @@ -50,6 +76,22 @@ class ProfileListResponseItemDLPPredefinedProfile(BaseModel): """The type of the profile.""" +class ProfileListResponseItemDLPCustomProfileContextAwarenessSkip(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" + + +class ProfileListResponseItemDLPCustomProfileContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: ProfileListResponseItemDLPCustomProfileContextAwarenessSkip + """Content types to exclude from context analysis and return all matches.""" + + class ProfileListResponseItemDLPCustomProfileEntryPattern(BaseModel): regex: str """The regex pattern.""" @@ -90,6 +132,12 @@ class ProfileListResponseItemDLPCustomProfile(BaseModel): allowed_match_count: Optional[float] = None """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: Optional[ProfileListResponseItemDLPCustomProfileContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + created_at: Optional[datetime] = None description: Optional[str] = None diff --git a/src/cloudflare/types/dlp/profiles/custom_create_params.py b/src/cloudflare/types/dlp/profiles/custom_create_params.py index cb43ec7732a..76b49a62bd2 100644 --- a/src/cloudflare/types/dlp/profiles/custom_create_params.py +++ b/src/cloudflare/types/dlp/profiles/custom_create_params.py @@ -5,7 +5,14 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["CustomCreateParams", "Profile", "ProfileEntry", "ProfileEntryPattern"] +__all__ = [ + "CustomCreateParams", + "Profile", + "ProfileContextAwareness", + "ProfileContextAwarenessSkip", + "ProfileEntry", + "ProfileEntryPattern", +] class CustomCreateParams(TypedDict, total=False): @@ -15,6 +22,22 @@ class CustomCreateParams(TypedDict, total=False): profiles: Required[Iterable[Profile]] +class ProfileContextAwarenessSkip(TypedDict, total=False): + files: Required[bool] + """If the content type is a file, skip context analysis and return all matches.""" + + +class ProfileContextAwareness(TypedDict, total=False): + enabled: Required[bool] + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: Required[ProfileContextAwarenessSkip] + """Content types to exclude from context analysis and return all matches.""" + + class ProfileEntryPattern(TypedDict, total=False): regex: Required[str] """The regex pattern.""" @@ -42,6 +65,12 @@ class Profile(TypedDict, total=False): allowed_match_count: float """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: ProfileContextAwareness + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + description: str """The description of the profile.""" diff --git a/src/cloudflare/types/dlp/profiles/custom_create_response.py b/src/cloudflare/types/dlp/profiles/custom_create_response.py index 1ac01a6e240..95bb2701919 100644 --- a/src/cloudflare/types/dlp/profiles/custom_create_response.py +++ b/src/cloudflare/types/dlp/profiles/custom_create_response.py @@ -9,11 +9,29 @@ __all__ = [ "CustomCreateResponse", "CustomCreateResponseItem", + "CustomCreateResponseItemContextAwareness", + "CustomCreateResponseItemContextAwarenessSkip", "CustomCreateResponseItemEntry", "CustomCreateResponseItemEntryPattern", ] +class CustomCreateResponseItemContextAwarenessSkip(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" + + +class CustomCreateResponseItemContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: CustomCreateResponseItemContextAwarenessSkip + """Content types to exclude from context analysis and return all matches.""" + + class CustomCreateResponseItemEntryPattern(BaseModel): regex: str """The regex pattern.""" @@ -54,6 +72,12 @@ class CustomCreateResponseItem(BaseModel): allowed_match_count: Optional[float] = None """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: Optional[CustomCreateResponseItemContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + created_at: Optional[datetime] = None description: Optional[str] = None diff --git a/src/cloudflare/types/dlp/profiles/custom_get_response.py b/src/cloudflare/types/dlp/profiles/custom_get_response.py index fa80b126cc3..034940ab68b 100644 --- a/src/cloudflare/types/dlp/profiles/custom_get_response.py +++ b/src/cloudflare/types/dlp/profiles/custom_get_response.py @@ -6,7 +6,23 @@ from ...._models import BaseModel -__all__ = ["CustomGetResponse", "Entry", "EntryPattern"] +__all__ = ["CustomGetResponse", "ContextAwareness", "ContextAwarenessSkip", "Entry", "EntryPattern"] + + +class ContextAwarenessSkip(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" + + +class ContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: ContextAwarenessSkip + """Content types to exclude from context analysis and return all matches.""" class EntryPattern(BaseModel): @@ -49,6 +65,12 @@ class CustomGetResponse(BaseModel): allowed_match_count: Optional[float] = None """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: Optional[ContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + created_at: Optional[datetime] = None description: Optional[str] = None diff --git a/src/cloudflare/types/dlp/profiles/custom_update_params.py b/src/cloudflare/types/dlp/profiles/custom_update_params.py index 09dad163c6c..ce2df440b0d 100644 --- a/src/cloudflare/types/dlp/profiles/custom_update_params.py +++ b/src/cloudflare/types/dlp/profiles/custom_update_params.py @@ -7,6 +7,8 @@ __all__ = [ "CustomUpdateParams", + "ContextAwareness", + "ContextAwarenessSkip", "Entry", "EntryPattern", "SharedEntry", @@ -22,6 +24,12 @@ class CustomUpdateParams(TypedDict, total=False): allowed_match_count: float """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: ContextAwareness + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + description: str """The description of the profile.""" @@ -43,6 +51,22 @@ class CustomUpdateParams(TypedDict, total=False): """ +class ContextAwarenessSkip(TypedDict, total=False): + files: Required[bool] + """If the content type is a file, skip context analysis and return all matches.""" + + +class ContextAwareness(TypedDict, total=False): + enabled: Required[bool] + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: Required[ContextAwarenessSkip] + """Content types to exclude from context analysis and return all matches.""" + + class EntryPattern(TypedDict, total=False): regex: Required[str] """The regex pattern.""" diff --git a/src/cloudflare/types/dlp/profiles/custom_update_response.py b/src/cloudflare/types/dlp/profiles/custom_update_response.py index 1de9d1f99cb..f2ed2abcf77 100644 --- a/src/cloudflare/types/dlp/profiles/custom_update_response.py +++ b/src/cloudflare/types/dlp/profiles/custom_update_response.py @@ -6,7 +6,23 @@ from ...._models import BaseModel -__all__ = ["CustomUpdateResponse", "Entry", "EntryPattern"] +__all__ = ["CustomUpdateResponse", "ContextAwareness", "ContextAwarenessSkip", "Entry", "EntryPattern"] + + +class ContextAwarenessSkip(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" + + +class ContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: ContextAwarenessSkip + """Content types to exclude from context analysis and return all matches.""" class EntryPattern(BaseModel): @@ -49,6 +65,12 @@ class CustomUpdateResponse(BaseModel): allowed_match_count: Optional[float] = None """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: Optional[ContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + created_at: Optional[datetime] = None description: Optional[str] = None diff --git a/src/cloudflare/types/dlp/profiles/predefined_get_response.py b/src/cloudflare/types/dlp/profiles/predefined_get_response.py index 2f1390806b5..9ed4c39605c 100644 --- a/src/cloudflare/types/dlp/profiles/predefined_get_response.py +++ b/src/cloudflare/types/dlp/profiles/predefined_get_response.py @@ -5,7 +5,23 @@ from ...._models import BaseModel -__all__ = ["PredefinedGetResponse", "Entry"] +__all__ = ["PredefinedGetResponse", "ContextAwareness", "ContextAwarenessSkip", "Entry"] + + +class ContextAwarenessSkip(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" + + +class ContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: ContextAwarenessSkip + """Content types to exclude from context analysis and return all matches.""" class Entry(BaseModel): @@ -29,6 +45,12 @@ class PredefinedGetResponse(BaseModel): allowed_match_count: Optional[float] = None """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: Optional[ContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + entries: Optional[List[Entry]] = None """The entries for this profile.""" diff --git a/src/cloudflare/types/dlp/profiles/predefined_update_params.py b/src/cloudflare/types/dlp/profiles/predefined_update_params.py index f6608857e7e..ae141a14d17 100644 --- a/src/cloudflare/types/dlp/profiles/predefined_update_params.py +++ b/src/cloudflare/types/dlp/profiles/predefined_update_params.py @@ -5,7 +5,7 @@ from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = ["PredefinedUpdateParams", "Entry"] +__all__ = ["PredefinedUpdateParams", "ContextAwareness", "ContextAwarenessSkip", "Entry"] class PredefinedUpdateParams(TypedDict, total=False): @@ -15,10 +15,32 @@ class PredefinedUpdateParams(TypedDict, total=False): allowed_match_count: float """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: ContextAwareness + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + entries: Iterable[Entry] """The entries for this profile.""" +class ContextAwarenessSkip(TypedDict, total=False): + files: Required[bool] + """If the content type is a file, skip context analysis and return all matches.""" + + +class ContextAwareness(TypedDict, total=False): + enabled: Required[bool] + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: Required[ContextAwarenessSkip] + """Content types to exclude from context analysis and return all matches.""" + + class Entry(TypedDict, total=False): enabled: bool """Whether the entry is enabled or not.""" diff --git a/src/cloudflare/types/dlp/profiles/predefined_update_response.py b/src/cloudflare/types/dlp/profiles/predefined_update_response.py index 7c0ce90cf12..c5e2a119d97 100644 --- a/src/cloudflare/types/dlp/profiles/predefined_update_response.py +++ b/src/cloudflare/types/dlp/profiles/predefined_update_response.py @@ -5,7 +5,23 @@ from ...._models import BaseModel -__all__ = ["PredefinedUpdateResponse", "Entry"] +__all__ = ["PredefinedUpdateResponse", "ContextAwareness", "ContextAwarenessSkip", "Entry"] + + +class ContextAwarenessSkip(BaseModel): + files: bool + """If the content type is a file, skip context analysis and return all matches.""" + + +class ContextAwareness(BaseModel): + enabled: bool + """ + If true, scan the context of predefined entries to only return matches + surrounded by keywords. + """ + + skip: ContextAwarenessSkip + """Content types to exclude from context analysis and return all matches.""" class Entry(BaseModel): @@ -29,6 +45,12 @@ class PredefinedUpdateResponse(BaseModel): allowed_match_count: Optional[float] = None """Related DLP policies will trigger when the match count exceeds the number set.""" + context_awareness: Optional[ContextAwareness] = None + """ + Scan the context of predefined entries to only return matches surrounded by + keywords. + """ + entries: Optional[List[Entry]] = None """The entries for this profile.""" diff --git a/tests/api_resources/dlp/profiles/test_customs.py b/tests/api_resources/dlp/profiles/test_customs.py index 52addbef6c4..70558cf14d4 100644 --- a/tests/api_resources/dlp/profiles/test_customs.py +++ b/tests/api_resources/dlp/profiles/test_customs.py @@ -84,6 +84,10 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", allowed_match_count=5, + context_awareness={ + "enabled": True, + "skip": {"files": True}, + }, description="A standard CVV card number", entries=[ { @@ -332,6 +336,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", allowed_match_count=5, + context_awareness={ + "enabled": True, + "skip": {"files": True}, + }, description="A standard CVV card number", entries=[ { diff --git a/tests/api_resources/dlp/profiles/test_predefineds.py b/tests/api_resources/dlp/profiles/test_predefineds.py index 005e4f0d5e8..787ec35e19a 100644 --- a/tests/api_resources/dlp/profiles/test_predefineds.py +++ b/tests/api_resources/dlp/profiles/test_predefineds.py @@ -33,6 +33,10 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", allowed_match_count=5, + context_awareness={ + "enabled": True, + "skip": {"files": True}, + }, entries=[{"enabled": True}, {"enabled": True}, {"enabled": True}], ) assert_matches_type(PredefinedUpdateResponse, predefined, path=["response"]) @@ -152,6 +156,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "384e129d-25bd-403c-8019-bc19eb7a8a5f", account_id="023e105f4ecef8ad9ca31a8372d0c353", allowed_match_count=5, + context_awareness={ + "enabled": True, + "skip": {"files": True}, + }, entries=[{"enabled": True}, {"enabled": True}, {"enabled": True}], ) assert_matches_type(PredefinedUpdateResponse, predefined, path=["response"])