api.customernetworks.v1.network — Argus-Toolbelt 1.0 documentation

# Source code for api.customernetworks.v1.network

    """Autogenerated API"""
    import requests
    from argus_cli.plugin import register_command

    @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": 533, "limit": 59, "responseCode": 200, "count": 534, "data": [{"id": 83, "description": "Program similar trade how civil.", "lastUpdatedByUser": {"id": 195, "customerID": 443, "userName": "jennifer49", "name": "Kristin Brown"}, "lastUpdatedTimestamp": 1474432781, "createdByUser": {"id": 471, "customerID": 539, "userName": "lowerypamela", "name": "Linda Andrade"}, "createdTimestamp": 883349900, "zone": "INTERNAL", "flags": ["GUEST"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Fact charge attorney size rate security technology.", "messageTemplate": "Record free moment out.", "field": "Himself though score all hit main.", "parameter": {}, "timestamp": 1197705214}], "currentPage": 927, "size": 903}
        """
        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

    @register_command(extending=('customernetworks','v1','network'))
    def add_customer_network(customer: str = None, location: str = None, flagsToSet: 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 flagsToSet: Flags to set 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": 308, "limit": 804, "responseCode": 200, "count": 855, "metaData": {"additionalProperties": {}}, "messages": [{"message": "On determine firm upon.", "messageTemplate": "Tough avoid data adult individual.", "field": "Political across cost speech technology wear foot.", "parameter": {}, "timestamp": 399254575}], "currentPage": 134, "size": 282}
        """
        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 flagsToSet:
            body.update({"flagsToSet": flagsToSet})

        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

    @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": 608, "limit": 368, "responseCode": 200, "count": 766, "data": [{"id": 435, "description": "Certain per later story hope.", "lastUpdatedByUser": {"id": 495, "customerID": 556, "userName": "xmcdonald", "name": "John Flores"}, "lastUpdatedTimestamp": 1286783090, "createdByUser": {"id": 934, "customerID": 639, "userName": "pluna", "name": "Brian Nelson"}, "createdTimestamp": 860003829, "zone": "INTERNAL", "flags": ["SCANNER"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "We crime ask industry eight turn everything child.", "messageTemplate": "Author school three something money total.", "field": "Try kid real.", "parameter": {}, "timestamp": 1396741697}], "currentPage": 699, "size": 551}
        """
        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

    @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": 418, "limit": 711, "responseCode": 200, "count": 919, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Third mention every degree adult various available.", "messageTemplate": "Clear couple sell green memory score marriage.", "field": "Realize however wish compare answer deal.", "parameter": {}, "timestamp": 701252332}], "currentPage": 10, "size": 397}
        """
        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

    @register_command(extending=('customernetworks','v1','network'))
    def update_customer_network(networkID: int, location: str = None, description: str = None, flagsToSet: list = 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 flagsToSet: Flags to set for the network. This property takes precedence over the content of flagsToEnable and flagsToDisable properties.
        :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": 521, "limit": 595, "responseCode": 200, "count": 54, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Bad improve drug success assume.", "messageTemplate": "Star blood her stand our his draw.", "field": "Compare rather source third.", "parameter": {}, "timestamp": 629404596}], "currentPage": 506, "size": 483}
        """
        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 flagsToSet:
            body.update({"flagsToSet": flagsToSet})

        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

    @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": 765, "limit": 428, "responseCode": 200, "count": 619, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Produce return agree American.", "messageTemplate": "Hand coach human issue result.", "field": "Nearly through herself painting.", "parameter": {}, "timestamp": 1346339885}], "currentPage": 20, "size": 557}
        """
        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

    @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": 928, "limit": 297, "responseCode": 200, "count": 608, "data": [{"id": 116, "description": "Receive series off wife.", "lastUpdatedByUser": {"id": 977, "customerID": 229, "userName": "hmckee", "name": "Susan Hickman"}, "lastUpdatedTimestamp": 569471383, "createdByUser": {"id": 449, "customerID": 696, "userName": "david84", "name": "Barbara Chapman"}, "createdTimestamp": 1219940561, "zone": "EXTERNAL", "flags": ["DNS"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Wonder defense side center dinner Mrs.", "messageTemplate": "Information weight suggest staff nice.", "field": "Red ever fill build your part manager.", "parameter": {}, "timestamp": 1444717438}], "currentPage": 516, "size": 848}
        """
        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

    @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": 901, "limit": 964, "responseCode": 200, "count": 977, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Bit project game may cup teacher store try.", "messageTemplate": "Source card before country others development.", "field": "Rule on serious thus month.", "parameter": {}, "timestamp": 778392742}], "currentPage": 169, "size": 356}
        """
        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

    @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": 17, "limit": 439, "responseCode": 200, "count": 803, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Money late this nature me apply moment challenge.", "messageTemplate": "Individual inside dream myself.", "field": "Before soon final program heavy government.", "parameter": {}, "timestamp": 202526224}], "currentPage": 452, "size": 950}
        """
        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