Source code for api.eventfilters.v1.filter

"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command


[docs]@register_command(extending=('eventfilters','v1','filter')) def list(search: str = None, customerID: list = None, type: str = None, limit: int = 25, offset: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List filters (INTERNAL) :param str search: Limit result to filters matching this searchstring :param list customerID: Limit result to filters for this customerID :param str type: Limit result to filters of this type :param int limit: Limit result :param int offset: Offset result :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 622, "limit": 546, "responseCode": 200, "count": 477, "data": [{"revision": 633, "deleted": true, "information": "Move describe speech instead security structure fall.", "masterID": 467, "expired": false, "valid": false, "enabled": false, "index": 564, "flags": 797, "labels": ["During live without ground rock."], "description": "Too memory benefit.", "id": 431, "lastUpdatedTimestamp": 830167045, "validFromTimestamp": 1439347248, "validToTimestamp": 1014671162, "lastUpdatedByUser": {"id": 184, "customerID": 113, "userName": "smithdustin", "name": "Tyler Grant"}, "createdTimestamp": 436404805}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Front store them second its agency model.", "messageTemplate": "Wish hour expert rise true.", "field": "Keep you size box mention season high.", "parameter": {}, "timestamp": 486384201}], "currentPage": 912, "size": 17} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/eventfilters/v1/filter".format() headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} if limit: body.update({"limit": limit}) if offset: body.update({"offset": offset}) if search: body.update({"search": search}) if customerID: body.update({"customerID": customerID}) if type: body.update({"type": type}) response = get(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=('eventfilters','v1','filter')) def error_stats(includeDetails: bool = 'True',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch filter error statistics (INTERNAL) :param bool includeDetails: If true, include detailed error statistics per processing node :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :returns: {} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/eventfilters/v1/filter/errorstats".format() headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} if includeDetails: body.update({"includeDetails": includeDetails}) response = get(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=('eventfilters','v1','filter')) def hit_stats(period: int = 3600000, includeDetails: bool = 'True',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch filter error statistics (INTERNAL) :param int period: Time period to fetch hit stats for (milliseconds) :param bool includeDetails: If true, include details about hits per processing node :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :returns: {} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/eventfilters/v1/filter/hitstats".format() headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} if period: body.update({"period": period}) if includeDetails: body.update({"includeDetails": includeDetails}) response = get(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=('eventfilters','v1','filter')) def get(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch filter (INTERNAL) :param int id: ID of filter to fetch :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 845, "limit": 222, "responseCode": 200, "count": 556, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Reach produce these pay party themselves.", "messageTemplate": "Decide democratic teacher exist late above fill bag.", "field": "Election various hold discuss during officer.", "parameter": {}, "timestamp": 796347506}], "currentPage": 332, "size": 977} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/eventfilters/v1/filter/{id}".format(id=id) headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} response = get(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=('eventfilters','v1','filter')) def set_log_level(id: int, level: str = None, instanceID: int = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Set log level for specified filter (INTERNAL) :param int id: ID of event filter :param str level: Log level to be set for event filter :param int instanceID: ID of component instance to set log level for event filter, if not provided will set across instances :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :raises OperationTimeoutException: on 408 :returns: {} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/eventfilters/v1/filter/{id}/logging".format(id=id) headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} if level: body.update({"level": level}) if instanceID: body.update({"instanceID": instanceID}) response = put(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=('eventfilters','v1','filter')) def revisions(id: int, limit: int = 25, offset: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch filter revisions by filter ID (INTERNAL) :param int id: Fetch revisions for filter with this ID :param int limit: Limit result :param int offset: Offset result :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 483, "limit": 692, "responseCode": 200, "count": 462, "data": [{"revision": 344, "deleted": true, "information": "Growth others population.", "masterID": 221, "expired": false, "valid": false, "enabled": false, "index": 123, "flags": 888, "labels": ["Cover society brother about brother recently better."], "description": "Soon son plan join then sing.", "id": 106, "lastUpdatedTimestamp": 1410962745, "validFromTimestamp": 851000157, "validToTimestamp": 1155690561, "lastUpdatedByUser": {"id": 426, "customerID": 249, "userName": "james14", "name": "Natalie Walker"}, "createdTimestamp": 86129423}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Suffer recently international end oil.", "messageTemplate": "Expect view improve record book natural health.", "field": "Western front once night back career quite.", "parameter": {}, "timestamp": 363320766}], "currentPage": 421, "size": 311} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/eventfilters/v1/filter/{id}/revisions".format(id=id) headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} if limit: body.update({"limit": limit}) if offset: body.update({"offset": offset}) response = get(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response