Skip to main content

TrafficCaptureRule

Traffic Capture Rule resource for Zscaler Internet Access.

Resource operations

This resource supports the following standard methods: create(), load(), update(), delete(). They operate on the instance state — set properties with dot notation, then call the method with no arguments. Any other action listed below is a custom action that takes explicit keyword arguments and returns a value.

Quick Start​

import zssdk
import logging

# Enable debug logging for TrafficCaptureRule
logging.getLogger('zssdk.zia').setLevel(logging.DEBUG)
logging.basicConfig(level=logging.DEBUG)

session = zssdk.Session(
vanity_domain="your-vanity-domain",
client_id="your-client-id",
client_secret="your-client-secret",
)

# Get a specific TrafficCaptureRule
resource = session.zia.TrafficCaptureRule(id="your-resource-id")
resource.load()
print(resource)

# Debug output shows HTTP request/response details

Identifiers​

NameTypeDescription
idstringUnique identifier

Actions​

create()​

Creates a new TrafficCaptureRule. Set properties on the resource instance, then call create() — this method takes no arguments.

Properties for creation:

NameTypeRequiredDescription
access_controlstringNo-
actionstringNo-
app_service_groupsEntityReferenceWrapperCollectionNo-
capture_PCAPbooleanNo-
default_rulebooleanNo-
departmentsEntityReferenceWrapperCollectionNo-
descriptionstringNo-
dest_addressesstringCollectionNo-
dest_countriesDestCountriesEnumCollectionNo-
dest_ip_groupsEntityReferenceWrapperCollectionNo-
dest_ipv6_groupsEntityReferenceWrapperCollectionNo-
device_groupsEntityReferenceWrapperCollectionNo-
device_trust_levelsDeviceTrustLevelsEnumCollectionNo-
devicesEntityReferenceWrapperCollectionNo-
exclude_src_countriesbooleanNo-
groupsEntityReferenceWrapperCollectionNo-
idintegerNo-
internal_dest_FQDNsstringCollectionNo-
internal_dest_ipsstringCollectionNo-
labelsEntityReferenceWrapperCollectionNo-
last_modified_byEntityReferenceNo-
last_modified_timeintegerNo-
location_groupsEntityReferenceWrapperCollectionNo-
locationsEntityReferenceWrapperCollectionNo-
namestringNo-
nw_application_groupsEntityReferenceWrapperCollectionNo-
nw_applicationsNwApplicationsEnumCollectionNo-
nw_service_groupsEntityReferenceWrapperCollectionNo-
nw_servicesEntityReferenceWrapperCollectionNo-
orderintegerNo-
pcap_actionbooleanNo-
predefinedbooleanNo-
rankintegerNo-
source_countriesDestCountriesEnumCollectionNo-
src_ip_groupsEntityReferenceWrapperCollectionNo-
src_ipsstringCollectionNo-
src_ipv6_groupsEntityReferenceWrapperCollectionNo-
statestringNo-
template_synced_rule_flagstringNo-
time_windowsEntityReferenceWrapperCollectionNo-
txn_samplingstringNo-
txn_size_limitstringNo-
usersEntityReferenceWrapperCollectionNo-
workload_groupsWorkloadGroupWrapperCollectionNo-
zpa_app_segmentsAppSegmentWrapperCollectionNo-

Returns: TrafficCaptureRule

Example:

resource = session.zia.TrafficCaptureRule()
resource.access_control = "value"
resource.action = "value"
resource.app_service_groups = [{"association_time": 3600, "deleted": True, "extensions": {"key1": "value", "key2": "value"}, "external_id": "resource-id"}]
resource.create()
print(f"Created with ID: {resource.id}")

delete()​

Deletes a TrafficCaptureRule by id. Only the id identifier is required; delete() takes no other arguments.

Example:

resource = session.zia.TrafficCaptureRule(id="your-resource-id")
resource.delete()

get_traffic_capture_rule_count()​

Parameters:

NameTypeRequiredDescription
rule_namestringNo-
rule_labelstringNo-
rule_label_idintegerNo-
rule_orderstringNo-
rule_descriptionstringNo-
rule_actionstringNo-
locationstringNo-
departmentstringNo-
groupstringNo-
userstringNo-
devicestringNo-
device_groupstringNo-
device_trust_levelstringNo-

Example:

resource = session.zia.TrafficCaptureRule()
result = resource.get_traffic_capture_rule_count()
print(result)

get_traffic_capture_rule_order_info()​

Returns: TrafficCaptureRuleOrderInfo

Example:

resource = session.zia.TrafficCaptureRule()
result = resource.get_traffic_capture_rule_order_info()
print(result)

load()​

Fetches an existing TrafficCaptureRule by id. Only the id identifier is required; load() takes no other arguments.

Returns: TrafficCaptureRule

Example:

