"""Autogenerated API"""
from argus_cli.plugin import register_command
[docs]@register_command(extending=("customernetworks","v1","network"))
def get_customer_networks(
customerID: list = None,
offset: int = None,
limit: int = 25,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Get networks belonging to customer(s) (PUBLIC)
:param list customerID: ID of customer(s)
:param int offset: Skip a number of networks
:param int limit: Maximum number of returned networks
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 937, 'limit': 115, 'responseCode': 200, 'count': 448, 'data': [{'id': 656, 'description': 'Movie car resource watch just a experience.', 'lastUpdatedByUser': {'id': 473, 'customerID': 251, 'userName': 'lstanton', 'name': 'Kevin Harris'}, 'lastUpdatedTimestamp': 1111212027, 'createdByUser': {'id': 831, 'customerID': 622, 'userName': 'danielsdiana', 'name': 'Joseph Mills'}, 'createdTimestamp': 427455679, 'zone': 'DMZ', 'flags': ['SERVER']}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Watch interesting TV important herself in.', 'messageTemplate': 'According system rest market.', 'field': 'Might beautiful start.', 'parameter': {}, 'timestamp': 1074706822}], 'currentPage': 749, 'size': 924}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customernetworks/v1/network".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,
"customerID": customerID
}
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=("customernetworks","v1","network"))
def add_customer_network(
customer: str = None,
location: str = None,
flagsToEnable: list = None,
zone: str = None,
description: str = None,
networkAddress: str = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Add new customer network (PUBLIC)
:param str customer: Customer ID or short name of the customer that the network belongs to
:param str location: Location ID or short name of the location where the network is located
:param list flagsToEnable: Flags to enable for the network
:param str zone: Zone of the network
:param str description: Description of the customer network. Maximum number of characters is 255. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param str networkAddress: IP address of the customer network => format:ip
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 714, 'limit': 329, 'responseCode': 200, 'count': 16, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Office strategy fund conference reveal half lose.', 'messageTemplate': 'Establish personal right safe food operation.', 'field': 'Beautiful avoid onto close one represent.', 'parameter': {}, 'timestamp': 257426112}], 'currentPage': 760, 'size': 765}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customernetworks/v1/network".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 = {
"customer": customer,
"location": location,
"flagsToEnable": flagsToEnable,
"zone": zone,
"description": description,
"networkAddress": networkAddress
}
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=("customernetworks","v1","network"))
def search_customer_network(
limit: int = None,
offset: int = None,
subCriteria: list = None,
customerID: list = None,
addresses: list = None,
keywords: list = None,
startTimestamp: int = None,
endTimestamp: int = None,
timeFieldStrategy: list = None,
includeFlags: list = None,
excludeFlags: list = None,
includeSupernet: bool = True,
includeSubnet: bool = True,
timeMatchStrategy: str = "any",
includeDeleted: bool = None,
exclude: bool = None,
required: bool = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Search customer network (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 addresses: A set of IP addresses matched against networks
:param list keywords: A set of keywords matched against network's description
:param int startTimestamp: Start of time search period
:param int endTimestamp: End of time search period
:param list timeFieldStrategy: TimeFieldStrategy to define which timestamp field(s) to match. (default createdTimestamp)
:param list includeFlags: Only include objects which have includeFlags set.
:param list excludeFlags: Exclude objects which have excludeFlags set.
:param bool includeSupernet: Network in search criteria will be searched for matching supernets (default true)
:param bool includeSubnet: Network in search criteria will be searched for matching subnets (default true)
:param str timeMatchStrategy: TimeMatchStrategy to define how to match startTimestamp and endTimestamp with provided timeFieldStrategies (default any)
: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 ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:returns: {'offset': 420, 'limit': 307, 'responseCode': 200, 'count': 116, 'data': [{'id': 585, 'description': 'Travel man mother feeling.', 'lastUpdatedByUser': {'id': 645, 'customerID': 389, 'userName': 'michellemckinney', 'name': 'Marc Harmon'}, 'lastUpdatedTimestamp': 407560369, 'createdByUser': {'id': 466, 'customerID': 425, 'userName': 'olivia56', 'name': 'Brandon Strong'}, 'createdTimestamp': 863908611, 'zone': 'INTERNAL', 'flags': ['SCANNER']}], 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Piece week have them similar chair arrive.', 'messageTemplate': 'Before much of improve Republican.', 'field': 'Sister town measure deal.', 'parameter': {}, 'timestamp': 1392901224}], 'currentPage': 283, 'size': 145}
"""
from requests import post
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customernetworks/v1/network/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 = {
"includeSupernet": includeSupernet,
"includeSubnet": includeSubnet,
"timeMatchStrategy": timeMatchStrategy,
"limit": limit,
"offset": offset,
"includeDeleted": includeDeleted,
"subCriteria": subCriteria,
"exclude": exclude,
"required": required,
"customerID": customerID,
"addresses": addresses,
"keywords": keywords,
"startTimestamp": startTimestamp,
"endTimestamp": endTimestamp,
"timeFieldStrategy": timeFieldStrategy,
"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=("customernetworks","v1","network"))
def get_customer_network(
networkID: int,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Get customer network (PUBLIC)
:param int networkID: ID of network to get
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 209, 'limit': 613, 'responseCode': 200, 'count': 826, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Near difficult your you.', 'messageTemplate': 'Behavior exactly late.', 'field': 'Respond stop build onto south respond authority.', 'parameter': {}, 'timestamp': 479901243}], 'currentPage': 125, 'size': 862}
"""
from requests import get
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customernetworks/v1/network/{networkID}".format(networkID=networkID)
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=("customernetworks","v1","network"))
def update_customer_network(
networkID: int,
location: str = None,
description: str = None,
flagsToEnable: list = None,
flagsToDisable: list = None,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Update customer network (PUBLIC)
:param int networkID: ID of network to update
:param str location: Location ID or short name of the location where the network is located
:param str description: Description of the customer network. Maximum number of characters is 255. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
:param list flagsToEnable: Flags to enable for the network
:param list flagsToDisable: Flags to disable for the network
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 519, 'limit': 655, 'responseCode': 200, 'count': 413, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Write bank look piece base international.', 'messageTemplate': 'Partner admit explain see best.', 'field': 'Animal executive least land discussion computer.', 'parameter': {}, 'timestamp': 637197039}], 'currentPage': 212, 'size': 412}
"""
from requests import put
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customernetworks/v1/network/{networkID}".format(networkID=networkID)
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 = {
"location": location,
"description": description,
"flagsToEnable": flagsToEnable,
"flagsToDisable": flagsToDisable
}
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=("customernetworks","v1","network"))
def delete_customer_network(
networkID: int,
json: bool = True,
verify: bool = True,
apiKey: str = None,
authentication: dict = {}
) -> dict:
"""Delete customer network (PUBLIC)
:param int networkID: ID of network to delete
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {'offset': 110, 'limit': 75, 'responseCode': 200, 'count': 516, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Father policy growth may process heavy.', 'messageTemplate': 'Peace know drug quite movie new worker.', 'field': 'Particular according hour inside bill.', 'parameter': {}, 'timestamp': 1253181263}], 'currentPage': 349, 'size': 802}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://portal.mnemonic.no/web/api/customernetworks/v1/network/{networkID}".format(networkID=networkID)
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