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": 321, "limit": 201, "responseCode": 200, "count": 747, "data": [{"id": 647, "description": "Many send hair.", "lastUpdatedByUser": {"id": 315, "customerID": 728, "userName": "whitekatherine", "name": "Jared Roth"}, "lastUpdatedTimestamp": 1107412133, "createdByUser": {"id": 160, "customerID": 528, "userName": "aaron79", "name": "Jonathan Cook"}, "createdTimestamp": 1131430514, "zone": "DMZ", "flags": ["PROXY"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Same prevent few one.", "messageTemplate": "Somebody manage spend policy my bank.", "field": "Responsibility on training threat.", "parameter": {}, "timestamp": 72210800}], "currentPage": 14, "size": 315} """ 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/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": 931, "limit": 840, "responseCode": 200, "count": 511, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Yet indicate while picture tax several local.", "messageTemplate": "Culture exactly detail worry usually possible right.", "field": "Name effort receive style or understand.", "parameter": {}, "timestamp": 349320720}], "currentPage": 426, "size": 539} """ 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/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": 87, "limit": 303, "responseCode": 200, "count": 491, "data": [{"id": 962, "description": "Sense fly world current between.", "lastUpdatedByUser": {"id": 809, "customerID": 611, "userName": "amysimmons", "name": "Roger Fisher II"}, "lastUpdatedTimestamp": 97777621, "createdByUser": {"id": 334, "customerID": 390, "userName": "jensencarl", "name": "Erica Garcia"}, "createdTimestamp": 329734675, "zone": "DMZ", "flags": ["SERVER"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Law subject son help.", "messageTemplate": "Foreign religious somebody organization against single defense.", "field": "Reflect look admit experience.", "parameter": {}, "timestamp": 834275566}], "currentPage": 784, "size": 850} """ 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/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": 985, "limit": 342, "responseCode": 200, "count": 380, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Large try myself artist job month.", "messageTemplate": "Say take laugh learn help nearly.", "field": "Add affect base road.", "parameter": {}, "timestamp": 1028606948}], "currentPage": 125, "size": 632} """ 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/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": 65, "limit": 485, "responseCode": 200, "count": 774, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Stage artist piece follow sign.", "messageTemplate": "Box as chair design evidence.", "field": "Popular quality them one easy investment pressure.", "parameter": {}, "timestamp": 161432092}], "currentPage": 703, "size": 29} """ 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/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": 380, "limit": 983, "responseCode": 200, "count": 155, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Too anything but yeah worker last.", "messageTemplate": "Cell and cause job while.", "field": "Purpose area treatment drop various society let wind.", "parameter": {}, "timestamp": 68196882}], "currentPage": 606, "size": 542} """ 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/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": 711, "limit": 143, "responseCode": 200, "count": 445, "data": [{"id": 114, "description": "Cold all piece exactly.", "lastUpdatedByUser": {"id": 392, "customerID": 777, "userName": "christopher19", "name": "Brett Davis"}, "lastUpdatedTimestamp": 897674729, "createdByUser": {"id": 791, "customerID": 960, "userName": "iharvey", "name": "Paul Martinez"}, "createdTimestamp": 813556167, "zone": "DMZ", "flags": ["NAT"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Cause yes add old require morning it issue.", "messageTemplate": "Blue writer record mean determine price natural.", "field": "Factor rise smile man lead question.", "parameter": {}, "timestamp": 915311923}], "currentPage": 513, "size": 276} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 456, "limit": 650, "responseCode": 200, "count": 264, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Issue example support perform run force.", "messageTemplate": "Establish me simply parent prevent.", "field": "Four husband knowledge pressure.", "parameter": {}, "timestamp": 1333382307}], "currentPage": 657, "size": 138} """ from requests import post from argus_api.exceptions import http url = "https://portal.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": 567, "limit": 359, "responseCode": 200, "count": 147, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Decade defense take street.", "messageTemplate": "Nothing stuff our parent clearly home.", "field": "Speech former season break either never.", "parameter": {}, "timestamp": 506178345}], "currentPage": 495, "size": 691} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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