api.alarms.v1.category — Argus-Toolbelt 1.0 documentation

# Source code for api.alarms.v1.category

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

    @register_command(extending=('alarms','v1','category'))
    def get_categories(keywords: list = None, keywordField: list = None, offset: int = 0, limit: int = 25, keywordMatch: str = 'all',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Get all categories (PUBLIC)

        :param list keywords: Filter categories by keywords
        :param list keywordField: Set field strategy for keyword search
        :param int offset: Skip a number of categories
        :param int limit: Maximum number of returned categories
        :param str keywordMatch: Set match strategy for keyword search
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 542, "limit": 898, "responseCode": 200, "count": 258, "data": [{"id": 768, "info": "Then task stand increase agent.", "name": "Jose Romero", "flags": ["RECONNAISSANCE"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Itself want possible special not.", "messageTemplate": "Begin hard even necessary few.", "field": "Low may must since response dark ball.", "parameter": {}, "timestamp": 1236470465}], "currentPage": 396, "size": 194}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://portal.mnemonic.no/web/api/alarms/v1/category".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 keywordMatch:
            body.update({"keywordMatch": keywordMatch})

        if keywords:
            body.update({"keywords": keywords})

        if keywordField:
            body.update({"keywordField": keywordField})

        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=('alarms','v1','category'))
    def search_categories(limit: int = None, offset: int = None, subCriteria: list = None, attackCategoryID: list = None, keywords: list = None, keywordFieldStrategy: list = None, sortBy: list = None, includeFlags: list = None, excludeFlags: list = None, keywordMatchStrategy: str = 'all', includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Get all categories matching a given search criteria (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 attackCategoryID: A set of IDs for attack categories (alarm category).
        :param list keywords: A set of keywords matched against categories based on the set KeywordFieldStrategy and KeywordMatchStrategy.
        :param list keywordFieldStrategy: KeywordFieldStrategy to define which field(s) to match against keywords. (default all)
        :param list sortBy: List of properties to sort by (prefix with "-" to sort descending).
        :param list includeFlags: Only include objects which have includeFlags set.
        :param list excludeFlags: Exclude objects which have excludeFlags set.
        :param str keywordMatchStrategy: KeywordMatchStrategy to define how to match keywords with fields. (default all)
        :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 ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 206, "limit": 42, "responseCode": 200, "count": 399, "data": [{"id": 361, "info": "Evidence open anyone what left several economy four.", "name": "Alexander Hurst", "flags": ["DELETED"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Program appear law what kind shoulder center.", "messageTemplate": "Modern center interview speak she.", "field": "Help realize song.", "parameter": {}, "timestamp": 1021965963}], "currentPage": 285, "size": 461}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://portal.mnemonic.no/web/api/alarms/v1/category/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 keywordMatchStrategy:
            body.update({"keywordMatchStrategy": keywordMatchStrategy})

        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 attackCategoryID:
            body.update({"attackCategoryID": attackCategoryID})

        if keywords:
            body.update({"keywords": keywords})

        if keywordFieldStrategy:
            body.update({"keywordFieldStrategy": keywordFieldStrategy})

        if sortBy:
            body.update({"sortBy": sortBy})

        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=('alarms','v1','category'))
    def get_category_by_id(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Get category by Id (PUBLIC)

        :param int id: ID of category
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 278, "limit": 154, "responseCode": 200, "count": 744, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Economic quite important unit tax summer describe.", "messageTemplate": "Quality our trade always yet.", "field": "Although physical necessary western election language have.", "parameter": {}, "timestamp": 279520474}], "currentPage": 833, "size": 966}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://portal.mnemonic.no/web/api/alarms/v1/category/{id}".format(id=id)
        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