Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions zscaler/aiguard/models/policy_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,12 @@ def __init__(self, config: Optional[Dict[str, Any]] = None) -> None:
self.transaction_id = config["transactionId"] if "transactionId" in config else None
self.content = config["content"] if "content" in config else None
self.direction = config["direction"] if "direction" in config else None
self.user = config["user"] if "user" in config else None
else:
self.transaction_id = None
self.content = None
self.direction = None
self.user = None

def request_format(self) -> Dict[str, Any]:
"""
Expand All @@ -305,6 +307,7 @@ def request_format(self) -> Dict[str, Any]:
"transactionId": self.transaction_id,
"content": self.content,
"direction": self.direction,
"user": self.user,
}
parent_req_format.update(current_obj_format)
return parent_req_format
Expand Down
6 changes: 6 additions & 0 deletions zscaler/aiguard/policy_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def resolve_and_execute_policy(
content: str,
direction: str,
transaction_id: Optional[str] = None,
user: Optional[str] = None,
) -> APIResult[ResolveAndExecuteDetectionsPolicyResponse]:
"""
Resolves and executes a policy detection (automatic policy selection).
Expand All @@ -148,6 +149,8 @@ def resolve_and_execute_policy(
content (str): The content to scan
direction (str): The direction of the content ('IN' or 'OUT')
transaction_id (str, optional): Optional transaction ID for tracking
user (str, optional): Optional end-user identity associated with the request,
recorded on the detection event so the user surfaces on the dashboard

Returns:
APIResult[ResolveAndExecuteDetectionsPolicyResponse]: Tuple of (result, response, error)
Expand Down Expand Up @@ -180,6 +183,9 @@ def resolve_and_execute_policy(
if transaction_id is not None:
body["transactionId"] = transaction_id

if user is not None:
body["user"] = user

request, error = self._request_executor.create_request(
method=http_method,
endpoint=api_url,
Expand Down