def _get_proto_by_id(cls, conn, id): msg = _AlertService.FindAlertRequest( ids=[int(id)], page_number=1, page_limit=-1, ) endpoint = "/api/v1/alerts/findAlert" response = conn.make_proto_request("POST", endpoint, body=msg) alerts = conn.must_proto_response(response, msg.Response).alerts if len(alerts) > 1: warnings.warn( "unexpectedly found multiple alerts with the same name and" " monitored entity ID") return alerts[0]
def __init__(self, conn, conf): super(AlertsPaginatedIterable, self).__init__( conn, conf, _AlertService.FindAlertRequest(), )