pra_console¶
The following methods allow for interaction with the ZPA Privileged Remote Access Console API endpoints.
Methods are accessible via zpa.pra_console
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 PRAConsoleAPI¶
Bases:
APIClientA Client object for the Privileged Remote Access Console resource.
- add_bulk_console(consoles, **kwargs)¶
Adds multiple Privileged Remote Access (PRA) consoles in bulk.
- Parameters:
consoles (list[dict]) – A list of dictionaries, each containing details for a console.
- Returns:
- A tuple containing:
list[PrivilegedRemoteAccessConsole]: A list of newly created PRA console instances.
Response: The raw API response object.
Error: An error message, if applicable.
- Return type:
Examples
>>> added_consoles, _, err = client.zpa.pra_console.add_bulk_console( ... consoles=[ ... dict( ... name=f"rdp_console_{random.randint(1000, 10000)}", ... description=f"rdp_console_desc_{random.randint(1000, 10000)}", ... enabled=True, ... pra_application_id="72058304855096642", ... pra_portal_ids=["72058304855093465"], ... ), ... dict( ... name=f"ssh_console_{random.randint(1000, 10000)}", ... description=f"ssh_console_desc_{random.randint(1000, 10000)}", ... enabled=True, ... pra_application_id="72058304855097808", ... pra_portal_ids=["72058304855093465", "72058304855097809"], ... ) ... ] ... )
- add_console(**kwargs)¶
Adds a new Privileged Remote Access (PRA) console.
- Parameters:
- Keyword Arguments:
description (str, optional) – The description of the console.
- Returns:
- A tuple containing:
PrivilegedRemoteAccessConsole: The newly created console instance.
Response: The raw API response object.
Error: An error message, if applicable.
- Return type:
Examples
>>> new_console, _, err = client.zpa.pra_console.add_console( ... name=f"new_rdp_console_{random.randint(1000, 10000)}", ... description=f"new_rdp_console_{random.randint(1000, 10000)}", ... enabled=True, ... pra_application_id='72058304855096642', ... pra_portal_ids=['72058304855093465'], ... ) ... if err: ... print(f"Error creating console: {err}") ... return ... print(f"Console created successfully: {new_console.as_dict()}")
- delete_console(console_id, microtenant_id=None)¶
Deletes the specified PRA console.
- Parameters:
- Returns:
The status code of the delete operation.
- Return type:
Examples
>>> _, _, err = client.zpa.pra_console.delete_console( ... console_id='999999' ... ) ... if err: ... print(f"Error deleting pra console: {err}") ... return ... print(f"PRA Console with ID {updated_console.id} deleted successfully.")
- get_console(console_id, query_params=None)¶
Returns information on a specific PRA console.
- Parameters:
- Returns:
PrivilegedRemoteAccessConsole: The corresponding console object.
- Return type:
Tuple
Examples
>>> fetched_console, _, err = client.zpa.pra_console.get_console('999999') ... if err: ... print(f"Error fetching console by ID: {err}") ... return ... print(f"Fetched console by ID: {fetched_console.as_dict()}")
- get_console_portal(portal_id, query_params=None)¶
Returns information on a Privileged Remote Consoles for Specified Portal.
- Parameters:
portal_id (str) – The unique identifier for the PRA console.
- Returns:
The corresponding console object.
- Return type:
PrivilegedRemoteAccessConsole
Examples
>>> fetched_console, _, err = client.zpa.pra_console.get_console_portal('999999') ... if err: ... print(f"Error fetching console by ID: {err}") ... return ... print(f"Fetched console by ID: {fetched_console.as_dict()}")
- list_consoles(query_params=None)¶
Returns a list of all Privileged Remote Access (PRA) consoles.
- 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.microtenant_id]{str}: ID of the microtenant, if applicable.- Returns:
A list of PrivilegedRemoteAccessConsole instances.
- Return type:
Examples
>>> consoles_list, _, err = client.zpa.pra_console.list_consoles( ... query_params={'search': 'pra_console01', 'page': '1', 'page_size': '100'}) ... if err: ... print(f"Error listing pra consoles: {err}") ... return ... print(f"Total pra consoles found: {len(consoles_list)}") ... for pra in consoles_list: ... print(pra.as_dict())
- update_console(console_id, **kwargs)¶
Updates the specified PRA console.
- Parameters:
- Returns:
PrivilegedRemoteAccessConsole: The updated console.
- Return type:
Tuple
Examples
>>> updated_console, _, err = client.zpa.pra_console.update_console( ... console_id='999999', ... name=f"update_rdp_console_{random.randint(1000, 10000)}", ... description=f"update_rdp_console_{random.randint(1000, 10000)}", ... enabled=True, ... pra_application_id='72058304855096642', ... pra_portal_ids=['72058304855093465'], ... ) ... if err: ... print(f"Error updating console: {err}") ... return ... print(f"console updated successfully: {updated_console.as_dict()}")