"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('customernetworks','v1','network'))
def get_customer_networks(customerID: list = None, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", 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": 602, "limit": 309, "responseCode": 200, "count": 40, "data": [{"id": 562, "description": "Professional reduce Republican visit war offer hundred.", "lastUpdatedByUser": {"id": 424, "customerID": 186, "userName": "brendanbeck", "name": "Timothy Ross"}, "lastUpdatedTimestamp": 316203356, "createdByUser": {"id": 851, "customerID": 162, "userName": "ian92", "name": "George Williams"}, "createdTimestamp": 955371766, "zone": "EXTERNAL", "flags": ["CLIENT"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Else image new treat.", "messageTemplate": "With structure similar ball offer relate serve.", "field": "Vote ten form community work success arm.", "parameter": {}, "timestamp": 52887463}], "currentPage": 257, "size": 956}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customernetworks/v1/network".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 customerID:
body.update({"customerID": customerID})
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=('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 = "", 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": 240, "limit": 812, "responseCode": 200, "count": 0, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Behind themselves get describe property able.", "messageTemplate": "Case me film put opportunity operation identify Mr.", "field": "Pick rate Democrat market positive let let.", "parameter": {}, "timestamp": 989708578}], "currentPage": 197, "size": 935}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customernetworks/v1/network".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 customer:
body.update({"customer": customer})
if location:
body.update({"location": location})
if flagsToEnable:
body.update({"flagsToEnable": flagsToEnable})
if zone:
body.update({"zone": zone})
if description:
body.update({"description": description})
if networkAddress:
body.update({"networkAddress": networkAddress})
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=('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 = 'False', exclude: bool = 'False', required: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", 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": 958, "limit": 830, "responseCode": 200, "count": 284, "data": [{"id": 211, "description": "Medical baby each even beyond detail travel catch.", "lastUpdatedByUser": {"id": 882, "customerID": 261, "userName": "schultzeric", "name": "Rebecca Merritt"}, "lastUpdatedTimestamp": 1436762694, "createdByUser": {"id": 506, "customerID": 167, "userName": "danielgonzalez", "name": "Richard Brown"}, "createdTimestamp": 391803733, "zone": "UNKNOWN", "flags": ["GUEST"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "By we focus cover fear enough town.", "messageTemplate": "Piece have amount company thus.", "field": "Computer above reduce first training business.", "parameter": {}, "timestamp": 563892758}], "currentPage": 662, "size": 409}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customernetworks/v1/network/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 includeSupernet:
body.update({"includeSupernet": includeSupernet})
if includeSubnet:
body.update({"includeSubnet": includeSubnet})
if timeMatchStrategy:
body.update({"timeMatchStrategy": timeMatchStrategy})
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 addresses:
body.update({"addresses": addresses})
if keywords:
body.update({"keywords": keywords})
if startTimestamp:
body.update({"startTimestamp": startTimestamp})
if endTimestamp:
body.update({"endTimestamp": endTimestamp})
if timeFieldStrategy:
body.update({"timeFieldStrategy": timeFieldStrategy})
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=('customernetworks','v1','network'))
def get_customer_network(networkID: int,json: bool = True, verify: bool = True, apiKey: str = "", 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": 282, "limit": 384, "responseCode": 200, "count": 650, "metaData": {"additionalProperties": {}}, "messages": [{"message": "More look yes stuff.", "messageTemplate": "Specific against firm year close provide.", "field": "Maybe wonder responsibility finally.", "parameter": {}, "timestamp": 670037650}], "currentPage": 260, "size": 539}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customernetworks/v1/network/{networkID}".format(networkID=networkID)
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=('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 = "", 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": 820, "limit": 318, "responseCode": 200, "count": 487, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Yeah young offer box.", "messageTemplate": "Science against wonder stock fact number everything.", "field": "Miss yet he green everything discussion beautiful store.", "parameter": {}, "timestamp": 1416504453}], "currentPage": 490, "size": 343}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customernetworks/v1/network/{networkID}".format(networkID=networkID)
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 location:
body.update({"location": location})
if description:
body.update({"description": description})
if flagsToEnable:
body.update({"flagsToEnable": flagsToEnable})
if flagsToDisable:
body.update({"flagsToDisable": flagsToDisable})
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=('customernetworks','v1','network'))
def delete_customer_network(networkID: int,json: bool = True, verify: bool = True, apiKey: str = "", 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": 185, "limit": 711, "responseCode": 200, "count": 360, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Pattern team get shake international happy research.", "messageTemplate": "Republican according natural one.", "field": "Study project investment each series.", "parameter": {}, "timestamp": 727637855}], "currentPage": 282, "size": 842}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customernetworks/v1/network/{networkID}".format(networkID=networkID)
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
response = delete(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response