"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('system','notification','v1','rule'))
def list(includeDeleted: bool = None, includeFlags: int = None, excludeFlags: int = None, customerID: list = None, includeGlobal: bool = None, offset: int = None, events: list = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""List notification rules (INTERNAL)
:param bool includeDeleted: Include deleted rules
:param int includeFlags: Limit result to rules with these flagbits set
:param int excludeFlags: Limit result to rules with these flagbits unset
:param list customerID: Limit result to rules for these customers
:param bool includeGlobal: Include global rules
:param int offset: Offset result
:param list events: Limit result to rules for these events
:param int limit: Limit result
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 493, "limit": 855, "responseCode": 200, "count": 157, "data": [{"id": 816, "revision": 776, "name": "Dale Vasquez", "matchRule": "Subject coach cover use.", "index": 625, "flags": 878, "actions": [{"changeMatching": "Far around item international.", "changeTypes": ["SMS"], "changeFormats": ["BRIEF"], "changeRoles": ["CC"], "sender": "Fund development on stand food.", "setFlags": 522, "unsetFlags": 502, "subjectTemplate": {"additionalProperties": "Everybody window service issue law."}, "bodyTemplate": {"additionalProperties": "Point note development word happy several sense candidate."}, "smsTemplate": {"additionalProperties": "Marriage determine military need produce doctor."}}], "additionalDestinations": [{"role": "REPORTER", "name": "Anna Maxwell", "destination": "Such able character partner.", "language": "ENGLISH", "flags": 929}], "timestamp": 1220646578, "lastUpdatedTimestamp": 563527190, "lastUpdatedByUser": {"id": 176, "customerID": 699, "userName": "nicholassexton", "name": "Crystal Baker"}, "events": ["Lay toward may feeling floor cost certain."], "globalCustomer": false}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Sure kind cut central board Democrat whom.", "messageTemplate": "Stop break theory support work feel hair month.", "field": "Fall report partner on true book.", "parameter": {}, "timestamp": 460088021}], "currentPage": 932, "size": 19}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule".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 includeDeleted:
body.update({"includeDeleted": includeDeleted})
if includeFlags:
body.update({"includeFlags": includeFlags})
if excludeFlags:
body.update({"excludeFlags": excludeFlags})
if customerID:
body.update({"customerID": customerID})
if includeGlobal:
body.update({"includeGlobal": includeGlobal})
if offset:
body.update({"offset": offset})
if events:
body.update({"events": events})
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=('system','notification','v1','rule'))
def create(name: str = None, matchRule: str = None, customerID: int = None, setFlags: int = None, actions: list = None, additionalDestinations: list = None, events: list = None, index: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Add notification rule (INTERNAL)
:param str name: Notification rule name => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str matchRule:
:param int customerID:
:param int setFlags:
:param list actions: Actions
:param list additionalDestinations:
:param list events:
:param int index: index (default 0)
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 420, "limit": 543, "responseCode": 200, "count": 994, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Model personal behavior manage see.", "messageTemplate": "Product staff must nothing.", "field": "Western west heart board.", "parameter": {}, "timestamp": 184548869}], "currentPage": 542, "size": 768}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule".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 name:
body.update({"name": name})
if matchRule:
body.update({"matchRule": matchRule})
if customerID:
body.update({"customerID": customerID})
if index:
body.update({"index": index})
if setFlags:
body.update({"setFlags": setFlags})
if actions:
body.update({"actions": actions})
if additionalDestinations:
body.update({"additionalDestinations": additionalDestinations})
if events:
body.update({"events": events})
response = post(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=('system','notification','v1','rule'))
def get_rule_by_id(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Fetch notification rule (INTERNAL)
:param int id: ID of rule to fetch
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 225, "limit": 168, "responseCode": 200, "count": 755, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Day measure focus air when free imagine.", "messageTemplate": "Who north money every though.", "field": "Successful indeed serve respond increase.", "parameter": {}, "timestamp": 846158952}], "currentPage": 277, "size": 619}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{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=('system','notification','v1','rule'))
def update_rule(id: int, name: str = None, matchRule: str = None, index: int = None, setFlags: int = None, unsetFlags: int = None, actions: list = None, additionalDestinations: list = None, events: list = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Update notification rule (INTERNAL)
:param int id: ID of rule to update
:param str name: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str matchRule:
:param int index: index (default null)
:param int setFlags:
:param int unsetFlags:
:param list actions:
:param list additionalDestinations:
:param list events:
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 373, "limit": 110, "responseCode": 200, "count": 214, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Across response entire mouth.", "messageTemplate": "Common reach individual them above.", "field": "Them benefit plant or best result game nor.", "parameter": {}, "timestamp": 1171381760}], "currentPage": 594, "size": 829}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{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 = {}
if name:
body.update({"name": name})
if matchRule:
body.update({"matchRule": matchRule})
if index:
body.update({"index": index})
if setFlags:
body.update({"setFlags": setFlags})
if unsetFlags:
body.update({"unsetFlags": unsetFlags})
if actions:
body.update({"actions": actions})
if additionalDestinations:
body.update({"additionalDestinations": additionalDestinations})
if events:
body.update({"events": events})
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=('system','notification','v1','rule'))
def delete_rule(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Delete notification rule (INTERNAL)
:param int id: ID of rule to delete
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 925, "limit": 32, "responseCode": 200, "count": 22, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Open task point certainly wait recently answer history.", "messageTemplate": "Color television then story short hour expert activity.", "field": "Sometimes campaign beat.", "parameter": {}, "timestamp": 523034430}], "currentPage": 547, "size": 793}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{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 = delete(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=('system','notification','v1','rule'))
def add_action(id: int, index: int, changeMatching: str = None, changeTypes: list = None, changeFormats: list = None, changeRoles: list = None, sender: str = None, setFlags: int = None, unsetFlags: int = None, subjectTemplate: dict = None, bodyTemplate: dict = None, smsTemplate: dict = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Add notification action to rule (INTERNAL)
:param int id: ID of rule to add this action to
:param int index: Index to put this action at
:param str changeMatching: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list changeTypes:
:param list changeFormats:
:param list changeRoles:
:param str sender:
:param int setFlags:
:param int unsetFlags:
:param dict subjectTemplate: format:html
:param dict bodyTemplate: format:html
:param dict smsTemplate: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 902, "limit": 347, "responseCode": 200, "count": 555, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Participant best defense crime run.", "messageTemplate": "Though night fear region eight event.", "field": "Report popular seek policy hand stock themselves.", "parameter": {}, "timestamp": 55564098}], "currentPage": 80, "size": 13}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{id}/actions/{index}".format(id=id, index=index)
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 changeMatching:
body.update({"changeMatching": changeMatching})
if changeTypes:
body.update({"changeTypes": changeTypes})
if changeFormats:
body.update({"changeFormats": changeFormats})
if changeRoles:
body.update({"changeRoles": changeRoles})
if sender:
body.update({"sender": sender})
if setFlags:
body.update({"setFlags": setFlags})
if unsetFlags:
body.update({"unsetFlags": unsetFlags})
if subjectTemplate:
body.update({"subjectTemplate": subjectTemplate})
if bodyTemplate:
body.update({"bodyTemplate": bodyTemplate})
if smsTemplate:
body.update({"smsTemplate": smsTemplate})
response = post(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=('system','notification','v1','rule'))
def update_action(id: int, changeMatching: str = None, changeTypes: list = None, changeFormats: list = None, changeRoles: list = None, sender: str = None, setFlags: int = None, unsetFlags: int = None, subjectTemplate: dict = None, bodyTemplate: dict = None, smsTemplate: dict = None, index: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Update notification rule action (INTERNAL)
:param int id: ID of rule to update
:param str changeMatching: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list changeTypes:
:param list changeFormats:
:param list changeRoles:
:param str sender:
:param int setFlags:
:param int unsetFlags:
:param dict subjectTemplate: format:html
:param dict bodyTemplate: format:html
:param dict smsTemplate: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param int index: Index of action to update
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 621, "limit": 374, "responseCode": 200, "count": 982, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Animal specific create management.", "messageTemplate": "Hundred free rest bit impact class black organization.", "field": "Throw act large simply rate your.", "parameter": {}, "timestamp": 1204165275}], "currentPage": 286, "size": 480}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{id}/actions/{index}".format(id=id, index=index)
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 changeMatching:
body.update({"changeMatching": changeMatching})
if changeTypes:
body.update({"changeTypes": changeTypes})
if changeFormats:
body.update({"changeFormats": changeFormats})
if changeRoles:
body.update({"changeRoles": changeRoles})
if sender:
body.update({"sender": sender})
if setFlags:
body.update({"setFlags": setFlags})
if unsetFlags:
body.update({"unsetFlags": unsetFlags})
if subjectTemplate:
body.update({"subjectTemplate": subjectTemplate})
if bodyTemplate:
body.update({"bodyTemplate": bodyTemplate})
if smsTemplate:
body.update({"smsTemplate": smsTemplate})
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=('system','notification','v1','rule'))
def delete_action(id: int, index: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Delete action from notification rule (INTERNAL)
:param int id: ID of rule
:param int index: Index of action to delete
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 206, "limit": 467, "responseCode": 200, "count": 126, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Measure year last special kid model.", "messageTemplate": "Data continue reality western kid.", "field": "Street shoulder so table.", "parameter": {}, "timestamp": 586341039}], "currentPage": 45, "size": 469}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{id}/actions/{index}".format(id=id, index=index)
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 = delete(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=('system','notification','v1','rule'))
def add_destination(id: int, format: str = None, type: str = None, role: str = None, name: str = None, destination: str = None, language: str = None, flags: int = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Add destination to notification rule (INTERNAL)
:param int id: ID of rule to add this destination to
:param str format:
:param str type:
:param str role:
:param str name: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str destination:
:param str language:
:param int flags:
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 944, "limit": 584, "responseCode": 200, "count": 138, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Into policy share act foreign region agree.", "messageTemplate": "For happy market campaign coach.", "field": "Interesting real decide late toward with I.", "parameter": {}, "timestamp": 1190684668}], "currentPage": 10, "size": 411}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{id}/destinations".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 format:
body.update({"format": format})
if type:
body.update({"type": type})
if role:
body.update({"role": role})
if name:
body.update({"name": name})
if destination:
body.update({"destination": destination})
if language:
body.update({"language": language})
if flags:
body.update({"flags": flags})
response = post(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=('system','notification','v1','rule'))
def update_destination(id: int, index: int, format: str = None, type: str = None, role: str = None, name: str = None, destination: str = None, language: str = None, flags: int = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Update notification rule destination (INTERNAL)
:param int id: ID of rule to update
:param int index: Index of destination to update
:param str format:
:param str type:
:param str role:
:param str name: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str destination:
:param str language:
:param int flags:
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 211, "limit": 135, "responseCode": 200, "count": 673, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Nor sometimes seek movement ground attorney.", "messageTemplate": "Son live course drug road box like.", "field": "Start room today soon bag.", "parameter": {}, "timestamp": 1098214541}], "currentPage": 977, "size": 219}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{id}/destinations/{index}".format(id=id, index=index)
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 format:
body.update({"format": format})
if type:
body.update({"type": type})
if role:
body.update({"role": role})
if name:
body.update({"name": name})
if destination:
body.update({"destination": destination})
if language:
body.update({"language": language})
if flags:
body.update({"flags": flags})
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=('system','notification','v1','rule'))
def delete_destination(id: int, index: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Delete destination from notification rule (INTERNAL)
:param int id: ID of rule
:param int index: Index of destination to delete
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 95, "limit": 851, "responseCode": 200, "count": 116, "metaData": {"additionalProperties": {}}, "messages": [{"message": "At agent unit company suggest nature.", "messageTemplate": "Hotel its language question child civil while.", "field": "Light again voice walk.", "parameter": {}, "timestamp": 1431643938}], "currentPage": 457, "size": 912}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{id}/destinations/{index}".format(id=id, index=index)
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 = delete(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=('system','notification','v1','rule'))
def duplicate_rule(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Duplicate this notification rule (INTERNAL)
:param int id: ID of rule to duplicate
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 515, "limit": 493, "responseCode": 200, "count": 931, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Human wide owner hold claim tough.", "messageTemplate": "Choose follow manager several.", "field": "Sister both type south door travel hotel or.", "parameter": {}, "timestamp": 1329019540}], "currentPage": 663, "size": 38}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{id}/duplicate".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 = post(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=('system','notification','v1','rule'))
def revisions(id: int, offset: int = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""List revisions of notification rule (INTERNAL)
:param int id: ID of rule to fetch
:param int offset: Offset result
:param int limit: Limit result
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 482, "limit": 708, "responseCode": 200, "count": 897, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Stay surface serious term.", "messageTemplate": "Maybe majority finally pretty environment.", "field": "Mean relate course thousand good.", "parameter": {}, "timestamp": 99403013}], "currentPage": 485, "size": 415}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{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
[docs]@register_command(extending=('system','notification','v1','rule'))
def get_rule_by_name(name: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Fetch notification rule (INTERNAL)
:param str name: Name of rule to fetch
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 731, "limit": 126, "responseCode": 200, "count": 187, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Require certainly bad rather.", "messageTemplate": "Call artist attention local.", "field": "Single authority future might beat in.", "parameter": {}, "timestamp": 1056529161}], "currentPage": 662, "size": 484}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/notification/v1/rule/{name}".format(name=name)
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