"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('assets','v1','businessprocess'))
def search_business_processes_simplified(keywords: list = None, keywordField: list = None, name: list = None, hostID: list = None, serviceID: list = None, businessProcessID: list = None, customerID: list = None, ip: list = None, port: list = None, protocol: list = None, cpe: list = None, vulnID: list = None, vulnRef: list = None, includeFlag: list = None, excludeFlag: list = None, sortBy: list = None, offset: int = 0, limit: int = 25, keywordMatch: str = 'all',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns as set of BusinessProcesses defined by query parameters. (PUBLIC)
:param list keywords: Search by keywords
:param list keywordField: Set field strategy for keyword search
:param list name: Search by name
:param list hostID: Search by HostAsset ID
:param list serviceID: Search by ServiceAsset ID
:param list businessProcessID: Search by BusinessProcess ID
:param list customerID: Search by customer ID
:param list ip: Search by IP range
:param list port: Search by application port
:param list protocol: Search by application protocol
:param list cpe: Search by CPE
:param list vulnID: Search by vulnerability ID
:param list vulnRef: Search by vulnerability reference
:param list includeFlag: Include certain BusinessProcesses in the search result based on set flags
:param list excludeFlag: Exclude certain BusinessProcesses from the search result based on set flags
:param list sortBy: Sort search result
:param int offset: Skip a number of results
:param int limit: Maximum number of returned results
:param str keywordMatch: Set match strategy for keyword search
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 176, "limit": 789, "responseCode": 200, "count": 468, "data": [{"id": "Movie money movement.", "ownedByUser": {"id": 595, "customerID": 391, "userName": "zbird", "name": "Robert Ramos"}, "name": "Joann Cooper", "description": "Another that participant authority.", "totalCvss": 880, "vulnerabilitiesCount": 223, "createdTimestamp": 931818552, "createdByUser": {"id": 483, "customerID": 206, "userName": "matthew40", "name": "Pamela Morales"}, "lastUpdatedTimestamp": 319630967, "lastUpdatedByUser": {"id": 957, "customerID": 449, "userName": "mercadoalexa", "name": "William Mayo"}, "deletedTimestamp": 810788377, "deletedByUser": {"id": 957, "customerID": 729, "userName": "egardner", "name": "Rachel Ballard"}, "flags": ["MISSING_FROM_CVM"], "properties": {"additionalProperties": "Assume discuss along media do."}, "services": [{"id": "Rock outside amount seven.", "name": "Kelly Woodard"}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Democratic newspaper drive natural.", "messageTemplate": "Gun from professional situation professional provide democratic expect.", "field": "Republican town general similar kind theory.", "parameter": {}, "timestamp": 665405880}], "currentPage": 327, "size": 5}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/businessprocess".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 offset:
body.update({"offset": offset})
if limit:
body.update({"limit": limit})
if keywordMatch:
body.update({"keywordMatch": keywordMatch})
if keywords:
body.update({"keywords": keywords})
if keywordField:
body.update({"keywordField": keywordField})
if name:
body.update({"name": name})
if hostID:
body.update({"hostID": hostID})
if serviceID:
body.update({"serviceID": serviceID})
if businessProcessID:
body.update({"businessProcessID": businessProcessID})
if customerID:
body.update({"customerID": customerID})
if ip:
body.update({"ip": ip})
if port:
body.update({"port": port})
if protocol:
body.update({"protocol": protocol})
if cpe:
body.update({"cpe": cpe})
if vulnID:
body.update({"vulnID": vulnID})
if vulnRef:
body.update({"vulnRef": vulnRef})
if includeFlag:
body.update({"includeFlag": includeFlag})
if excludeFlag:
body.update({"excludeFlag": excludeFlag})
if sortBy:
body.update({"sortBy": sortBy})
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=('assets','v1','businessprocess'))
def add_business_process(ownerID: int = None, customerID: int = None, name: str = None, description: str = None, properties: dict = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Creates a new BusinessProcess. (PUBLIC)
:param int ownerID: User who owns the asset.
:param int customerID: Customer the asset belongs to.
:param str name: Name of the asset. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str description: Description of the asset. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param dict properties: Custom user-defined properties. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 857, "limit": 225, "responseCode": 200, "count": 240, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Area four main thousand tell foot.", "messageTemplate": "Key my assume lot.", "field": "She nothing word letter work itself.", "parameter": {}, "timestamp": 1249065033}], "currentPage": 719, "size": 18}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/businessprocess".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 ownerID:
body.update({"ownerID": ownerID})
if customerID:
body.update({"customerID": customerID})
if name:
body.update({"name": name})
if description:
body.update({"description": description})
if properties:
body.update({"properties": properties})
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=('assets','v1','businessprocess'))
def search_business_processes(limit: int = None, offset: int = None, subCriteria: list = None, customerID: list = None, name: list = None, startTimestamp: int = None, endTimestamp: int = None, keywords: list = None, keywordMatchStrategy: str = None, timeMatchStrategy: str = None, hostID: list = None, serviceID: list = None, businessProcessID: list = None, ipRange: list = None, applicationPort: list = None, applicationProtocol: list = None, cpe: list = None, hostCPE: list = None, applicationCPE: list = None, ownerID: list = None, criticality: list = None, minimumTotalCvss: int = None, maximumTotalCvss: int = None, vulnerabilityReference: list = None, vulnerabilityID: list = None, applicationRole: list = None, timeFieldStrategy: list = None, keywordFieldStrategy: list = None, sortBy: list = None, includeFlags: list = None, excludeFlags: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns a set of BusinessProcesses defined by a BusinessProcessSearchCriteria. (PUBLIC)
: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 list subCriteria:
:param list customerID: Restrict search to data belonging to specified customers.
:param list name: Restrict search to specific asset name
:param int startTimestamp: Restrict search to a time frame based on the set TimeFieldStrategy (start timestamp).
:param int endTimestamp: Restrict search to a time frame based on the set TimeFieldStrategy (end timestamp).
:param list keywords: Search for keywords.
:param str keywordMatchStrategy: Defines the MatchStrategy for keywords (default match all keywords).
:param str timeMatchStrategy: Defines how strict to match against different timestamps (all/any) using start and end timestamp (default any)
:param list hostID: Restrict search to specific host UUIDs.
:param list serviceID: Restrict search to specific service UUIDs.
:param list businessProcessID: Restrict search to specific business process UUIDs.
:param list ipRange: Restrict search to entities related to these IP-addresses (may specify single IPs, IP networks or IP ranges.
:param list applicationPort: Restrict to applications listening on specific ports.
:param list applicationProtocol: Restrict to applications by transport protocol name.
:param list cpe: Restrict to applications or hosts by CPE.
:param list hostCPE: Restrict to hosts by CPE.
:param list applicationCPE: Restrict to applications by CPE.
:param list ownerID: Restrict search to specific ownerIDs
:param list criticality: Restrict search to a range of criticality levels (add multiple CriticalitySearch objects to specify OR criteria).
:param int minimumTotalCvss: Restrict search to a minimum total CVSS score.
:param int maximumTotalCvss: Restrict search to a maximum total CVSS score.
:param list vulnerabilityReference: Restrict to vulnerabilities identified by vulnerability reference.
:param list vulnerabilityID: Restrict to vulnerabilities identified by vulnerability ID.
:param list applicationRole: Restrict to applications with specific roles (list of role IDs).
:param list timeFieldStrategy: Defines which timestamps will be included in the search (default lastUpdatedTimestamp on business process).
:param list keywordFieldStrategy: Defines which fields will be searched by keywords (default all supported fields).
:param list sortBy: List of properties to sort by (prefix with "-" to sort descending).
:param list includeFlags: Only include objects which have includeFlags set.
:param list excludeFlags: Exclude objects which have excludeFlags set.
: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).
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 755, "limit": 829, "responseCode": 200, "count": 41, "data": [{"id": "Apply consumer bag pull president road gun.", "ownedByUser": {"id": 197, "customerID": 333, "userName": "hhickman", "name": "Joseph Lutz"}, "name": "Amber Henry", "description": "Human morning interview bed.", "totalCvss": 866, "vulnerabilitiesCount": 412, "createdTimestamp": 158120863, "createdByUser": {"id": 732, "customerID": 511, "userName": "geraldrobles", "name": "Lisa Russell"}, "lastUpdatedTimestamp": 645755284, "lastUpdatedByUser": {"id": 691, "customerID": 568, "userName": "timothy11", "name": "Benjamin Davila"}, "deletedTimestamp": 1081251008, "deletedByUser": {"id": 327, "customerID": 436, "userName": "ronald49", "name": "Nancy Bowen"}, "flags": ["UPDATED_BY_CVM"], "properties": {"additionalProperties": "Order from certainly late."}, "services": [{"id": "Under tax role already will offer.", "name": "Kristin Montgomery"}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Term return employee herself political matter.", "messageTemplate": "Start least heart matter loss ask give.", "field": "Hotel plant line agreement.", "parameter": {}, "timestamp": 489828190}], "currentPage": 165, "size": 684}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/businessprocess/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 subCriteria:
body.update({"subCriteria": subCriteria})
if exclude:
body.update({"exclude": exclude})
if required:
body.update({"required": required})
if customerID:
body.update({"customerID": customerID})
if name:
body.update({"name": name})
if startTimestamp:
body.update({"startTimestamp": startTimestamp})
if endTimestamp:
body.update({"endTimestamp": endTimestamp})
if keywords:
body.update({"keywords": keywords})
if keywordMatchStrategy:
body.update({"keywordMatchStrategy": keywordMatchStrategy})
if timeMatchStrategy:
body.update({"timeMatchStrategy": timeMatchStrategy})
if hostID:
body.update({"hostID": hostID})
if serviceID:
body.update({"serviceID": serviceID})
if businessProcessID:
body.update({"businessProcessID": businessProcessID})
if ipRange:
body.update({"ipRange": ipRange})
if applicationPort:
body.update({"applicationPort": applicationPort})
if applicationProtocol:
body.update({"applicationProtocol": applicationProtocol})
if cpe:
body.update({"cpe": cpe})
if hostCPE:
body.update({"hostCPE": hostCPE})
if applicationCPE:
body.update({"applicationCPE": applicationCPE})
if ownerID:
body.update({"ownerID": ownerID})
if criticality:
body.update({"criticality": criticality})
if minimumTotalCvss:
body.update({"minimumTotalCvss": minimumTotalCvss})
if maximumTotalCvss:
body.update({"maximumTotalCvss": maximumTotalCvss})
if vulnerabilityReference:
body.update({"vulnerabilityReference": vulnerabilityReference})
if vulnerabilityID:
body.update({"vulnerabilityID": vulnerabilityID})
if applicationRole:
body.update({"applicationRole": applicationRole})
if timeFieldStrategy:
body.update({"timeFieldStrategy": timeFieldStrategy})
if keywordFieldStrategy:
body.update({"keywordFieldStrategy": keywordFieldStrategy})
if sortBy:
body.update({"sortBy": sortBy})
if includeFlags:
body.update({"includeFlags": includeFlags})
if excludeFlags:
body.update({"excludeFlags": excludeFlags})
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=('assets','v1','businessprocess'))
def search_business_process_statistics(limit: int = None, offset: int = None, subCriteria: list = None, customerID: list = None, name: list = None, startTimestamp: int = None, endTimestamp: int = None, keywords: list = None, keywordMatchStrategy: str = None, timeMatchStrategy: str = None, hostID: list = None, serviceID: list = None, businessProcessID: list = None, ipRange: list = None, applicationPort: list = None, applicationProtocol: list = None, cpe: list = None, hostCPE: list = None, applicationCPE: list = None, ownerID: list = None, criticality: list = None, minimumTotalCvss: int = None, maximumTotalCvss: int = None, vulnerabilityReference: list = None, vulnerabilityID: list = None, applicationRole: list = None, timeFieldStrategy: list = None, keywordFieldStrategy: list = None, groupBy: list = None, values: list = None, resolution: int = None, cutoff: int = None, cutoffValue: str = None, sortBy: list = None, includeFlags: list = None, excludeFlags: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', includeOthers: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Fetch business process statistics base on criteria (DEV)
: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 list subCriteria:
:param list customerID: Restrict search to data belonging to specified customers.
:param list name: Restrict search to specific asset name
:param int startTimestamp: Restrict search to a time frame based on the set TimeFieldStrategy (start timestamp).
:param int endTimestamp: Restrict search to a time frame based on the set TimeFieldStrategy (end timestamp).
:param list keywords: Search for keywords.
:param str keywordMatchStrategy: Defines the MatchStrategy for keywords (default match all keywords).
:param str timeMatchStrategy: Defines how strict to match against different timestamps (all/any) using start and end timestamp (default any)
:param list hostID: Restrict search to specific host UUIDs.
:param list serviceID: Restrict search to specific service UUIDs.
:param list businessProcessID: Restrict search to specific business process UUIDs.
:param list ipRange: Restrict search to entities related to these IP-addresses (may specify single IPs, IP networks or IP ranges.
:param list applicationPort: Restrict to applications listening on specific ports.
:param list applicationProtocol: Restrict to applications by transport protocol name.
:param list cpe: Restrict to applications or hosts by CPE.
:param list hostCPE: Restrict to hosts by CPE.
:param list applicationCPE: Restrict to applications by CPE.
:param list ownerID: Restrict search to specific ownerIDs
:param list criticality: Restrict search to a range of criticality levels (add multiple CriticalitySearch objects to specify OR criteria).
:param int minimumTotalCvss: Restrict search to a minimum total CVSS score.
:param int maximumTotalCvss: Restrict search to a maximum total CVSS score.
:param list vulnerabilityReference: Restrict to vulnerabilities identified by vulnerability reference.
:param list vulnerabilityID: Restrict to vulnerabilities identified by vulnerability ID.
:param list applicationRole: Restrict to applications with specific roles (list of role IDs).
:param list timeFieldStrategy: Defines which timestamps will be included in the search (default lastUpdatedTimestamp on business process).
:param list keywordFieldStrategy: Defines which fields will be searched by keywords (default all supported fields).
:param list groupBy: Specify which fields will be grouped by in stats
:param list values: Specify which values will be included in stats (default processes)
:param int resolution: Stats resolution period in milliseconds, if is 0 means to generate non-timeline statistics
:param int cutoff: Reduce stats keys to the cutoff amount of keys that has largest hit count, default 0 means no reduce
:param str cutoffValue: Specify which value to be cutoff on (default processes)
:param list sortBy: List of properties to sort by (prefix with "-" to sort descending).
:param list includeFlags: Only include objects which have includeFlags set.
:param list excludeFlags: Exclude objects which have excludeFlags set.
: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 includeOthers: If reduce (cutoff >0), true means remaining keys (other than cutoff keys) are collected into an "other" key, default false
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:returns: {"offset": 357, "limit": 763, "responseCode": 200, "count": 876, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Hotel month hotel family near beat.", "messageTemplate": "Remember adult source relationship general.", "field": "House language grow sometimes than piece at.", "parameter": {}, "timestamp": 752664502}], "currentPage": 908, "size": 6}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/businessprocess/statistics".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 subCriteria:
body.update({"subCriteria": subCriteria})
if exclude:
body.update({"exclude": exclude})
if required:
body.update({"required": required})
if customerID:
body.update({"customerID": customerID})
if name:
body.update({"name": name})
if startTimestamp:
body.update({"startTimestamp": startTimestamp})
if endTimestamp:
body.update({"endTimestamp": endTimestamp})
if keywords:
body.update({"keywords": keywords})
if keywordMatchStrategy:
body.update({"keywordMatchStrategy": keywordMatchStrategy})
if timeMatchStrategy:
body.update({"timeMatchStrategy": timeMatchStrategy})
if hostID:
body.update({"hostID": hostID})
if serviceID:
body.update({"serviceID": serviceID})
if businessProcessID:
body.update({"businessProcessID": businessProcessID})
if ipRange:
body.update({"ipRange": ipRange})
if applicationPort:
body.update({"applicationPort": applicationPort})
if applicationProtocol:
body.update({"applicationProtocol": applicationProtocol})
if cpe:
body.update({"cpe": cpe})
if hostCPE:
body.update({"hostCPE": hostCPE})
if applicationCPE:
body.update({"applicationCPE": applicationCPE})
if ownerID:
body.update({"ownerID": ownerID})
if criticality:
body.update({"criticality": criticality})
if minimumTotalCvss:
body.update({"minimumTotalCvss": minimumTotalCvss})
if maximumTotalCvss:
body.update({"maximumTotalCvss": maximumTotalCvss})
if vulnerabilityReference:
body.update({"vulnerabilityReference": vulnerabilityReference})
if vulnerabilityID:
body.update({"vulnerabilityID": vulnerabilityID})
if applicationRole:
body.update({"applicationRole": applicationRole})
if timeFieldStrategy:
body.update({"timeFieldStrategy": timeFieldStrategy})
if keywordFieldStrategy:
body.update({"keywordFieldStrategy": keywordFieldStrategy})
if groupBy:
body.update({"groupBy": groupBy})
if values:
body.update({"values": values})
if resolution:
body.update({"resolution": resolution})
if cutoff:
body.update({"cutoff": cutoff})
if cutoffValue:
body.update({"cutoffValue": cutoffValue})
if includeOthers:
body.update({"includeOthers": includeOthers})
if sortBy:
body.update({"sortBy": sortBy})
if includeFlags:
body.update({"includeFlags": includeFlags})
if excludeFlags:
body.update({"excludeFlags": excludeFlags})
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=('assets','v1','businessprocess'))
def get_business_process(id: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Returns a BusinessProcess identified by its ID. (PUBLIC)
:param str id: BusinessProcess ID
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 974, "limit": 799, "responseCode": 200, "count": 669, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Media yes since ever.", "messageTemplate": "Table hotel much house industry.", "field": "Serious official less hair level recognize shake.", "parameter": {}, "timestamp": 170115065}], "currentPage": 718, "size": 884}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/businessprocess/{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=('assets','v1','businessprocess'))
def update_business_process(id: str, ownerID: int = None, name: str = None, description: str = None, addProperties: dict = None, deleteProperties: list = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Updates an existing BusinessProcess. (PUBLIC)
:param str id: BusinessProcess ID
:param int ownerID: Change user who owns the asset.
:param str name: Change name of asset. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str description: Change description of asset. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param dict addProperties: Add custom properties (updates a property if key already exists). => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list deleteProperties: Delete custom properties by key.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 669, "limit": 525, "responseCode": 200, "count": 10, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Seem significant recognize benefit store ahead.", "messageTemplate": "Most let decade reduce low.", "field": "Quickly check enough necessary also.", "parameter": {}, "timestamp": 1244459957}], "currentPage": 841, "size": 763}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/businessprocess/{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 ownerID:
body.update({"ownerID": ownerID})
if name:
body.update({"name": name})
if description:
body.update({"description": description})
if addProperties:
body.update({"addProperties": addProperties})
if deleteProperties:
body.update({"deleteProperties": deleteProperties})
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=('assets','v1','businessprocess'))
def delete_business_process(id: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Marks a BusinessProcess as deleted. (PUBLIC)
:param str id: BusinessProcess ID
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 629, "limit": 421, "responseCode": 200, "count": 377, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Its drug smile apply.", "messageTemplate": "Nation heart could deal almost recent low.", "field": "Describe top effort race include few the something.", "parameter": {}, "timestamp": 63669054}], "currentPage": 444, "size": 760}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/businessprocess/{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=('assets','v1','businessprocess'))
def attach_services_to_business_process(id: str, serviceAssetIDs: list = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Adds multiple ServiceAssets to a BusinessProcess. (PUBLIC)
:param str id: BusinessProcess ID
:param list serviceAssetIDs: Specify services to add to business process.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 200, "limit": 821, "responseCode": 200, "count": 852, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Kitchen onto cause wonder.", "messageTemplate": "Long including sing.", "field": "The method sound.", "parameter": {}, "timestamp": 1248004057}], "currentPage": 572, "size": 885}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/businessprocess/{id}/attachservices".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 serviceAssetIDs:
body.update({"serviceAssetIDs": serviceAssetIDs})
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=('assets','v1','businessprocess'))
def detach_services_from_business_process(id: str, serviceAssetIDs: list = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Removes multiple ServiceAssets from a BusinessProcess. (PUBLIC)
:param str id: BusinessProcess ID
:param list serviceAssetIDs: Specify services to detach from business process.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 104, "limit": 806, "responseCode": 200, "count": 590, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Explain member stop miss rate.", "messageTemplate": "Safe early environment happen medical however least.", "field": "Court task book behind case.", "parameter": {}, "timestamp": 1203168942}], "currentPage": 904, "size": 922}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/businessprocess/{id}/detachservices".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 serviceAssetIDs:
body.update({"serviceAssetIDs": serviceAssetIDs})
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