"""Autogenerated API"""
from argus_cli.plugin import register_command
[docs]@register_command(extending=("assets","v1","vulnerability"))
def search_asset_vulnerabilities_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,
resolutionCode: 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 AssetVulnerabilities 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 resolutionCode: Search by resolution code
: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': 506, 'limit': 51, 'responseCode': 200, 'count': 370, 'data': [{'id': 'Himself respond friend include none.', 'vulnerabilityID': 'South tell must history coach star stay note.', 'references': ['Exist anything hold until image might institution.'], 'name': 'Lance Meyer', 'description': 'Administration wish charge especially next line probably.', 'conclusion': 'Family phone be tonight art item reality.', 'solution': 'Feeling these writer interview foot.', 'rawOutput': 'Truth any serious particularly.', 'cvss': 599, 'createdTimestamp': 1190035543, 'createdByUser': {'id': 189, 'customerID': 544, 'userName': 'hlamb', 'name': 'Shelia Stevens'}, 'lastUpdatedTimestamp': 1084189992, 'lastUpdatedByUser': {'id': 439, 'customerID': 159, 'userName': 'nicholas40', 'name': 'Jessica Hansen'}, 'deletedTimestamp': 1323085917, 'deletedByUser': {'id': 744, 'customerID': 156, 'userName': 'amber90', 'name': 'Stephanie Castro'}, 'firstSeenTimestamp': 949607992, 'lastSeenTimestamp': 470490943, 'resolutionTimestamp': 324881559, 'resolvedByUser': {'id': 245, 'customerID': 465, 'userName': 'mary92', 'name': 'Robert Hudson'}, 'resolutionComment': 'Day shoulder herself born people ready item only.', 'resolution': 'SERVICE_NOT_AVAILABLE', 'flags': ['UPDATED_BY_CVM'], 'properties': {'additionalProperties': 'Difficult employee doctor site statement by as option.'}, 'severity': 'critical', 'socket': 'Surface herself bring seven go provide poor.'}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Improve away window dream control around.', 'messageTemplate': 'Business culture realize single.', 'field': 'Wait my official interview hot.', 'parameter': {}, 'timestamp': 424757596}], 'currentPage': 770, 'size': 614}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/vulnerability".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,
"resolutionCode": resolutionCode,
"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","vulnerability"))
def add_asset_vulnerability(
hostID: str = None,
vulnerabilityID: str = None,
references: list = None,
name: str = None,
description: str = None,
conclusion: str = None,
solution: str = None,
rawOutput: str = None,
cvss: int = None,
severity: str = None,
properties: dict = None,
socket: str = None,
source: str = "USER",
exploitAvailable: bool = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Creates a new AssetVulnerability. (PUBLIC)
:param str hostID: Specify parent host.
:param str vulnerabilityID: Identifier of vulnerability (e.g. plug-in ID from vulnerability scanner). => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list references: References to vulnerability (e.g. CVE number).
:param str name: Name of vulnerability. Will be sanitized and no line break allowed.
:param str description: Description of vulnerability. Will be sanitized.
:param str conclusion: Short summary of vulnerability. Will be sanitized.
:param str solution: How to fix vulnerability. Will be sanitized.
:param str rawOutput: Raw output from vulnerability scan. Will be sanitized.
:param int cvss: CVSS score of vulnerability (range from 0 to 10).
:param str severity: Severity level of vulnerability.
:param dict properties: Custom user-defined properties. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str socket: Specify socket string of the vulnerability (e.g. tcp/80), or omit if not bound to a socket.
:param str source: Source of the request. (default USER)
:param bool exploitAvailable: Set if an exploit is available for the vulnerability.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 465, 'limit': 35, 'responseCode': 200, 'count': 136, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Course cup while best institution school.', 'messageTemplate': 'Seven that need movement already.', 'field': 'Study church staff weight rate.', 'parameter': {}, 'timestamp': 582459234}], 'currentPage': 348, 'size': 845}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/vulnerability".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 = {
"source": source,
"hostID": hostID,
"vulnerabilityID": vulnerabilityID,
"references": references,
"name": name,
"description": description,
"conclusion": conclusion,
"solution": solution,
"rawOutput": rawOutput,
"cvss": cvss,
"severity": severity,
"properties": properties,
"exploitAvailable": exploitAvailable,
"socket": socket
}
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","vulnerability"))
def search_asset_vulnerabilities(
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,
minimumCvss: int = None,
maximumCvss: int = None,
severity: list = None,
resolutionCode: list = None,
vulnerabilityReference: list = None,
vulnerabilityID: 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,
includeRawOutput: bool = None,
includeConclusion: bool = None,
includeSolution: bool = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Returns a set of AssetVulnerabilities defined by an AssetVulnerabilitySearchCriteria. (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 int minimumCvss: Restrict search to vulnerabilities with CVSS score at least this high.
:param int maximumCvss: Restrict search to vulnerabilities with CVSS score no more than this.
:param list severity: Restrict search to specified severity levels.
:param list resolutionCode: Restrict search to specific resolution codes.
:param list vulnerabilityReference: Restrict to vulnerabilities identified by vulnerability reference.
:param list vulnerabilityID: Restrict to vulnerabilities identified by vulnerability ID.
: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).
:param bool includeRawOutput: Include vulnerability rawOutput in result (default false)
:param bool includeConclusion: Include vulnerability conclusion in result (default false)
:param bool includeSolution: Include vulnerability solution in result (default false)
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 584, 'limit': 457, 'responseCode': 200, 'count': 502, 'data': [{'id': 'Hand to few increase.', 'vulnerabilityID': 'Send region resource.', 'references': ['Responsibility last painting development.'], 'name': 'Tracey Ramsey', 'description': 'Power best beyond give.', 'conclusion': 'Check peace himself smile.', 'solution': 'Especially product center red.', 'rawOutput': 'Effect relate picture agree try.', 'cvss': 150, 'createdTimestamp': 722909578, 'createdByUser': {'id': 170, 'customerID': 212, 'userName': 'gonzalezbrooke', 'name': 'Melissa Rios'}, 'lastUpdatedTimestamp': 498972145, 'lastUpdatedByUser': {'id': 182, 'customerID': 589, 'userName': 'valerie48', 'name': 'Michael Melendez'}, 'deletedTimestamp': 429684306, 'deletedByUser': {'id': 327, 'customerID': 401, 'userName': 'ematthews', 'name': 'Stefanie Alexander'}, 'firstSeenTimestamp': 1265045693, 'lastSeenTimestamp': 1283218948, 'resolutionTimestamp': 1316485192, 'resolvedByUser': {'id': 554, 'customerID': 680, 'userName': 'kennethfuentes', 'name': 'Tammy Clark'}, 'resolutionComment': 'Explain site city art before.', 'resolution': 'ACCEPTED', 'flags': ['CREATED_BY_CVM'], 'properties': {'additionalProperties': 'Field fall almost cost name.'}, 'severity': 'low', 'socket': 'Would painting mean better part hard increase.'}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Dream here style of.', 'messageTemplate': 'Everybody appear many member.', 'field': 'Ahead face room then couple.', 'parameter': {}, 'timestamp': 19078236}], 'currentPage': 415, 'size': 488}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/vulnerability/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,
"minimumCvss": minimumCvss,
"maximumCvss": maximumCvss,
"severity": severity,
"resolutionCode": resolutionCode,
"vulnerabilityReference": vulnerabilityReference,
"vulnerabilityID": vulnerabilityID,
"timeFieldStrategy": timeFieldStrategy,
"keywordFieldStrategy": keywordFieldStrategy,
"includeRawOutput": includeRawOutput,
"includeConclusion": includeConclusion,
"includeSolution": includeSolution,
"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","vulnerability"))
def get_asset_vulnerability(
id: str,
includeRawOutput: bool = True,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Returns an AssetVulnerability identified by its ID. (PUBLIC)
:param str id: AssetVulnerability ID
:param bool includeRawOutput: Include raw output
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 738, 'limit': 938, 'responseCode': 200, 'count': 723, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'List rule spring their nation power imagine.', 'messageTemplate': 'Medical develop arrive also.', 'field': 'Rest tree development find because game million friend.', 'parameter': {}, 'timestamp': 1356048050}], 'currentPage': 350, 'size': 338}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/vulnerability/{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 = {
"includeRawOutput": includeRawOutput
}
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","vulnerability"))
def update_asset_vulnerability(
id: str,
addReferences: list = None,
deleteReferences: list = None,
name: str = None,
description: str = None,
conclusion: str = None,
solution: str = None,
rawOutput: str = None,
cvss: int = None,
severity: str = None,
addProperties: dict = None,
deleteProperties: list = None,
source: str = "USER",
exploitAvailable: bool = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Updates an existing AssetVulnerability. (PUBLIC)
:param str id: AssetVulnerability ID
:param list addReferences: Add references to vulnerability (e.g. CVE number).
:param list deleteReferences: Delete references from vulnerability.
:param str name: Change vulnerability name. Will be sanitized and no line break allowed.
:param str description: Change vulnerability description. Will be sanitized.
:param str conclusion: Change vulnerability summary. Will be sanitized.
:param str solution: Change vulnerability solution. Will be sanitized.
:param str rawOutput: Change raw output from vulnerability scan. Will be sanitized.
:param int cvss: Change CVSS score of vulnerability (range from 0 to 10).
:param str severity: Change severity level of vulnerability.
:param dict addProperties: Add custom properties (updates a property if key already exists). => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list deleteProperties: Delete custom properties by key.
:param str source: Source of the request. (default USER)
:param bool exploitAvailable: Set if an exploit is available for the vulnerability.
:raises AuthenticationFailedException: on 401
:raises ValidationErrorException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 284, 'limit': 15, 'responseCode': 200, 'count': 453, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Leave rule may generation exactly accept.', 'messageTemplate': 'Management record side hospital.', 'field': 'Certainly similar scene.', 'parameter': {}, 'timestamp': 368761509}], 'currentPage': 34, 'size': 65}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/vulnerability/{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 = {
"source": source,
"addReferences": addReferences,
"deleteReferences": deleteReferences,
"name": name,
"description": description,
"conclusion": conclusion,
"solution": solution,
"rawOutput": rawOutput,
"cvss": cvss,
"severity": severity,
"addProperties": addProperties,
"deleteProperties": deleteProperties,
"exploitAvailable": exploitAvailable
}
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","vulnerability"))
def delete_asset_vulnerability(
id: str,
source: str = "USER",
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Marks an AssetVulnerability as deleted. (PUBLIC)
:param str id: AssetVulnerability 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': 129, 'limit': 950, 'responseCode': 200, 'count': 505, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Spring ability than argue.', 'messageTemplate': 'Involve modern manage international eye where figure.', 'field': 'Economic rest society black American especially.', 'parameter': {}, 'timestamp': 483796134}], 'currentPage': 986, 'size': 348}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/vulnerability/{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 = {
"source": source
}
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","vulnerability"))
def resolve_asset_vulnerability(
id: str,
resolution: str = None,
comment: str = None,
source: str = "USER",
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Resolves an AssetVulnerability. (PUBLIC)
:param str id: AssetVulnerability ID
:param str resolution: Specify resolution reason.
:param str comment: Comment on why the vulnerability is resolved. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
: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': 965, 'limit': 372, 'responseCode': 200, 'count': 687, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Leg it mission sometimes house industry.', 'messageTemplate': 'Individual commercial movie father couple.', 'field': 'Film young answer would really nice.', 'parameter': {}, 'timestamp': 94311198}], 'currentPage': 213, 'size': 254}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/assets/v1/vulnerability/{id}/resolve".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 = {
"source": source,
"resolution": resolution,
"comment": comment
}
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