alarms

The following methods allow for interaction with the ZTB Alarms API endpoints.

Methods are accessible via ztb.alarms

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 AlarmsAPI

Bases: APIClient

Client for the ZTB Alarms resource.

Provides CRUD operations for alarm notifications in the Zero Trust Branch API.

ASSUMPTION: Endpoint paths are based on Swagger UI screenshots showing /api/v2/alarm and related sub-paths.

bulk_acknowledge(**kwargs)

Bulk acknowledge alarms.

Parameters:

**kwargs – Bulk acknowledge payload fields.

Returns:

Tuple of (result, response, error).

Examples

>>> result, response, error = client.ztb.alarms.bulk_acknowledge(ids=["a","b"])
bulk_acknowledge_all()

Acknowledge all active alarms.

Returns:

Tuple of (result, response, error).

Examples

>>> result, response, error = client.ztb.alarms.bulk_acknowledge_all()
bulk_ignore(**kwargs)

Bulk ignore alarms.

Parameters:

**kwargs – Bulk ignore payload fields.

Returns:

Tuple of (result, response, error).

Examples

>>> result, response, error = client.ztb.alarms.bulk_ignore(ids=["a","b"])
bulk_ignore_all()

Ignore all active alarms.

Returns:

Tuple of (result, response, error).

Examples

>>> result, response, error = client.ztb.alarms.bulk_ignore_all()
create_alarm(**kwargs)

Create a new alarm.

Parameters:

**kwargs – Alarm creation fields.

Returns:

Tuple of (Alarm instance, response, error).

Examples

>>> alarm, response, error = client.ztb.alarms.create_alarm(name="test")
delete_alarm(alarm_id)

Deletes the specified Alarm.

Parameters:

alarm_id (str) – The unique identifier of the Alarm.

Returns:

A tuple containing the response object and error (if any).

Return type:

tuple

Examples

Delete a Alarm:

>>> _, _, error = client.ztb.alarms.delete_alarm('73459')
>>> if error:
...     print(f"Error deleting Alarm: {error}")
...     return
... print(f"Alarm with ID {'73459' deleted successfully.")
get_alarm(alarm_id)

Get a single alarm by ID.

Parameters:

alarm_id – The alarm identifier.

Returns:

Tuple of (Alarm instance, response, error).

Examples

>>> alarm, response, error = client.ztb.alarms.get_alarm("abc-123")
list_alarms(query_params=None)

Get all alarms.

Returns:

Tuple of (result_list, response, error).

Parameters:

query_params (dict) –

Map of query parameters for the request.

[query_params.search] (str): String used to partially match against a location’s name and port attributes.

[query_params.tab] (str): Parameter was deprecated and no longer has an effect on SSL policy.

[query_params.page] (int):

[query_params.size] (int):

[query_params.sort] (str):

[query_params.sortdir] (str):

[query_params.site_id] (str):

[query_params.severity] (str):

Examples

>>> alarms, response, error = client.ztb.alarms.list_alarms()

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_alarm_patch(**kwargs)

Update an alarm (PATCH).

Parameters:
  • alarm_id – The alarm identifier.

  • **kwargs – Alarm update fields.

Returns:

Tuple of (Alarm instance, response, error).

Examples

>>> alarm, response, error = client.ztb.alarms.update_alarm("abc-123", status="active")
update_alarm_put(**kwargs)

Update an alarm (PUT).

Parameters:
  • alarm_id – The alarm identifier.

  • **kwargs – Full alarm replacement fields.

Returns:

Tuple of (Alarm instance, response, error).

Examples

>>> alarm, response, error = client.ztb.alarms.update_alarm_put("abc-123", name="new")