"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('system','components','configuration','v1','instance'))
def list(offset: int = None, search: str = None, includeComments: bool = None, includeDeleted: bool = None, templateID: list = None, hostID: list = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""List configuration instances (INTERNAL)
:param int offset: Offset results
:param str search: Limit results to instances matching this searchstring
:param bool includeComments: Include comments in output
:param bool includeDeleted: Include deleted instances
:param list templateID: Limit results to instances with these templates
:param list hostID: Limit results to instances on these hosts
:param int limit: Limit results
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 116, "limit": 242, "responseCode": 200, "count": 444, "data": [{"id": 467, "flags": 483, "scheduledDowntimeFrom": 117, "scheduledDowntimeTo": 528, "revision": 272, "masterID": 236, "createdTimestamp": 734890267, "lastUpdatedTimestamp": 306868714, "lastUpdatedByUser": {"id": 398, "customerID": 269, "userName": "mali", "name": "Lauren Smith"}, "information": "Whom represent talk hotel source fact boy later.", "properties": {"additionalProperties": "Relationship similar raise talk should simple tough have."}, "identifiers": {"additionalProperties": "Week store whatever in attention although."}, "comments": [{"timestamp": 1368073583, "comment": "With must explain art throughout."}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Some benefit boy.", "messageTemplate": "Live effect step condition feeling line.", "field": "Training what suffer deep force policy firm.", "parameter": {}, "timestamp": 1068332432}], "currentPage": 886, "size": 515}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance".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 includeComments:
body.update({"includeComments": includeComments})
if includeDeleted:
body.update({"includeDeleted": includeDeleted})
if templateID:
body.update({"templateID": templateID})
if hostID:
body.update({"hostID": hostID})
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','components','configuration','v1','instance'))
def create(templateID: int = None, hostID: int = None, parentID: int = None, information: str = None, properties: dict = None, identifiers: dict = None, codeProfile: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Create new configuration instance (INTERNAL)
:param int templateID:
:param int hostID:
:param int parentID:
:param str information: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param dict properties:
:param dict identifiers:
:param str codeProfile: [a-zA-Z0-9_\-\.]*
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 874, "limit": 752, "responseCode": 200, "count": 350, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Lose home politics production oil phone field.", "messageTemplate": "Thus create by television within daughter south.", "field": "Star card same onto others must what wife.", "parameter": {}, "timestamp": 1141697788}], "currentPage": 992, "size": 410}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance".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 templateID:
body.update({"templateID": templateID})
if hostID:
body.update({"hostID": hostID})
if parentID:
body.update({"parentID": parentID})
if information:
body.update({"information": information})
if properties:
body.update({"properties": properties})
if identifiers:
body.update({"identifiers": identifiers})
if codeProfile:
body.update({"codeProfile": codeProfile})
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','components','configuration','v1','instance'))
def search(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, subCriteria: list = None, templateID: list = None, hostID: list = None, parentID: list = None, codeProfile: list = None, keywords: list = None, masterID: int = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', includeComments: bool = 'False', codeProfileOverride: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Search configuration instances (INTERNAL)
:param int limit: Set this value to set max number of results. By default, no restriction on result set size.
:param int offset: Set this value to skip the first (offset) objects. By default, return result from first object.
:param int includeFlags: Only include objects which have includeFlags set.
:param int excludeFlags: Exclude objects which have excludeFlags set.
:param list subCriteria:
:param list templateID: If set, filter instances by template ID.
:param list hostID: If set, filter instances by host ID.
:param list parentID: If set, filter instances by parent instance ID.
:param list codeProfile: If set, filter instances by active code profile.
:param list keywords: If set, filter instances where host or template name matches these keywords.
:param int masterID: If set, only include instance revisions of given master. If not set, revisions are excluded.
:param bool includeDeleted: Set to true to include deleted objects. By default, exclude deleted objects.
:param bool exclude: Only relevant for subcriteria. If set to true, objects matching this subcriteria object will be excluded.
:param bool required: Only relevant for subcriteria. If set to true, objects matching this subcriteria are required (AND-ed together with parent criteria).
:param bool includeComments: If true, include comments in output.
:param bool codeProfileOverride: If true, only return instances with overridden code profile. If false, exclude. If not set, do not filter.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 217, "limit": 79, "responseCode": 200, "count": 672, "data": [{"id": 966, "flags": 218, "scheduledDowntimeFrom": 173, "scheduledDowntimeTo": 155, "revision": 503, "masterID": 114, "createdTimestamp": 1221967439, "lastUpdatedTimestamp": 181715212, "lastUpdatedByUser": {"id": 643, "customerID": 459, "userName": "pittsbrian", "name": "Rebecca Garcia"}, "information": "Law too operation real accept.", "properties": {"additionalProperties": "Quickly yeah draw method star country major the."}, "identifiers": {"additionalProperties": "Because anyone area shoulder source international."}, "comments": [{"timestamp": 419075077, "comment": "Technology send various."}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Local fact speak particular.", "messageTemplate": "Ten another child watch white at.", "field": "Public heavy risk develop red.", "parameter": {}, "timestamp": 1138545973}], "currentPage": 881, "size": 339}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance/search".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 includeDeleted:
body.update({"includeDeleted": includeDeleted})
if includeFlags:
body.update({"includeFlags": includeFlags})
if excludeFlags:
body.update({"excludeFlags": excludeFlags})
if subCriteria:
body.update({"subCriteria": subCriteria})
if exclude:
body.update({"exclude": exclude})
if required:
body.update({"required": required})
if includeComments:
body.update({"includeComments": includeComments})
if templateID:
body.update({"templateID": templateID})
if hostID:
body.update({"hostID": hostID})
if parentID:
body.update({"parentID": parentID})
if codeProfile:
body.update({"codeProfile": codeProfile})
if keywords:
body.update({"keywords": keywords})
if masterID:
body.update({"masterID": masterID})
if codeProfileOverride:
body.update({"codeProfileOverride": codeProfileOverride})
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','components','configuration','v1','instance'))
def view(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Fetch configuration instance (INTERNAL)
:param int id: ID of instance to fetch
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 147, "limit": 682, "responseCode": 200, "count": 493, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Thousand individual necessary participant.", "messageTemplate": "Else discussion loss.", "field": "Hospital measure series movie class attack.", "parameter": {}, "timestamp": 1125161184}], "currentPage": 315, "size": 836}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance/{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','components','configuration','v1','instance'))
def update(id: int, configurationID: int = None, hostID: int = None, parentID: int = None, information: str = None, properties: dict = None, identifiers: dict = None, codeProfile: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Update configuration instance (INTERNAL)
:param int id: ID of instance to update
:param int configurationID:
:param int hostID: If set, assign instance to given configuration host.
:param int parentID: If set, set parent instance for this instance (on same configuration host).
:param str information: If set, change information field for instance. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param dict properties: If set, set these properties for instance. Property with null value will delete existing property.
:param dict identifiers: If set, set these identifiers for instance. Identifier with null value will delete existing identifier.
:param str codeProfile: Name of code profile to use. If null, do not change. If blank, reset to template profile. => [a-zA-Z0-9_\-\.]*
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 288, "limit": 652, "responseCode": 200, "count": 937, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Shoulder certain moment international leave still time.", "messageTemplate": "About so watch into argue carry.", "field": "Material let clearly show care road body.", "parameter": {}, "timestamp": 435256290}], "currentPage": 236, "size": 608}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance/{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 configurationID:
body.update({"configurationID": configurationID})
if hostID:
body.update({"hostID": hostID})
if parentID:
body.update({"parentID": parentID})
if information:
body.update({"information": information})
if properties:
body.update({"properties": properties})
if identifiers:
body.update({"identifiers": identifiers})
if codeProfile:
body.update({"codeProfile": codeProfile})
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','components','configuration','v1','instance'))
def delete(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Delete configuration instance (INTERNAL)
:param int id: ID of instance to delete
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 766, "limit": 543, "responseCode": 200, "count": 19, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Evening why top the cut miss radio.", "messageTemplate": "Range put between.", "field": "Party provide defense cover hotel common fly.", "parameter": {}, "timestamp": 874119028}], "currentPage": 885, "size": 86}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance/{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','components','configuration','v1','instance'))
def disable_monitoring(id: int, comment: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Disable monitoring of configuration instance (INTERNAL)
:param int id: ID of instance to disable monitoring on
:param str comment: Reason for disabling monitoring
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 189, "limit": 857, "responseCode": 200, "count": 234, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Task small quite six sense tell.", "messageTemplate": "Seem affect perhaps resource career cup even.", "field": "Here amount too church painting detail.", "parameter": {}, "timestamp": 291600892}], "currentPage": 416, "size": 465}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance/{id}/monitoring/disable".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 comment:
body.update({"comment": comment})
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','components','configuration','v1','instance'))
def enable_monitoring(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Enable monitoring of configuration instance (INTERNAL)
:param int id: ID of instance to enable monitoring on
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 702, "limit": 242, "responseCode": 200, "count": 979, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Voice camera son figure son investment possible eye.", "messageTemplate": "Activity benefit risk although.", "field": "Past maybe turn until mouth.", "parameter": {}, "timestamp": 1470624119}], "currentPage": 47, "size": 593}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance/{id}/monitoring/enable".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 = 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','components','configuration','v1','instance'))
def schedule_monitoring(id: int, _from: int = None, to: int = None, comment: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Schedule downtime for configuration instance (INTERNAL)
:param int id: ID of instance to schedule downtime for
:param int from: Timestamp to schedule downtime from
:param int to: Timestamp to schedule downtime to
:param str comment: Reason for scheduling downtime
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 581, "limit": 976, "responseCode": 200, "count": 728, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Education scientist real unit.", "messageTemplate": "Large something plan design something apply thousand growth.", "field": "Thousand increase conference reduce letter option.", "parameter": {}, "timestamp": 1249157359}], "currentPage": 299, "size": 702}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance/{id}/monitoring/schedule".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 _from:
body.update({"from": _from})
if to:
body.update({"to": to})
if comment:
body.update({"comment": comment})
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','components','configuration','v1','instance'))
def revisions(id: int, offset: int = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""List configuration instance revisions (INTERNAL)
:param int id: ID of instance to fetch revisions for
:param int offset: Offset results
:param int limit: Limit results
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 85, "limit": 405, "responseCode": 200, "count": 890, "data": [{"id": 390, "flags": 699, "scheduledDowntimeFrom": 292, "scheduledDowntimeTo": 680, "revision": 949, "masterID": 426, "createdTimestamp": 1374245049, "lastUpdatedTimestamp": 1233901334, "lastUpdatedByUser": {"id": 892, "customerID": 102, "userName": "billycain", "name": "Monica Wilson"}, "information": "Risk glass to since social.", "properties": {"additionalProperties": "Operation federal manager grow method enjoy her."}, "identifiers": {"additionalProperties": "Save seek natural a strategy number."}, "comments": [{"timestamp": 1228921326, "comment": "Coach can outside design between growth baby."}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Either whom owner manager.", "messageTemplate": "Fear bar seek new yeah would prevent.", "field": "Sound rich marriage from station.", "parameter": {}, "timestamp": 509074585}], "currentPage": 54, "size": 728}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/instance/{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