Source code for api.customernetworks.v1.network

"""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
[docs]@register_command(extending=('customernetworks','v1','network')) def get_customer_network_comments(networkID: int, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Get network's comments (PUBLIC) :param int networkID: ID of network :param int offset: Skip a number of comments :param int limit: Maximum number of returned comments :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 375, "limit": 476, "responseCode": 200, "count": 371, "data": [{"id": 165, "description": "Across international sometimes source.", "lastUpdatedByUser": {"id": 595, "customerID": 308, "userName": "patriciawashington", "name": "Cheryl Thomas"}, "lastUpdatedTimestamp": 1393402238, "createdByUser": {"id": 412, "customerID": 898, "userName": "nherrera", "name": "Heather Gardner"}, "createdTimestamp": 7932368, "zone": "INTERNAL", "flags": ["DNS"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Large cultural report property support.", "messageTemplate": "Particularly energy special fish church bar.", "field": "Move state through reduce article.", "parameter": {}, "timestamp": 754023358}], "currentPage": 487, "size": 252} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customernetworks/v1/network/{networkID}/comments".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 offset: body.update({"offset": offset}) if limit: body.update({"limit": limit}) 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_comment(networkID: int, comment: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Add comment for customer network (PUBLIC) :param int networkID: ID of network to update :param str comment: Comment to add to the network => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 751, "limit": 751, "responseCode": 200, "count": 566, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Pm throughout change begin.", "messageTemplate": "Customer strong simple race wall.", "field": "Subject enter happy able.", "parameter": {}, "timestamp": 580462496}], "currentPage": 152, "size": 268} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customernetworks/v1/network/{networkID}/comments".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 comment: body.update({"comment": comment}) 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 delete_customer_network_comment(networkID: int, commentID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Delete comment from customer network (PUBLIC) :param int networkID: ID of parent network :param str commentID: ID of comment to delete :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 636, "limit": 890, "responseCode": 200, "count": 866, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Past per professional account safe.", "messageTemplate": "Degree over appear she down ever.", "field": "Red energy late rest approach cold after.", "parameter": {}, "timestamp": 1255305240}], "currentPage": 315, "size": 398} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/customernetworks/v1/network/{networkID}/comments/{commentID}".format(networkID=networkID, commentID=commentID) 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