customer_domain

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

Methods are accessible via zpa.customer_domain

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 CustomerDomainControllerAPI

Bases: APIClient

A client object for the Customer Domain Controller resource.

add_update_domain(type, domain_list, microtenant_id=None)

Add or update domains for a customer. Association type field in request body is ignored and is overwritten with association type provided as part of the url

Parameters:
  • type (str) – Association type name. Supported Values: SHARED and SEARCH_SUFFIX

  • domain_list (list) – List of domain objects to add/update. Each domain object should contain: - domain (str): The domain name - capture (bool): Whether to capture traffic for this domain - name (dict, optional): Domain name object (usually empty {}) Pass an empty list [] to remove all domains.

Returns:

A tuple containing (CustomerDomainController instance, Response, error)
  • CustomerDomainController: The created/updated customer domain object or success status

  • Response: HTTP response object (None for 204 No Content)

  • error: Error object if an error occurred, None otherwise

Return type:

Tuple

Example

# Add multiple domains in a single request >>> added_domain, _, err = client.zpa.customer_domain.add_update_domain( … type=”SEARCH_SUFFIX”, … domain_list=[ … { … “domain”: “example1.com”, … “capture”: True … }, … { … “domain”: “example2.com”, … “capture”: False … } … ] … ) >>> if err: … print(f”Error adding/updating domains: {err}”) … return … print(f”Successfully added/updated domains: {result.as_dict()}”)

# Remove all domains >>> added_domain, _, err = client.zpa.customer_domain.add_update_domain( … type=”SEARCH_SUFFIX”, … domain_list=[] … ) >>> if err: … print(f”Error removing all domains: {err}”) … return … print(f”Successfully removed all domains: {result.as_dict()}”)

list_domains(type, query_params=None)

Get all customer domains.

Parameters:

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

Returns:

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

Return type:

Tuple

Example

Fetch all customer domains

>>> domain_list, _, err = client.zpa.customer_domain.list_domains()
... if err:
...     print(f"Error listing domains: {err}")
...     return
... print(f"Total domains found: {len(domain_list)}")
... for domain in domain_list:
...     print(domain.as_dict())