Source code for api.assets.v1.businessprocess

"""Autogenerated API"""

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 = None, limit: int = 25, keywordMatch: str = "all", json: bool = True, verify: bool = True, apiKey: str = None, 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': 956, 'limit': 676, 'responseCode': 200, 'count': 67, 'data': [{'id': 'Indicate analysis write throw you.', 'ownedByUser': {'id': 319, 'customerID': 819, 'userName': 'robertsonjoseph', 'name': 'Joann Roman'}, 'name': 'Austin Perez', 'description': 'Region type put either.', 'totalCvss': 872, 'vulnerabilitiesCount': 311, 'createdTimestamp': 289754888, 'createdByUser': {'id': 772, 'customerID': 20, 'userName': 'christopherray', 'name': 'Jennifer Rivers'}, 'lastUpdatedTimestamp': 1115029464, 'lastUpdatedByUser': {'id': 236, 'customerID': 994, 'userName': 'adavis', 'name': 'Russell Brown'}, 'deletedTimestamp': 1127524477, 'deletedByUser': {'id': 290, 'customerID': 328, 'userName': 'nevans', 'name': 'Alyssa Lamb'}, 'flags': ['UPDATED_BY_CVM'], 'properties': {'additionalProperties': 'As television public child.'}, 'services': [{'id': 'Three tell receive certain end cover involve.', 'name': 'Molly Gomez'}]}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'View know how director part really.', 'messageTemplate': 'Where wish official tax chance discover later month.', 'field': 'Sometimes us reduce inside.', 'parameter': {}, 'timestamp': 1257810207}], 'currentPage': 589, 'size': 787} """ 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/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "offset": offset, "limit": limit, "keywordMatch": keywordMatch, "keywords": keywords, "keywordField": keywordField, "name": name, "hostID": hostID, "serviceID": serviceID, "businessProcessID": businessProcessID, "customerID": customerID, "ip": ip, "port": port, "protocol": protocol, "cpe": cpe, "vulnID": vulnID, "vulnRef": vulnRef, "includeFlag": includeFlag, "excludeFlag": excludeFlag, "sortBy": sortBy } response = get(url, json=body if body else None, verify=verify, headers=headers ) 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 = None, 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': 82, 'limit': 796, 'responseCode': 200, 'count': 169, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Perhaps one blue recently large painting share.', 'messageTemplate': 'Good include clearly across his necessary.', 'field': 'Economy wait house customer house agency step hit.', 'parameter': {}, 'timestamp': 795263761}], 'currentPage': 105, 'size': 1} """ 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/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "ownerID": ownerID, "customerID": customerID, "name": name, "description": description, "properties": properties } response = post(url, json=body if body else None, verify=verify, headers=headers ) 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 = None, exclude: bool = None, required: bool = None, json: bool = True, verify: bool = True, apiKey: str = None, 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': 66, 'limit': 9, 'responseCode': 200, 'count': 784, 'data': [{'id': 'Million adult letter.', 'ownedByUser': {'id': 116, 'customerID': 899, 'userName': 'jcastillo', 'name': 'Erin Cortez'}, 'name': 'Michael White', 'description': 'Safe media positive teach carry trade mission.', 'totalCvss': 197, 'vulnerabilitiesCount': 342, 'createdTimestamp': 19493434, 'createdByUser': {'id': 13, 'customerID': 576, 'userName': 'arielgray', 'name': 'Brian Moore'}, 'lastUpdatedTimestamp': 370430488, 'lastUpdatedByUser': {'id': 80, 'customerID': 984, 'userName': 'michaelrogers', 'name': 'Allison Barnett'}, 'deletedTimestamp': 1171037128, 'deletedByUser': {'id': 297, 'customerID': 969, 'userName': 'amywhite', 'name': 'Melanie Scott'}, 'flags': ['UPDATED_BY_CVM'], 'properties': {'additionalProperties': 'Situation citizen raise win.'}, 'services': [{'id': 'Staff front culture all thank.', 'name': 'Tiffany Smith'}]}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Message interview source choice management way film indeed.', 'messageTemplate': 'College another serve.', 'field': 'Work admit food compare work look admit.', 'parameter': {}, 'timestamp': 666433496}], 'currentPage': 506, 'size': 906} """ 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/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "limit": limit, "offset": offset, "includeDeleted": includeDeleted, "subCriteria": subCriteria, "exclude": exclude, "required": required, "customerID": customerID, "name": name, "startTimestamp": startTimestamp, "endTimestamp": endTimestamp, "keywords": keywords, "keywordMatchStrategy": keywordMatchStrategy, "timeMatchStrategy": timeMatchStrategy, "hostID": hostID, "serviceID": serviceID, "businessProcessID": businessProcessID, "ipRange": ipRange, "applicationPort": applicationPort, "applicationProtocol": applicationProtocol, "cpe": cpe, "hostCPE": hostCPE, "applicationCPE": applicationCPE, "ownerID": ownerID, "criticality": criticality, "minimumTotalCvss": minimumTotalCvss, "maximumTotalCvss": maximumTotalCvss, "vulnerabilityReference": vulnerabilityReference, "vulnerabilityID": vulnerabilityID, "applicationRole": applicationRole, "timeFieldStrategy": timeFieldStrategy, "keywordFieldStrategy": keywordFieldStrategy, "sortBy": sortBy, "includeFlags": includeFlags, "excludeFlags": excludeFlags } response = post(url, json=body if body else None, verify=verify, headers=headers ) 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 = None, 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': 173, 'limit': 349, 'responseCode': 200, 'count': 22, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Prepare drug Democrat indicate radio already yeah.', 'messageTemplate': 'Left sort ever.', 'field': 'Become reach bring popular spring song.', 'parameter': {}, 'timestamp': 967943549}], 'currentPage': 809, 'size': 593} """ 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/' } 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 ) 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 = None, 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': 488, 'limit': 865, 'responseCode': 200, 'count': 632, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Remain end event interest figure pressure.', 'messageTemplate': 'Represent why available green discussion.', 'field': 'Kitchen arrive test Mrs page our.', 'parameter': {}, 'timestamp': 127033484}], 'currentPage': 474, 'size': 243} """ 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/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "ownerID": ownerID, "name": name, "description": description, "addProperties": addProperties, "deleteProperties": deleteProperties } response = put(url, json=body if body else None, verify=verify, headers=headers ) 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 = None, 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': 484, 'limit': 226, 'responseCode': 200, 'count': 689, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Skin possible address perform along catch.', 'messageTemplate': 'Laugh cause goal write probably concern everybody call.', 'field': 'Wait finally rule drive something.', 'parameter': {}, 'timestamp': 107422083}], 'currentPage': 245, 'size': 769} """ 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/' } 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 ) 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 = None, 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': 948, 'limit': 138, 'responseCode': 200, 'count': 707, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Address future forget mean statement wide.', 'messageTemplate': 'Friend current girl now good write.', 'field': 'Huge common reality adult each similar dream.', 'parameter': {}, 'timestamp': 26894963}], 'currentPage': 897, 'size': 798} """ 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/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "serviceAssetIDs": serviceAssetIDs } response = put(url, json=body if body else None, verify=verify, headers=headers ) 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 = None, 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': 493, 'limit': 218, 'responseCode': 200, 'count': 654, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Cost another enjoy everything.', 'messageTemplate': 'Receive wait adult business develop.', 'field': 'Particularly time television whom fish hour black.', 'parameter': {}, 'timestamp': 278456612}], 'currentPage': 756, 'size': 7} """ 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/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "serviceAssetIDs": serviceAssetIDs } response = put(url, json=body if body else None, verify=verify, headers=headers ) 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