dlp_engine¶
The following methods allow for interaction with the ZIA DLP Engine API endpoints.
Methods are accessible via zia.dlp_engine
Copyright (c) 2023, Zscaler Inc.
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- class DLPEngineAPI¶
Bases:
APIClientA Client object for the DLP Engine resource.
- add_dlp_engine(**kwargs)¶
Adds a new dlp engine.
- Parameters:
name (str) – The order of the rule, defaults to adding rule to bottom of list.
**kwargs – Optional keyword args.
- Keyword Arguments:
engine_expression (str, optional) – The logical expression defining a DLP engine by combining DLP dictionaries using logical operators: All (AND), Any (OR), Exclude (NOT), and Sum (total number of content matches).
custom_dlp_engine (bool, optional) – If true, indicates a custom DLP engine.
description (str, optional) – The DLP engine description.
- Returns:
The updated dlp engine resource record.
- Return type:
Tuple
Examples
Update the dlp engine:
>>> zia.dlp.update_dlp_engine(name='new_dlp_engine', ... description='TT#1965432122', ... engine_expression="((D63.S > 1))", ... custom_dlp_engine=False)
Update a rule to enable custom dlp engine:
>>> zia.dlp.update_dlp_engine('976597', ... custom_dlp_engine=True, ... engine_expression="((D63.S > 1))", ... description="TT#1965232866")
- delete_dlp_engine(engine_id)¶
Deletes the specified dlp engine.
- Parameters:
engine_id (str) – The unique identifier for the dlp engine.
- Returns:
The status code for the operation.
- Return type:
Examples
>>> zia.dlp.delete_dlp_engine('278454')
- get_dlp_engines(engine_id)¶
Returns the dlp engine details for a given DLP Engine.
- Parameters:
engine_id (str) – The unique identifier for the DLP Engine.
- Returns:
The DLP Engine resource record.
- Return type:
Tuple
Examples
>>> engine = zia.dlp.get_dlp_engines('99999')
- list_dlp_engines(query_params=None)¶
Returns a list of all DLP Engines.
- Parameters:
{dict} (query_params) – Map of query parameters for the request.
[query_params.search]{str}: Search string to match against a DLP Engine name or description attributes.- Returns:
A tuple containing (list of DLP Engines instances, Response, error)
- Return type:
Examples
Gets a list of all DLP Engine.
>>> fetched_engines, response, error = client.zia.dlp_engine.list_dlp_engines() ... if error: ... print(f"Error listing DLP Engines: {error}") ... return ... print(f"Fetched engines: {[engine.as_dict() for engine in fetched_engines]}")
Gets a list of all DLP Engine by name.
>>> engine, response, error = = client.zia.dlp_engine.list_dlp_engines( query_params={"search": 'EUIBAN_LEAKAGE'}) ... if error: ... print(f"Error listing DLP Engine: {error}") ... return ... print(f"Fetched engine: {[engine.as_dict() for engine in dict]}")
- list_dlp_engines_lite(query_params=None)¶
Lists name and ID Engine of all custom and predefined DLP dictionaries. If the search parameter is provided, the function filters the rules client-side.
- Parameters:
{dict} (query_params) – Map of query parameters for the request.
[query_params.search]{str}: The search string used to match against a dictionary name.- Returns:
List of DLP Engine resource records.
- Return type:
Examples
Gets a list of all DLP Engine.
>>> fetched_engines, response, error = client.zia.dlp_engine.list_dlp_engines_lite() ... if error: ... print(f"Error listing DLP Engines: {error}") ... return ... print(f"Fetched engines: {[engine.as_dict() for engine in fetched_engines]}")
Gets a list of all DLP Engine name and ID.
>>> engine, response, error = = client.zia.dlp_engine.list_dlp_engines_lite( query_params={"search": 'EUIBAN_LEAKAGE'}) ... if error: ... print(f"Error listing DLP Engine: {error}") ... return ... print(f"Fetched engine: {[engine.as_dict() for engine in dict]}")
- update_dlp_engine(engine_id, **kwargs)¶
Updates an existing dlp engine.
- Parameters:
engine_id (str) – The unique ID for the dlp engine that is being updated.
- Keyword Arguments:
name (str) – The order of the rule, defaults to adding rule to bottom of list.
description (str, optional) – The DLP engine description.
engine_expression (str, optional) – The logical expression defining a DLP engine by combining DLP dictionaries using logical operators: All (AND), Any (OR), Exclude (NOT), and Sum (total number of content matches).
custom_dlp_engine (bool, optional) – If true, indicates a custom DLP engine.
- Returns:
The updated dlp engine resource record.
- Return type:
Examples
Update the dlp engine:
>>> zia.dlp.update_dlp_engine(name='new_dlp_engine', ... description='TT#1965432122', ... engine_expression="((D63.S > 1))", ... custom_dlp_engine=False)
Update a rule to enable custom dlp engine:
>>> zia.dlp.update_dlp_engine('976597', ... custom_dlp_engine=True, ... engine_expression="((D63.S > 1))", ... description="TT#1965232866")
- validate_dlp_expression(expression)¶
Validates a DLP engine expression.
- Parameters:
expression (str) – The logical expression to validate.
- Returns:
The response from the API, containing the validation status and any errors.
- Return type:
Examples
>>> zia.dlp.validate_dlp_expression("((D63.S > 1) AND (D38.S > 0))")