audit_data_handling

The following methods allow for interaction with the ZCell Audit Data Handling API endpoints. Includes searching audit records for a customer and retrieving audit metadata.

Methods are accessible via zcell.audit_data_handling

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 AuditDataHandlingAPI

Bases: APIClient

Returns all audit log based on filters.

The filter is sent as a flat JSON request body (not query params). Because the body carries a startDate / endDate epoch-seconds window, the days shorthand is supported and fills both accordingly.

Parameters:
  • id (str) – Optional. The ZCell customer ID. Defaults to the zcellCustomerId config value or the ZCELL_CUSTOMER_ID environment variable when omitted.

  • days (int) – Convenience shorthand — sets a [now - days, now] startDate/endDate epoch-seconds body window.

  • **kwargs – Request body fields (flat). Supported fields: [start_date] {int}: Start of the audit range (epoch seconds). [end_date] {int}: End of the audit range (epoch seconds). [operation_type] {str}: One of Create, Update, Delete, Export. [object_type] {str}: Object type filter. [object_name] {str}: Object name filter. [object_id] {int}: Object ID filter. [visibility] {str}: One of Customer, Root. [customer_id] {str}: Customer ID filter (ROOT only; ignored for non-root tenants). [modified_by_user_id] {str}: Modified-by user ID filter.

  • query_params (dict) – Map of query parameters for the request. [query_params.page] {int}: Page number (0-based) [query_params.size] {int}: Page size (1-100) [query_params.sort_by] {str}: Field to sort by. Default: creationTime. Sortable fields: creationTime, auditOperationType, objectType, objectName, objectId, customerId, visibility [query_params.sort_dir] {str}: ASC or DESC. Default: DESC

Returns:

(result, Response, error)

Return type:

tuple

The returned response supports resp.search(<jmespath>) for client-side filtering/projection of the current page.

Examples

Search audit entries for a customer over the last 14 days:

>>> results, _, error = client.zcell.audit_data_handling.list_audit_customers_search(
...     id='gi754cvqb07r0',
...     days=14,
...     visibility='Customer',
... )
>>> if error:
...     print(f"Error: {error}")
...     return
>>> for item in results:
...     print(item.as_dict())

Provide an explicit window instead of the days shorthand:

>>> results, _, error = client.zcell.audit_data_handling.list_audit_customers_search(
...     id='gi754cvqb07r0',
...     start_date=1781296768,
...     end_date=1782506368,
...     visibility='Customer',
... )
list_audit_metadata(query_params=None)

Returns metadata for audit.

Parameters:

query_params (dict) – Map of query parameters for the request.

Returns:

(result, Response, error)

Return type:

tuple

The returned response supports resp.search(<jmespath>) for client-side filtering/projection of the current page.

Examples

>>> results, response, error = client.zcell.audit_data_handling.list_audit_metadata()
>>> if error:
...     print(f"Error: {error}")
...     return
>>> for item in results:
...     print(item.as_dict())