policy_comments

The following methods allow for interaction with the ZTB Policy Comments API endpoints. Includes list, create, update, and delete operations for policy comments (application, endpoint, killswitch, network policy types).

Methods are accessible via ztb.policy_comments

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 PolicyCommentsAPI

Bases: APIClient

Client for the ZTB Policy Comments resource.

Provides CRUD operations for policy comments in the Zero Trust Branch API. Endpoints under /api/v3/policy-comments/comment/.

create_comment(policy_id, comment, policy_type='application', query_params=None)

Create a comment for a policy.

Parameters:
  • policy_id (str) – The policy ID.

  • comment (str) – Comment text.

  • policy_type (str) – Policy type. Available values: application, endpoint, killswitch, network. Default: application.

  • query_params (dict, optional) – Additional query parameters.

Returns:

(PolicyCommentResponse or None, Response, error).

Return type:

tuple

Examples

>>> resp_data, _, err = client.ztb.policy_comments.create_comment(
...     "policy-123", "My comment", policy_type="application"
... )
delete_comment(comment_id)

Delete a policy comment.

Parameters:

comment_id (str) – The comment ID.

Returns:

(PolicyCommentResponse or None, Response, error).

Return type:

tuple

Examples

>>> resp_data, _, err = client.ztb.policy_comments.delete_comment(
...     "comment-456"
... )
list_comments(policy_id, policy_type='application', query_params=None)

Get all comments for a policy.

Parameters:
  • policy_id (str) – The policy ID.

  • policy_type (str) – Policy type. Available values: application, endpoint, killswitch, network. Default: application.

  • query_params (dict, optional) – Additional query parameters.

Returns:

(list of PolicyComment instances, Response, error).

Return type:

tuple

Examples

>>> comments, _, err = client.ztb.policy_comments.list_comments(
...     "policy-123", policy_type="application"
... )
update_comment(comment_id, comment)

Update a policy comment.

Parameters:
  • comment_id (str) – The comment ID.

  • comment (str) – Updated comment text.

Returns:

(None, Response, error).

Return type:

tuple

Examples

>>> _, _, err = client.ztb.policy_comments.update_comment(
...     "comment-456", "Updated comment text"
... )