user_portal_aup

The following methods allow for interaction with the ZPA User Portal AUP API endpoints.

Methods are accessible via zpa.user_portal_aup

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 UserPortalAUPAPI

Bases: APIClient

A client object for the User Portal AUP resource.

add_user_portal_aup(**kwargs)

Add a new Acceptable Use Policy (AUP) configuration.

This endpoint creates a new AUP configuration for user portals. The AUP defines the terms and conditions that users must accept when accessing the portal.

Keyword Arguments:
  • name (str) – The name of the AUP configuration.

  • description (str) – A description of the AUP configuration.

  • aup (str) – The Acceptable Use Policy text content that users must accept.

  • enabled (bool) – Whether the AUP is enabled. Defaults to True.

  • email (str) – Contact email address for the AUP.

  • phone_num (str) – Contact phone number for the AUP.

  • microtenant_id (str) – The unique identifier of the microtenant, if applicable.

Returns:

A tuple containing (UserPortalAUP instance, Response, error).

Return type:

Tuple

Examples

Add a new AUP configuration:

>>> aup, _, err = client.zpa.user_portal_aup.add_user_portal_aup(
...     name="Standard AUP",
...     description="Standard Acceptable Use Policy for all users",
...     aup="By accessing this portal, you agree to comply with all company policies...",
...     enabled=True,
...     email="admin@example.com",
...     phone_num="+1-555-123-4567"
... )
... if err:
...     print(f"Error adding AUP: {err}")
...     return
... print(f"AUP added successfully: {aup.as_dict()}")

Add a new AUP configuration with microtenant ID:

>>> aup, _, err = client.zpa.user_portal_aup.add_user_portal_aup(
...     name="Microtenant AUP",
...     description="AUP for specific microtenant",
...     aup="Custom AUP text for microtenant users...",
...     enabled=True,
...     email="admin@example.com",
...     microtenant_id="1234567890"
... )
... if err:
...     print(f"Error adding AUP: {err}")
...     return
... print(f"AUP ID: {aup.id}, Name: {aup.name}")
delete_user_portal_aup(portal_id, microtenant_id=None)

Delete an Acceptable Use Policy (AUP) configuration.

This endpoint permanently deletes the specified AUP configuration. Once deleted, the AUP cannot be recovered.

Parameters:

portal_id (str) – The unique identifier of the AUP configuration to delete.

Keyword Arguments:

microtenant_id (str, optional) – The unique identifier of the microtenant, if applicable.

Returns:

A tuple containing (None, Response, error).

Return type:

Tuple

Examples

Delete an AUP configuration:

>>> _, _, err = client.zpa.user_portal_aup.delete_user_portal_aup('513265')
... if err:
...     print(f"Error deleting AUP: {err}")
...     return
... print(f"AUP with ID 513265 deleted successfully.")

Delete an AUP configuration with microtenant ID:

>>> _, _, err = client.zpa.user_portal_aup.delete_user_portal_aup(
...     '513265',
...     microtenant_id='1234567890'
... )
... if err:
...     print(f"Error deleting AUP: {err}")
...     return
... print(f"AUP deleted successfully.")
get_user_portal_aup(portal_id, query_params=None)

Get information about a specific Acceptable Use Policy (AUP) configuration.

This endpoint retrieves the details of a specific AUP by its unique identifier.

Parameters:

portal_id (str) – The unique identifier of the AUP configuration.

Keyword Arguments:

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

Returns:

A tuple containing (UserPortalAUP instance, Response, error).

Return type:

Tuple

Examples

Get AUP details by ID:

>>> aup, _, err = client.zpa.user_portal_aup.get_user_portal_aup('999999')
... if err:
...     print(f"Error fetching AUP by ID: {err}")
...     return
... print(f"AUP Name: {aup.name}")
... print(f"AUP Content: {aup.aup}")
... print(f"Enabled: {aup.enabled}")

Get AUP details with microtenant ID:

>>> aup, _, err = client.zpa.user_portal_aup.get_user_portal_aup(
...     '999999',
...     query_params={'microtenant_id': '1234567890'}
... )
... if err:
...     print(f"Error fetching AUP by ID: {err}")
...     return
... print(f"Fetched AUP: {aup.as_dict()}")
list_user_portal_aup(query_params=None)

Retrieve all Acceptable Use Policy (AUP) configurations for a given customer.

This endpoint retrieves a list of all AUPs configured for the customer’s user portals. AUPs define the terms and conditions that users must accept when accessing the portal.

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}: 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 tuple containing (list of UserPortalAUP instances, Response, error).

Return type:

Tuple

Examples

List all AUPs without filtering:

>>> aup_list, _, err = client.zpa.user_portal_aup.list_user_portal_aup()
... if err:
...     print(f"Error listing AUPs: {err}")
...     return
... print(f"Total AUPs found: {len(aup_list)}")
... for aup in aup_list:
...     print(aup.as_dict())

List AUPs with query parameters and microtenant ID:

>>> aup_list, _, err = client.zpa.user_portal_aup.list_user_portal_aup(
...     query_params={'search': 'Standard AUP', 'page': '1', 'page_size': '100', 'microtenant_id': '1234567890'}
... )
... if err:
...     print(f"Error listing AUPs: {err}")
...     return
... print(f"Total AUPs found: {len(aup_list)}")
... for aup in aup_list:
...     print(f"Name: {aup.name}, Enabled: {aup.enabled}, Description: {aup.description}")
update_user_portal_aup(portal_id, **kwargs)

Update an existing Acceptable Use Policy (AUP) configuration.

This endpoint updates the specified AUP configuration with new values. Only the attributes provided in kwargs will be updated.

Parameters:

portal_id (str) – The unique identifier of the AUP configuration to update.

Keyword Arguments:
  • name (str) – The name of the AUP configuration.

  • description (str) – A description of the AUP configuration.

  • aup (str) – The Acceptable Use Policy text content that users must accept.

  • enabled (bool) – Whether the AUP is enabled.

  • email (str) – Contact email address for the AUP.

  • phone_num (str) – Contact phone number for the AUP.

  • microtenant_id (str) – The unique identifier of the microtenant, if applicable.

Returns:

A tuple containing (UserPortalAUP instance, Response, error).

Return type:

Tuple

Examples

Update an AUP configuration:

>>> updated_aup, _, err = client.zpa.user_portal_aup.update_user_portal_aup(
...     portal_id='25456654',
...     name="Updated AUP Name",
...     description="Updated description",
...     enabled=True,
...     aup="Updated AUP text content..."
... )
... if err:
...     print(f"Error updating AUP: {err}")
...     return
... print(f"AUP updated successfully: {updated_aup.as_dict()}")

Update an AUP configuration with microtenant ID:

>>> updated_aup, _, err = client.zpa.user_portal_aup.update_user_portal_aup(
...     portal_id='25456654',
...     enabled=False,
...     microtenant_id="1234567890"
... )
... if err:
...     print(f"Error updating AUP: {err}")
...     return
... print(f"AUP ID: {updated_aup.id}, Enabled: {updated_aup.enabled}")