site¶
The following methods allow for interaction with the ZTB Site API endpoints. Includes site CRUD, app segments, cloud site creation, hostname config, site names, overview, static IP mapping, and template management.
Methods are accessible via ztb.site
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 SiteAPI¶
Bases:
APIClientClient for the ZTB Site resource.
Provides CRUD and utility operations for sites in the Zero Trust Branch API. Endpoints under
/api/v2/Site/.- create_cloud_site(body=None, **kwargs)¶
Create a cloud gateway site.
- Parameters:
body (CloudSiteCreateBody, optional) – Create payload.
**kwargs – Override body fields.
- Returns:
(response data or None, Response, error).
- Return type:
- create_site(**kwargs)¶
Create a new site.
- Parameters:
**kwargs – Site fields (e.g. name, display_name, deployment_type, etc).
- Returns:
(created Site or None, Response, error).
- Return type:
- delete_site(site_id)¶
Delete a site.
- get_hostname_config(gateway_ipaddress, site_name, query_params=None)¶
Get hostname config.
- get_site_by_id(site_id)¶
Get site by ID.
- get_site_by_name(name)¶
Get site by name.
- get_site_overview(site_id)¶
Get site overview data.
- list_app_segments(query_params=None)¶
Get list of ZPA app segments with pagination.
- Parameters:
query_params (dict, optional) – page, limit, search.
- Returns:
(list of AppSegment, Response, error).
Client-side filtering with JMESPath:
The response object supports client-side filtering and projection via
resp.search(expression). See the JMESPath documentation for expression syntax.- Return type:
- list_site_names(query_params=None)¶
Get all site names.
- Parameters:
query_params (dict, optional) – siteId, gatewayType, full.
- Returns:
(list of SiteNameItem, Response, error).
Client-side filtering with JMESPath:
The response object supports client-side filtering and projection via
resp.search(expression). See the JMESPath documentation for expression syntax.- Return type:
- list_sites(query_params=None)¶
Get list of sites with pagination and search.
- Parameters:
query_params (dict, optional) – Map of query parameters.
[query_params.search](str): Search filter.[query_params.page](int): Page number.[query_params.limit](int): Page size.[query_params.sort](str): Sort field.[query_params.sortdir](str): asc or desc.[query_params.siteId](str): Site ID filter.[query_params.gatewayType](str): Gateway type filter.- Returns:
(list of Site instances, Response, error).
- Return type:
Examples
>>> sites, _, err = client.ztb.site.list_sites() >>> sites, _, err = client.ztb.site.list_sites( ... query_params={"search": "prod", "page": 1, "limit": 25} ... )
Client-side filtering with JMESPath:
The response object supports client-side filtering and projection via
resp.search(expression). See the JMESPath documentation for expression syntax.
- update_app_segments(site_id)¶
Update ZPA app segments for a site.
- update_site(site_id, body=None, **kwargs)¶
Update a site.
- update_site_template(site_id, template_id)¶
Change template for a site.