Source code for api.assets.v1.application

"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command


[docs]@register_command(extending=('assets','v1','application')) def search_host_applications_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, 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 a set of HostApplications 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 includeFlag: Include certain HostApplications in the search result based on set flags :param list excludeFlag: Exclude certain HostApplications 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": 535, "limit": 206, "responseCode": 200, "count": 950, "data": [{"id": "Decade end discover by own.", "name": "Taylor Lee", "description": "Realize TV event discuss.", "createdTimestamp": 1418935917, "createdByUser": {"id": 368, "customerID": 359, "userName": "browncarol", "name": "Kimberly Anderson"}, "lastUpdatedTimestamp": 240093958, "lastUpdatedByUser": {"id": 406, "customerID": 851, "userName": "sheilalee", "name": "Cheryl Harris"}, "deletedTimestamp": 1183715432, "deletedByUser": {"id": 990, "customerID": 970, "userName": "daniel81", "name": "Destiny Carey"}, "firstSeenTimestamp": 138481663, "lastSeenTimestamp": 133111939, "flags": ["UPDATED_BY_CVM"], "properties": {"additionalProperties": "Return machine perform poor just tend."}, "cpe": "Recognize have red out maintain official wish.", "sockets": ["Loss occur I wonder go."]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Federal professor model no.", "messageTemplate": "Add include population risk pretty not stuff.", "field": "Work true gun pretty party.", "parameter": {}, "timestamp": 1439986246}], "currentPage": 992, "size": 279} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/application".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 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','application')) def add_host_application(hostID: str = None, roleID: int = None, name: str = None, description: str = None, properties: dict = None, cpe: str = None, sockets: list = None, source: str = 'USER',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Creates a new HostApplication. (PUBLIC) :param str hostID: Specify parent host. :param int roleID: Specify application role. :param str name: Name of application. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str description: Description of application. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param dict properties: Custom user-defined properties. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str cpe: CPE of application. :param list sockets: Specify socket strings of the application. :param str source: Source of the request. (default USER) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 646, "limit": 973, "responseCode": 200, "count": 404, "metaData": {"additionalProperties": {}}, "messages": [{"message": "House southern few reason allow gun life.", "messageTemplate": "Quite radio campaign over conference.", "field": "Not customer film official name thought.", "parameter": {}, "timestamp": 1035190411}], "currentPage": 159, "size": 333} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/application".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 source: body.update({"source": source}) if hostID: body.update({"hostID": hostID}) if roleID: body.update({"roleID": roleID}) if name: body.update({"name": name}) if description: body.update({"description": description}) if properties: body.update({"properties": properties}) if cpe: body.update({"cpe": cpe}) if sockets: body.update({"sockets": sockets}) 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','application')) def search_host_applications(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, 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 HostApplications defined by a HostApplicationSearchCriteria. (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 applicationRole: Search for applications by role (list of role IDs). :param list timeFieldStrategy: Defines which timestamps will be included in the search (default lastUpdatedTimestamp). :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": 18, "limit": 612, "responseCode": 200, "count": 138, "data": [{"id": "Mr suddenly well scientist.", "name": "Michael Vega", "description": "Score assume cover whatever card per kind.", "createdTimestamp": 561388168, "createdByUser": {"id": 616, "customerID": 847, "userName": "fgonzalez", "name": "Stephen Davis"}, "lastUpdatedTimestamp": 1391556029, "lastUpdatedByUser": {"id": 858, "customerID": 234, "userName": "thompsondale", "name": "Joshua Kent"}, "deletedTimestamp": 1203663703, "deletedByUser": {"id": 315, "customerID": 473, "userName": "dennisblake", "name": "Jill Villa"}, "firstSeenTimestamp": 996586131, "lastSeenTimestamp": 848656206, "flags": ["CREATED_BY_CVM"], "properties": {"additionalProperties": "Turn where over dark Mrs along quite."}, "cpe": "Back step travel magazine whether administration.", "sockets": ["Read central court agreement meeting."]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Huge put will town lawyer.", "messageTemplate": "Seven add cover kid local television.", "field": "Region social forward data national like word join.", "parameter": {}, "timestamp": 1451710518}], "currentPage": 355, "size": 104} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/application/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 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','application')) def search_host_application_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, 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 host application 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 applicationRole: Search for applications by role (list of role IDs). :param list timeFieldStrategy: Defines which timestamps will be included in the search (default lastUpdatedTimestamp). :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 applications) :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 applications) :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": 492, "limit": 464, "responseCode": 200, "count": 281, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Seat Democrat pass foreign forget over stage where.", "messageTemplate": "Fear purpose sound since sit suddenly.", "field": "Tough people authority seek.", "parameter": {}, "timestamp": 519351006}], "currentPage": 558, "size": 307} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/application/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 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','application')) def get_host_application(id: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Returns a HostApplication identified by its ID. (PUBLIC) :param str id: HostApplication ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 208, "limit": 94, "responseCode": 200, "count": 580, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Born century high kid.", "messageTemplate": "Professor maybe policy sign society smile.", "field": "Line great already put for physical performance.", "parameter": {}, "timestamp": 861328090}], "currentPage": 969, "size": 504} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/application/{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','application')) def update_host_application(id: str, roleID: int = None, name: str = None, description: str = None, addProperties: dict = None, deleteProperties: list = None, cpe: str = None, addSockets: list = None, deleteSockets: list = None, source: str = 'USER',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Updates an existing HostApplication. (PUBLIC) :param str id: HostApplication ID :param int roleID: Change application role. :param str name: Change application name. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str description: Change application description. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param dict addProperties: Add properties to application (updates a property if key already exists). => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param list deleteProperties: Remove properties from application by key. :param str cpe: Change application CPE. :param list addSockets: Add sockets to application (list of protocol/port, e.g. tcp/80). :param list deleteSockets: Remove sockets from application (list of protocol/port, e.g. tcp/80). :param str source: Source of the request. (default USER) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 587, "limit": 266, "responseCode": 200, "count": 694, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Lay Republican center a stuff.", "messageTemplate": "Reach financial best we education.", "field": "Group federal pull least.", "parameter": {}, "timestamp": 1415891034}], "currentPage": 511, "size": 777} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/application/{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 source: body.update({"source": source}) if roleID: body.update({"roleID": roleID}) if name: body.update({"name": name}) if description: body.update({"description": description}) if addProperties: body.update({"addProperties": addProperties}) if deleteProperties: body.update({"deleteProperties": deleteProperties}) if cpe: body.update({"cpe": cpe}) if addSockets: body.update({"addSockets": addSockets}) if deleteSockets: body.update({"deleteSockets": deleteSockets}) 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','application')) def delete_host_application(id: str, source: str = 'USER',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Marks a HostApplication as deleted. (PUBLIC) :param str id: HostApplication ID :param str source: Request source (default USER) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 55, "limit": 382, "responseCode": 200, "count": 114, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Agency rich do whose smile budget.", "messageTemplate": "Strong lay particular receive me ability table.", "field": "Foot free rate scientist.", "parameter": {}, "timestamp": 841957888}], "currentPage": 518, "size": 381} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/assets/v1/application/{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 source: body.update({"source": source}) 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