labels#
The following methods allow for interaction with the ZIA Rule Labels API endpoints.
Methods are accessible via zia.labels
- class RuleLabelsAPI#
Bases:
object
- add_label(name, **kwargs)#
Creates a new ZIA Rule Label.
- Parameters:
name (str) – The name of the Rule Label.
- Keyword Arguments:
description (str) – Additional information about the Rule Label.
- Returns:
The newly added Rule Label resource record.
- Return type:
Box
Examples
Add a label with default parameters:
>>> label = zia.labels.add_label("My New Label")
Add a label with description:
>>> label = zia.labels.add_label("My Second Label": ... description="My second label description")
- delete_label(label_id)#
Deletes the specified Rule Label.
- Parameters:
label_id (str) – The unique identifier of the Rule Label that will be deleted.
- Returns:
The response code for the request.
- Return type:
- Examples
>>> user = zia.labels.delete_label('99999')
- get_label(label_id)#
Returns the label details for a given Rule Label.
- Parameters:
label_id (str) – The unique identifier for the Rule Label.
- Returns:
The Rule Label resource record.
- Return type:
Box
Examples
>>> label = zia.labels.get_label('99999')
- list_labels(**kwargs)#
Returns the list of ZIA Rule Labels.
- Keyword Arguments:
**max_items (int, optional) – The maximum number of items to request before stopping iteration.
**max_pages (int, optional) – The maximum number of pages to request before stopping iteration.
**page_size (int, optional) – Specifies the page size. The default size is 100, but the maximum size is 1000.
- Returns:
The list of Rule Labels configured in ZIA.
- Return type:
BoxList
Examples
List Rule Labels using default settings:
>>> for label in zia.labels.list_labels(): ... print(label)
List labels, limiting to a maximum of 10 items:
>>> for label in zia.labels.list_labels(max_items=10): ... print(label)
List labels, returning 200 items per page for a maximum of 2 pages:
>>> for label in zia.labels.list_labels(page_size=200, max_pages=2): ... print(label)
- update_label(label_id, **kwargs)#
Updates information for the specified ZIA Rule Label.
- Parameters:
label_id (str) – The unique id for the Rule Label that will be updated.
- Keyword Arguments:
- Returns:
The updated Rule Label resource record.
- Return type:
Box
Examples
Update the name of a Rule Label:
>>> label = zia.labels.update_label(99999, ... name="Updated Label Name")
Update the name and description of a Rule Label:
>>> label = zia.labels.update_label(99999, ... name="Updated Label Name", ... description="Updated Label Description")