location_controller

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

Methods are accessible via zpa.location_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 LocationControllerAPI

Bases: APIClient

A Client object for the Location Controller resource.

get_location_extranet_resource(zpn_er_id, query_params=None)

Gets information on the specified location extranet resource.

Parameters:
  • zpn_er_id (str) – The unique identifier of the ZPN extranet resource.

  • {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 500.

    [query_params.search] {str}: Search string for filtering results. [query_params.fetch_sub_locations] {bool}: Fetch sub-locations for the specified location.

Returns:

ExtranetResource: The corresponding location extranet resource object.

Return type:

Tuple

Example

Retrieve details of a specific extranet resource

>>> fetched_extranet_resource, _, err = client.zpa.location_controller.get_location_extranet_resource('999999')
... if err:
...     print(f"Error fetching location extranet resource by ID: {err}")
...     return
... print(f"Fetched location extranet resource by ID: {fetched_extranet_resource.as_dict()}")
get_location_group_extranet_resource(zpn_er_id, query_params=None)

Get information about location groups associated with a specific extranet resource.

This endpoint retrieves a paginated list of location groups that are associated with the specified extranet resource. Each location group includes its associated ZIA locations (ziaLocations).

Parameters:

zpn_er_id (str) – The unique identifier of the ZPN extranet resource.

Keyword Arguments:

{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 500.

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

[query_params.is_special_location_group_included] {bool}: Include special location groups in the response.

Returns:

A tuple containing (list of LocationGroupDTO instances, Response, error).

Each LocationGroupDTO includes: - id: The unique identifier of the location group - name: The name of the location group - zia_locations: List of ZIA locations associated with the location group

Return type:

Tuple

Examples

Get location groups for an extranet resource:

>>> location_groups, _, err = (
...     client.zpa.location_controller.get_location_group_extranet_resource(
...         '72058304855108633'
...     )
... )
... if err:
...     print(f"Error fetching location groups: {err}")
...     return
... print(f"Total location groups found: {len(location_groups)}")
... for group in location_groups:
...     print(f"Group: {group.name} (ID: {group.id})")
...     print(f"  ZIA Locations: {len(group.zia_locations)}")
...     for location in group.zia_locations:
...         print(f"    - {location.name} (ID: {location.id})")

Get location groups with pagination and search:

>>> location_groups, _, err = client.zpa.location_controller.get_location_group_extranet_resource(
...     '72058304855108633',
...     query_params={
...         'page': '1',
...         'page_size': '100',
...         'search': 'Extranet',
...         'is_special_location_group_included': True
...     }
... )
... if err:
...     print(f"Error fetching location groups: {err}")
...     return
... for group in location_groups:
...     print(group.as_dict())
get_location_summary(query_params=None)

Get all Location ID and names configured for a given customer.

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 500.

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

Returns:

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

Return type:

Tuple

Examples

>>> location_list, _, err = client.zpa.location_controller.get_location_summary(
... query_params={'search': 'Location01', 'page': '1', 'page_size': '100'})
... if err:
...     print(f"Error listing locations: {err}")
...     return
... print(f"Total locations found: {len(location_list)}")
... for location in location_list:
...     print(location.as_dict())