resource = session.zia.TrafficCaptureRule(id="your-resource-id")
resource.load()
print(resource.name)

update()​

Updates an existing TrafficCaptureRule. Call load() first, modify properties, then call update() — this method takes no arguments.

Properties for update:

NameTypeRequiredDescription
access_controlstringNo-
actionstringNo-
app_service_groupsEntityReferenceWrapperCollectionNo-
capture_PCAPbooleanNo-
default_rulebooleanNo-
departmentsEntityReferenceWrapperCollectionNo-
descriptionstringNo-
dest_addressesstringCollectionNo-
dest_countriesDestCountriesEnumCollectionNo-
dest_ip_groupsEntityReferenceWrapperCollectionNo-
dest_ipv6_groupsEntityReferenceWrapperCollectionNo-
device_groupsEntityReferenceWrapperCollectionNo-
device_trust_levelsDeviceTrustLevelsEnumCollectionNo-
devicesEntityReferenceWrapperCollectionNo-
exclude_src_countriesbooleanNo-
groupsEntityReferenceWrapperCollectionNo-
idintegerYes-
internal_dest_FQDNsstringCollectionNo-
internal_dest_ipsstringCollectionNo-
labelsEntityReferenceWrapperCollectionNo-
last_modified_byEntityReferenceNo-
last_modified_timeintegerNo-
location_groupsEntityReferenceWrapperCollectionNo-
locationsEntityReferenceWrapperCollectionNo-
namestringNo-
nw_application_groupsEntityReferenceWrapperCollectionNo-
nw_applicationsNwApplicationsEnumCollectionNo-
nw_service_groupsEntityReferenceWrapperCollectionNo-
nw_servicesEntityReferenceWrapperCollectionNo-
orderintegerNo-
pcap_actionbooleanNo-
predefinedbooleanNo-
rankintegerNo-
source_countriesDestCountriesEnumCollectionNo-
src_ip_groupsEntityReferenceWrapperCollectionNo-
src_ipsstringCollectionNo-
src_ipv6_groupsEntityReferenceWrapperCollectionNo-
statestringNo-
template_synced_rule_flagstringNo-
time_windowsEntityReferenceWrapperCollectionNo-
txn_samplingstringNo-
txn_size_limitstringNo-
usersEntityReferenceWrapperCollectionNo-
workload_groupsWorkloadGroupWrapperCollectionNo-
zpa_app_segmentsAppSegmentWrapperCollectionNo-

Returns: TrafficCaptureRule

Example:

resource = session.zia.TrafficCaptureRule(id="your-resource-id")
resource.load()
resource.name = "Updated value"
resource.update()

Attributes​

NameTypeRequiredDescription
access_controlstringNo-
actionstringNo-
app_service_groupsEntityReferenceWrapperCollectionNo-
capture_PCAPbooleanNo-
default_rulebooleanNo-
departmentsEntityReferenceWrapperCollectionNo-
descriptionstringNo-
dest_addressesstringCollectionNo-
dest_countriesDestCountriesEnumCollectionNo-
dest_ip_groupsEntityReferenceWrapperCollectionNo-
dest_ipv6_groupsEntityReferenceWrapperCollectionNo-
device_groupsEntityReferenceWrapperCollectionNo-
device_trust_levelsDeviceTrustLevelsEnumCollectionNo-
devicesEntityReferenceWrapperCollectionNo-
exclude_src_countriesbooleanNo-
groupsEntityReferenceWrapperCollectionNo-
idintegerNo-
internal_dest_FQDNsstringCollectionNo-
internal_dest_ipsstringCollectionNo-
labelsEntityReferenceWrapperCollectionNo-
last_modified_byEntityReferenceNo-
last_modified_timeintegerNo-
location_groupsEntityReferenceWrapperCollectionNo-
locationsEntityReferenceWrapperCollectionNo-
namestringNo-
nw_application_groupsEntityReferenceWrapperCollectionNo-
nw_applicationsNwApplicationsEnumCollectionNo-
nw_service_groupsEntityReferenceWrapperCollectionNo-
nw_servicesEntityReferenceWrapperCollectionNo-
orderintegerNo-
pcap_actionbooleanNo-
predefinedbooleanNo-
rankintegerNo-
source_countriesDestCountriesEnumCollectionNo-
src_ip_groupsEntityReferenceWrapperCollectionNo-
src_ipsstringCollectionNo-
src_ipv6_groupsEntityReferenceWrapperCollectionNo-
statestringNo-
template_synced_rule_flagstringNo-
time_windowsEntityReferenceWrapperCollectionNo-
txn_samplingstringNo-
txn_size_limitstringNo-
usersEntityReferenceWrapperCollectionNo-
workload_groupsWorkloadGroupWrapperCollectionNo-
zpa_app_segmentsAppSegmentWrapperCollectionNo-