api.reputation.v1.role — Argus-Toolbelt 1.0 documentation

# Source code for api.reputation.v1.role

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

    @register_command(extending=('reputation','v1','role'))
    def list_roles(search: str = None, offset: int = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List reputation roles (INTERNAL)

        :param str search: Limit result to roles matching this search string
        :param int offset: Offset result
        :param int limit: Limit result
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 153, "limit": 253, "responseCode": 200, "count": 671, "data": [{"id": 322, "flags": 31, "alias": "Eight eight notice plan.", "name": "Stephen Valenzuela", "score": 935, "deleted": true, "lastUpdatedTimestamp": 316670984}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Six audience dream.", "messageTemplate": "Rule door necessary family.", "field": "Western behind sometimes eight least.", "parameter": {}, "timestamp": 1342096459}], "currentPage": 889, "size": 120}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/role".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 limit:
            body.update({"limit": limit})

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

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

        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=('reputation','v1','role'))
    def add_new_role(alias: str = None, name: str = None, score: int = 0.0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Add new reputation role (INTERNAL)

        :param str alias: Role alias  => [a-zA-Z0-9_\-\.]*
        :param str name: Role name  => [a-zA-Z0-9_\-\.]*
        :param int score: Role score (default 0.0)
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 855, "limit": 479, "responseCode": 200, "count": 591, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Program discuss generation great.", "messageTemplate": "Building pattern either feeling firm value eight.", "field": "Affect although stand voice high population agree.", "parameter": {}, "timestamp": 402906782}], "currentPage": 176, "size": 44}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/role".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 alias:
            body.update({"alias": alias})

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

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

        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=('reputation','v1','role'))
    def search_roles(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, subCriteria: list = None, id: list = None, searchString: str = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Search reputation roles (INTERNAL)

        :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 int includeFlags: Only include objects which have includeFlags set.
        :param int excludeFlags: Exclude objects which have excludeFlags set.
        :param list subCriteria:
        :param list id:
        :param str searchString:
        :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": 62, "limit": 337, "responseCode": 200, "count": 791, "data": [{"id": 973, "flags": 721, "alias": "Employee pressure drive style trouble.", "name": "Paul King", "score": 990, "deleted": true, "lastUpdatedTimestamp": 1009610463}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Serious hotel memory response movement less skin.", "messageTemplate": "Tough store father their which health loss ten.", "field": "Final pretty give fall which apply.", "parameter": {}, "timestamp": 1372056921}], "currentPage": 968, "size": 796}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/role/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 limit:
            body.update({"limit": limit})

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

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

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

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

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

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

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

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

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

        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=('reputation','v1','role'))
    def get_role_by_alias(alias: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch reputation role by role alias (INTERNAL)

        :param str alias: Alias of role to fetch
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 802, "limit": 996, "responseCode": 200, "count": 9, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Media although character hair then thousand thus.", "messageTemplate": "Difficult development care course page food kid.", "field": "Analysis medical tough media science natural.", "parameter": {}, "timestamp": 554660976}], "currentPage": 55, "size": 16}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/role/{alias}".format(alias=alias)
        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=('reputation','v1','role'))
    def get_role_by_id(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch reputation role by ID (INTERNAL)

        :param int id: ID of role to fetch
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 925, "limit": 152, "responseCode": 200, "count": 532, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Kitchen listen window read.", "messageTemplate": "Newspaper admit discussion authority poor campaign body.", "field": "Baby toward poor word season.", "parameter": {}, "timestamp": 1163088136}], "currentPage": 744, "size": 665}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/role/{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

    @register_command(extending=('reputation','v1','role'))
    def update_role(id: int, alias: str = None, name: str = None, score: int = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Update reputation role (INTERNAL)

        :param int id: ID of role to update
        :param str alias: [a-zA-Z0-9_\-\.]*
        :param str name: [a-zA-Z0-9_\-\.]*
        :param int score:
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 787, "limit": 702, "responseCode": 200, "count": 324, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Offer call right reveal.", "messageTemplate": "Must during keep camera.", "field": "Go name second discuss hot remain road those.", "parameter": {}, "timestamp": 1309455936}], "currentPage": 642, "size": 613}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/role/{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 = {}

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

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

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

        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=('reputation','v1','role'))
    def delete_role(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Delete reputation role (INTERNAL)

        :param int id: ID of role to delete
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 138, "limit": 805, "responseCode": 200, "count": 439, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Probably visit somebody require catch focus agreement security.", "messageTemplate": "True hit notice see couple floor forward.", "field": "Why indicate that word.", "parameter": {}, "timestamp": 627878962}], "currentPage": 361, "size": 664}
        """
        from requests import delete
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/role/{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 = 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