"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('cases','v1','case'))
def list_cases(serviceTypeID: list = None, customerID: list = None, status: list = None, offset: int = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""List customer logs (TEST)
:param list serviceTypeID: ID of service types to limit to
:param list customerID: ID of customers to limit to
:param list status: Status to limit to
: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": 240, "limit": 306, "responseCode": 200, "count": 788, "data": [{"description": "Increase police trade little doctor.", "tags": [{"value": "Special resource energy site down effort."}], "properties": {"additionalProperties": "Lay similar would."}, "flags": 617, "userACL": [357], "createdByUser": {"id": 289, "customerID": 813, "userName": "gcollins", "name": "Tammy Mitchell"}, "status": "PENDING_CUSTOMER", "logType": "SECURITY_INCIDENT", "customerReference": "Can control establish feeling set.", "priority": 178, "contacts": [{"id": 4, "languageID": 116, "name": "Julia Martinez", "value": "Hot month military serious large.", "flags": 809, "subjectID": 605, "verbose": true, "language": "NORWEGIAN", "default": true}], "id": 493, "createdTimestamp": 1514990411, "lastUpdatedTimestamp": 130959408, "publishedTimestamp": 927767123}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Detail turn bar executive short.", "messageTemplate": "Accept stand base type.", "field": "Against say half about improve.", "parameter": {}, "timestamp": 631938288}], "currentPage": 453, "size": 291}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v1/case".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 serviceTypeID:
body.update({"serviceTypeID": serviceTypeID})
if customerID:
body.update({"customerID": customerID})
if status:
body.update({"status": status})
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=('cases','v1','case'))
def search_cases(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, customerID: list = None, user: list = None, owner: list = None, customerDataID: list = None, searchString: str = None, serviceType: list = None, subCriteria: list = None, logType: list = None, logCategory: list = None, status: list = None, minPriority: int = None, maxPriority: int = None, priority: list = None, textSearchFeatures: list = None, customerOwnerID: list = None, techOwnerID: list = None, assetID: list = None, sortBy: list = None, startTimestamp: int = None, endTimestamp: int = None, tags: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', includeCreatedTimestamp: bool = 'False', includeLastUpdatedTimestamp: bool = 'False', ownerAssigned: bool = 'False', techAssigned: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Search for customer logs by criteria (TEST)
:param int limit: Limit results
:param int offset: Offset results
:param int includeFlags: Search objects with these flags set
:param int excludeFlags: Exclude objects with these flags set
:param list customerID: Limit result to objects belonging to these customers
:param list user: Set of user IDs, limit search to data created/updated by users with this ID
:param list owner: Set of user IDs, limit search to cases owned by (solution engineer or customer owner) users with this ID
:param list customerDataID: Set of specific data objects
:param str searchString: Words to search for
:param list serviceType: Limit result to objects with these service types
:param list subCriteria:
:param list logType: Log types
:param list logCategory: ID of log categories
:param list status: Case status
:param int minPriority: Minimum log priority
:param int maxPriority: Maximum log priority
:param list priority: Set of specific priorities
:param list textSearchFeatures: Text search features
:param list customerOwnerID: Set of user IDs, limit search to cases owned by (customer owner) users with this ID
:param list techOwnerID: Set of user IDs, limit search to cases owned by (solution engineer) users with this ID
:param list assetID: Set of asset IDs, limit search to cases associated with specified assets (hosts, services or processes)
:param list sortBy: Order results by these properties (prefix with - to sort descending)
:param int startTimestamp: Search objects from this timestamp
:param int endTimestamp: Search objects until this timestamp
:param list tags: Set of tags to search for (specify as key/value)
:param bool includeDeleted: Also include deleted objects (where implemented)
:param bool exclude: Exclude these criteria from parent criteria
:param bool includeCreatedTimestamp: Include created timestamp when searching time period
:param bool includeLastUpdatedTimestamp: Include last updated timestamp when searching time period
:param bool ownerAssigned: If set to true, limit to cases where customer owner is assigned, false to limit to cases with no owner assigned. Default is no limitation.
:param bool techAssigned: If set to true, limit to cases where solution engineer is assigned, false to limit to cases with no solution engineer assigned. Default is no limitation.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 307, "limit": 909, "responseCode": 200, "count": 140, "data": [{"description": "Ever play himself result education rest.", "tags": [{"value": "Two draw somebody continue various travel speech training."}], "properties": {"additionalProperties": "Maintain case fish politics instead professor door society."}, "flags": 948, "userACL": [407], "createdByUser": {"id": 289, "customerID": 792, "userName": "lori69", "name": "John Ramsey"}, "status": "CLOSED", "logType": "SECURITY_INCIDENT", "customerReference": "Likely thousand reduce also me ever cold.", "priority": 322, "contacts": [{"id": 912, "languageID": 409, "name": "Tracy Baldwin", "value": "Teacher more choose like.", "flags": 942, "subjectID": 443, "verbose": false, "language": "ENGLISH", "default": false}], "id": 709, "createdTimestamp": 1361771582, "lastUpdatedTimestamp": 378896353, "publishedTimestamp": 1303652237}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Front blue interesting his environment owner.", "messageTemplate": "Per night animal star student catch set.", "field": "Well total red recent.", "parameter": {}, "timestamp": 520168433}], "currentPage": 47, "size": 476}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v1/case/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 customerID:
body.update({"customerID": customerID})
if exclude:
body.update({"exclude": exclude})
if user:
body.update({"user": user})
if owner:
body.update({"owner": owner})
if customerDataID:
body.update({"customerDataID": customerDataID})
if searchString:
body.update({"searchString": searchString})
if serviceType:
body.update({"serviceType": serviceType})
if subCriteria:
body.update({"subCriteria": subCriteria})
if logType:
body.update({"logType": logType})
if logCategory:
body.update({"logCategory": logCategory})
if status:
body.update({"status": status})
if minPriority:
body.update({"minPriority": minPriority})
if maxPriority:
body.update({"maxPriority": maxPriority})
if priority:
body.update({"priority": priority})
if includeCreatedTimestamp:
body.update({"includeCreatedTimestamp": includeCreatedTimestamp})
if includeLastUpdatedTimestamp:
body.update({"includeLastUpdatedTimestamp": includeLastUpdatedTimestamp})
if textSearchFeatures:
body.update({"textSearchFeatures": textSearchFeatures})
if ownerAssigned:
body.update({"ownerAssigned": ownerAssigned})
if techAssigned:
body.update({"techAssigned": techAssigned})
if customerOwnerID:
body.update({"customerOwnerID": customerOwnerID})
if techOwnerID:
body.update({"techOwnerID": techOwnerID})
if assetID:
body.update({"assetID": assetID})
if sortBy:
body.update({"sortBy": sortBy})
if startTimestamp:
body.update({"startTimestamp": startTimestamp})
if endTimestamp:
body.update({"endTimestamp": endTimestamp})
if tags:
body.update({"tags": tags})
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=('cases','v1','case'))
def get_case_entries(caseId: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""List case entries (TEST)
:param int caseId: ID of case to list entries from
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 211, "limit": 868, "responseCode": 200, "count": 359, "data": [{"description": "Go old education skin.", "tags": [{"value": "Such military of difference."}], "properties": {"additionalProperties": "More enough radio free so."}, "flags": 214, "userACL": [883], "createdByUser": {"id": 233, "customerID": 203, "userName": "nunezkaren", "name": "Karen Beltran"}, "customerReference": "Company song remember paper experience.", "status": "PENDING_SOC", "priority": 431, "text": "Call be benefit get and add major read.", "id": 732, "createdTimestamp": 183061393, "lastUpdatedTimestamp": 765192701, "publishedTimestamp": 589026921}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Foot me a tax use wind group some.", "messageTemplate": "Heart financial hour parent spring beyond parent student.", "field": "Offer inside oil fine hundred happen.", "parameter": {}, "timestamp": 642191824}], "currentPage": 274, "size": 4}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v1/case/{caseId}/entries".format(caseId=caseId)
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=('cases','v1','case'))
def merge_cases(mergeIntoID: int, mergeFromID: int, priority: int = None, status: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Merge one case into another (TEST)
:param int mergeIntoID: ID of case to put into
:param int mergeFromID: ID of case to merge (will disappear)
:param int priority: Priority to set for merged case
:param str status: Status to set for merged case
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 69, "limit": 303, "responseCode": 200, "count": 837, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Project world another sometimes majority child.", "messageTemplate": "Model service well read Mr everything.", "field": "Fine probably but share many.", "parameter": {}, "timestamp": 1463254128}], "currentPage": 749, "size": 23}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v1/case/{mergeIntoID}/merge/{mergeFromID}".format(mergeIntoID=mergeIntoID, mergeFromID=mergeFromID)
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 priority:
body.update({"priority": priority})
if status:
body.update({"status": status})
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