"""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": 306, "limit": 817, "responseCode": 200, "count": 354, "data": [{"id": "Attention involve run either church alone begin.", "ownedByUser": {"id": 112, "customerID": 329, "userName": "jasmineryan", "name": "Danielle Wolf"}, "name": "Sheila Scott", "description": "Relate watch live morning.", "totalCvss": 762, "vulnerabilitiesCount": 433, "createdTimestamp": 1383067243, "createdByUser": {"id": 834, "customerID": 540, "userName": "patelmelissa", "name": "Cheryl Lopez"}, "lastUpdatedTimestamp": 327591381, "lastUpdatedByUser": {"id": 620, "customerID": 539, "userName": "iparsons", "name": "Angel Church"}, "deletedTimestamp": 257878847, "deletedByUser": {"id": 745, "customerID": 884, "userName": "shannonortiz", "name": "Nicole Rose"}, "flags": ["UPDATED_BY_CVM"], "properties": {"additionalProperties": "Media one parent especially cup machine discuss save."}, "services": [{"id": "Individual drop four within black.", "name": "Anthony Brown"}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Office total able join call small.", "messageTemplate": "Dog real center.", "field": "Do everyone treatment morning find.", "parameter": {}, "timestamp": 1184560646}], "currentPage": 468, "size": 709}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.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": 762, "limit": 936, "responseCode": 200, "count": 996, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Change hit throughout our away.", "messageTemplate": "Go turn choice manage.", "field": "Too represent perform first education past.", "parameter": {}, "timestamp": 437948328}], "currentPage": 997, "size": 399}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.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": 308, "limit": 705, "responseCode": 200, "count": 386, "data": [{"id": "Source Congress job address close still old.", "ownedByUser": {"id": 120, "customerID": 587, "userName": "jamiewilliams", "name": "Dr. Sandra Roberts"}, "name": "Sarah Martin", "description": "Compare pick probably.", "totalCvss": 303, "vulnerabilitiesCount": 213, "createdTimestamp": 128776694, "createdByUser": {"id": 570, "customerID": 289, "userName": "aaron35", "name": "Stephanie Franklin"}, "lastUpdatedTimestamp": 1109718976, "lastUpdatedByUser": {"id": 110, "customerID": 732, "userName": "ipitts", "name": "Andrew Gates"}, "deletedTimestamp": 1150994004, "deletedByUser": {"id": 562, "customerID": 86, "userName": "stephen32", "name": "Julia Livingston"}, "flags": ["HAS_HIGH_VULN"], "properties": {"additionalProperties": "Central least often teacher."}, "services": [{"id": "Fine exist force military.", "name": "Christina Reyes"}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Current unit stock run large gas.", "messageTemplate": "Pm maybe stay edge note school run body.", "field": "Land security drug mind seem hit say.", "parameter": {}, "timestamp": 283869212}], "currentPage": 357, "size": 6}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.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 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": 921, "limit": 634, "responseCode": 200, "count": 148, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Work view four if treatment right.", "messageTemplate": "Seem above star billion.", "field": "Spring difference television say me.", "parameter": {}, "timestamp": 500804968}], "currentPage": 47, "size": 615}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.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": 879, "limit": 100, "responseCode": 200, "count": 478, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Here no option score particular growth.", "messageTemplate": "Those moment talk simply.", "field": "Three positive buy decide north week.", "parameter": {}, "timestamp": 702748283}], "currentPage": 519, "size": 152}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.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": 422, "limit": 51, "responseCode": 200, "count": 159, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Past weight product.", "messageTemplate": "Successful traditional option foreign record people field why.", "field": "Old body threat professor better teach traditional.", "parameter": {}, "timestamp": 982968066}], "currentPage": 762, "size": 176}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://portal.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": 776, "limit": 597, "responseCode": 200, "count": 555, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Return drop certainly field culture alone claim.", "messageTemplate": "Real yard everybody product particularly ball old.", "field": "Paper similar fish sister within.", "parameter": {}, "timestamp": 1095627978}], "currentPage": 64, "size": 309}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.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": 18, "limit": 701, "responseCode": 200, "count": 993, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Win dinner trouble large move network allow.", "messageTemplate": "Simple rule use garden tough.", "field": "Candidate central story girl room.", "parameter": {}, "timestamp": 590419036}], "currentPage": 63, "size": 649}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.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