administrator_controller

The following methods allow for interaction with the ZPA Administrator Controller API endpoints.

Methods are accessible via zpa.administrator_controller

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 AdministratorControllerAPI

Bases: APIClient

A Client object for the administrator controller resource.

add_administrator(**kwargs)

Adds a new ZPA admministrator.

Parameters:

name (str) – The name of the Administrator.

Keyword Args:

Returns:

A tuple containing (AdministratorController, Response, error)

Return type:

Tuple

Examples

Adding a new local administrator account

>>> added_admin, _, err = client.zpa.administrator_controller.add_administrator(
...     username="jdoe@0000004767847.zpa-customer.com",
...     email="jdoe@0000004767847.zpa-customer.com",
...     display_name="John Doe",
...     password="",
...     confirm_password="",
...     is_enabled=True,
...     role_id="12",
...     role={
...         "id": "12",
...     },
...     eula="0"
... )
>>> if err:
...     print(f"Error adding administrator: {err}")
...     return
... print(f"Administrator added successfully: {added_admin.as_dict()}")
delete_administrator(admin_id, microtenant_id=None)

Deletes the specified Administrator from ZPA.

Parameters:
  • admin_id (str) – The unique identifier for the Administrator

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

Returns:

A tuple containing the response and error (if any).

Return type:

tuple

Examples

>>> _, _, err = client.zpa.administrator_controller.delete_administrator(
...     admin_id='999999'
... )
... if err:
...     print(f"Error deleting administrator: {err}")
...     return
... print(f"administrator with ID {'999999'} deleted successfully.")
get_administrator(admin_id, query_params=None)

Fetches a specific administrator details by ID.

Parameters:
  • admin_id (str) – The unique identifier for the administrator.

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

Returns:

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

Return type:

Tuple

Examples

>>> fetched_admin, _, err = client.zpa.administrator_controller.get_administrator('999999')
... if err:
...     print(f"Error fetching admin by ID: {err}")
...     return
... print(f"Fetched admin by ID: {fetched_admin.as_dict()}")
list_administrators(query_params=None)

Get all administrators in a company/customer. A mmaximum of 200 administrators are returned per request.

Parameters:

{dict} (query_params) –

Map of query parameters for the request.

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

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

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

[query_params.search] {str}: Search string for filtering results.

[query_params.microtenant_id] {str}: The unique identifier of the microtenant of ZPA tenant.

Returns:

A tuple containing (list of AdministratorController instances, Response, error)

Return type:

Tuple

Examples

>>> admin_list, _, err = client.zpa.administrator_controller.list_administrators()
... if err:
...     print(f"Error listing administrors: {err}")
...     return
... print(f"Total administrators found: {len(admin_list)}")
... for admin in admins:
...     print(admin.as_dict())
update_administrator(admin_id, **kwargs)

Updates an existing ZPA c.

Parameters:

admin_id (str) – The unique id for the Administrator in ZPA.

Keyword Args:

Returns:

A tuple containing (AppConnectorGroup, Response, error)

Return type:

tuple

Examples

Updating a new local administrator account

>>> updated_admin, _, err = client.zpa.administrator_controller.add_administrator(
...     admin_id='876678896',
...     username="jdoe@0000004767847.zpa-customer.com",
...     email="jdoe@0000004767847.zpa-customer.com",
...     display_name="John Doe",
...     password="",
...     confirm_password="",
...     is_enabled=True,
...     role_id="12",
...     phone_number="+1 408-9899",
...     role={
...         "id": "12",
...     },
...     eula="0"
... )
>>> if err:
...     print(f"Error updating administrator: {err}")
...     return
... print(f"Administrator updated successfully: {updated_admin.as_dict()}")