pra_portal

The following methods allow for interaction with the ZPA Privileged Remote Access Portal API endpoints.

Methods are accessible via zpa.pra_portal

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 PRAPortalAPI

Bases: APIClient

A Client object for the Privileged Remote Access Portal resource.

add_portal(**kwargs)

Adds a new PRA portal.

Parameters:
  • name (str) – The name of the PRA portal.

  • certificate_id (str) – The unique identifier of the certificate.

  • domain (str) – The domain of the PRA portal.

  • enabled (bool) – Whether the PRA portal is enabled (default is True).

  • approval_reviewers (list[str]) – List of PRA Portal approval reviewers

Returns:

PrivilegedRemoteAccessPortal: The newly created portal object.

Return type:

Tuple

Examples

>>> new_portal, _, err = client.zpa.pra_portal.add_portal(
...     name="PRA Portal",
...     description="PRA Portal",
...     enabled=True,
...     domain="portal.acme.com",
...     certificate_id="72058304855021564",
...     user_notification="PRA Portal",
...     user_notification_enabled= True,
... )
... if err:
...     print(f"Error creating portal: {err}")
...     return
... print(f"portal created successfully: {new_portal.as_dict()}")
delete_portal(portal_id, microtenant_id=None)

Deletes the specified PRA portal.

Parameters:
  • portal_id (str) – The unique identifier of the portal to be deleted.

  • microtenant_id (str, optional) – The optional ID of the microtenant if applicable.

Returns:

Status code of the delete operation.

Return type:

int

Examples

>>> _, _, err = client.zpa.pra_portal.delete_portal(
...     portal_id='999999'
... )
... if err:
...     print(f"Error deleting pra portal: {err}")
...     return
... print(f"PRA Portal with ID {'999999'} deleted successfully.")
get_portal(portal_id, query_params=None)

Provides information on the specified PRA portal.

Parameters:
  • portal_id (str) – The unique identifier of the portal.

  • query_params (dict, optional) – Map of query parameters for the request. [query_params.microtenant_id] {str}: The microtenant ID, if applicable.

Returns:

PrivilegedRemoteAccessPortal: The corresponding portal object.

Return type:

Tuple

Examples

>>> fetched_portal, _, err = client.zpa.pra_portal.get_portal('999999')
... if err:
...     print(f"Error fetching portal by ID: {err}")
...     return
... print(f"Fetched portal by ID: {fetched_portal.as_dict()}")
list_portals(query_params=None)

Returns a list of all configured PRA portals with pagination support.

Keyword Arguments:

{dict} (query_params) –

Map of query parameters for the request.

[query_params.page] {str}: Specifies the page number.

[query_params.page_size] {int}: Specifies the page size.

If not provided, the default page size is 20. The max page size is 500.

[query_params.search] {str}: The search string used to support search by features and fields for the API. [query_params.microtenant_id] {str}: ID of the microtenant, if applicable.

Returns:

A list of PrivilegedRemoteAccessPortal instances.

Return type:

Tuple

Examples

>>> portals_list, _, err = client.zpa.pra_portal.list_portals(
... query_params={'search': 'portal01', 'page': '1', 'page_size': '100'})
... if err:
...     print(f"Error listing pra portals: {err}")
...     return
... print(f"Total pra portals found: {len(portals_list)}")
... for pra in portals_list:
...     print(pra.as_dict())
update_portal(portal_id, **kwargs)

Updates the specified PRA portal.

Parameters:
  • portal_id (str) – The unique identifier of the portal being updated.

  • microtenant_id (str) – The unique identifier of the Microtenant for the ZPA tenant.

Returns:

PrivilegedRemoteAccessPortal: The updated portal object.

Return type:

Tuple

Examples

>>> update_portal, _, err = client.zpa.pra_portal.update_portal(
...     portal_id="999999",
...     name="PRA Portal",
...     description="Update PRA Portal",
...     enabled=True,
...     domain="portal.acme.com",
...     certificate_id="72058304855021564",
...     user_notification="Update PRA Portal",
...     user_notification_enabled= True,
... )
... if err:
...     print(f"Error creating portal: {err}")
...     return
... print(f"portal created successfully: {new_portal.as_dict()}")