pra_approval¶
The following methods allow for interaction with the ZPA Privileged Remote Access Approval API endpoints.
Methods are accessible via zpa.pra_approval
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 PRAApprovalAPI¶
Bases:
APIClientA Client object for the Privileged Remote Access Approval resource.
- add_approval(**kwargs)¶
Adds a privileged remote access approval.
- Parameters:
email_ids (list) – Email addresses of the users for the approval.
application_ids (list) – List of associated application segment ids.
start_time (str) – Start timestamp in UNIX format.
end_time (str) – End timestamp in UNIX format.
status (str) – Status of the approval. Supported: INVALID, ACTIVE, FUTURE, EXPIRED.
working_hours (dict) – Working hours configuration.
- Returns:
The newly created PRA approval
- Return type:
PrivilegedRemoteAccessApproval
Examples: >>> added_approval, _, error = client.zpa.pra_approval.add_approval( … email_ids=[‘jdoe@acme.com’], … application_ids=[‘72058304855096641’], … start_time=”Tue, 19 Mar 2025 00:00:00 PST”, … end_time=”Sat, 19 Apr 2025 00:00:00 PST”, … status=’ACTIVE’, … working_hours= { … “start_time_cron”: “0 0 16 ? * SUN,MON,TUE,WED,THU,FRI,SAT”, … “end_time_cron”: “0 0 0 ? * MON,TUE,WED,THU,FRI,SAT,SUN”, … “start_time”: “09:00”, … “end_time”: “17:00”, … “days”: [“FRI”, “MON”, “SAT”, “SUN”, “THU”, “TUE”, “WED”], … “time_zone”: “America/Vancouver” … }, … ) … if error: … print(f”Error adding pra approval: {error}”) … return … print(f”Pra approval added successfully: {added_approval.as_dict()}”)
- delete_approval(approval_id, microtenant_id=None)¶
Deletes a specified privileged remote access approval.
- Parameters:
- Returns:
Status code of the delete operation.
- Return type:
Examples: >>> _, _, err = client.zpa.pra_approval.delete_approval( … approval_id=99999 … ) … if err: … print(f”Error deleting approval: {err}”) … return … print(f”PRA Approval with ID {99999} deleted successfully.”)
- expired_approval(microtenant_id=None)¶
Deletes all expired privileged approvals.
- Returns:
Status code of the delete operation.
- Return type:
- get_approval(approval_id, query_params=None)¶
Returns information on the specified pra approval.
- Parameters:
- Returns:
A tuple containing (PrivilegedRemoteAccessApproval instance, Response, error)
- Return type:
Examples: >>> approval, _, err = client.zpa.pra_approval.get_approval( … approval_id=99999 … ) … if err: … print(f”Error fetching approval by ID: {err}”) … return … print(f”Fetched approval by ID: {approval.as_dict()}”)
- list_approval(query_params=None)¶
Returns a list of all privileged remote access approvals.
- Parameters:
{dict} (query_params) –
Map of query parameters for the request.
[query_params.page]{str}: Specifies the page number.[query_params.page_size]{int}: Page size for pagination.[query_params.search]{str}: Search string for filtering results.[query_params.sort_by]{str}: The sort string used to support sorting on the given field for the API.[query_params.sort_dir]{str}: Specifies the sort direction (i.e., ascending or descending order).Available values : ASC, DESC
[query_params.microtenant_id]{str}: ID of the microtenant, if applicable.- Returns:
A tuple containing (list of PrivilegedRemoteAccessApproval instances, Response, error)
- Return type:
Examples: >>> approvals_list, _, err = zpa.pra_approval.list_approval() … if err: … print(f”Error listing approvals: {err}”) … return … for approval in approvals_list: … print(approval.as_dict())
- update_approval(approval_id, **kwargs)¶
Updates a specified approval based on provided keyword arguments.
- Parameters:
approval_id (str) – The unique identifier for the approval being updated.
- Returns:
The updated approval resource
- Return type:
PrivilegedRemoteAccessApproval
Examples: >>> updated_approval, _, error = client.zpa.pra_approval.add_approval( … approval_id=’99999’, … email_ids=[‘jdoe@acme.com’], … application_ids=[‘72058304855096641’], … start_time=”Tue, 19 Mar 2025 00:00:00 PST”, … end_time=”Sat, 19 Apr 2025 00:00:00 PST”, … status=’ACTIVE’, … working_hours= { … “start_time_cron”: “0 0 16 ? * SUN,MON,TUE,WED,THU,FRI,SAT”, … “end_time_cron”: “0 0 0 ? * MON,TUE,WED,THU,FRI,SAT,SUN”, … “start_time”: “09:00”, … “end_time”: “17:00”, … “days”: [“FRI”, “MON”, “SAT”, “SUN”, “THU”, “TUE”, “WED”], … “time_zone”: “America/Vancouver” … }, … ) … if error: … print(f”Error updating PRA approval: {error}”) … return … print(f”PRA approval updated successfully: {updated_approval.as_dict()}”)