diff --git a/zscaler/aiguard/models/policy_detection.py b/zscaler/aiguard/models/policy_detection.py index 8ad957f5..584ecb1c 100644 --- a/zscaler/aiguard/models/policy_detection.py +++ b/zscaler/aiguard/models/policy_detection.py @@ -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]: """ @@ -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 diff --git a/zscaler/aiguard/policy_detection.py b/zscaler/aiguard/policy_detection.py index fd73913c..b8cfbad9 100644 --- a/zscaler/aiguard/policy_detection.py +++ b/zscaler/aiguard/policy_detection.py @@ -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). @@ -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) @@ -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,