api.reports.v1.job — Argus-Toolbelt 1.0 documentation

# Source code for api.reports.v1.job

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

    @register_command(extending=('reports','v1','job'))
    def get(limit: int = None, offset: int = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Lists report jobs (DEV)
    Returns a list of matching report jobs.

        :param int limit:
        :param int offset:
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 43, "limit": 810, "responseCode": 200, "count": 659, "data": [{"id": 344, "flags": 667, "periodStart": 721, "periodEnd": 940, "createdByUser": {"id": 938, "customerID": 521, "userName": "normanorris", "name": "Kathryn Stewart"}, "created": 434, "finished": 917, "status": "DONE", "output": [{"timestamp": 1000326056, "text": "Itself tend anything imagine record five challenge."}], "customerID": 625, "globalCustomer": false}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Example arm teacher soon arm.", "messageTemplate": "Environment least scene hour kid.", "field": "Research entire education school.", "parameter": {}, "timestamp": 142209469}], "currentPage": 930, "size": 299}
        """
        from requests import get
        from argus_api.exceptions import http

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

        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=('reports','v1','job'))
    def generate(scheduleID: int = None, planID: int = None, reportCustomerID: int = None, flags: int = None, periodStart: int = None, periodEnd: int = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """null (DEV)

        :param int scheduleID:
        :param int planID:
        :param int reportCustomerID:
        :param int flags:
        :param int periodStart:
        :param int periodEnd:
        :returns: {}
        """
        from requests import post
        from argus_api.exceptions import http

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

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

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

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

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

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

        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=('reports','v1','job'))
    def search(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, subCriteria: list = None, id: list = None, createdByUserID: list = None, period: list = None, status: list = None, planID: list = None, scheduleID: list = None, startTimestamp: int = None, endTimestamp: int = None, sortBy: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', includeFinishedTimestamp: bool = 'False', includeCreatedTimestamp: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Detailed search for report jobs (DEV)
    Returns a list of matching report jobs.

        :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 list createdByUserID:
        :param list period:
        :param list status:
        :param list planID:
        :param list scheduleID:
        :param int startTimestamp:
        :param int endTimestamp:
        :param list sortBy: List of properties to sort by (prefix with "-" to sort descending).
        :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).
        :param bool includeFinishedTimestamp:
        :param bool includeCreatedTimestamp:
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 969, "limit": 36, "responseCode": 200, "count": 203, "data": [{"id": 655, "flags": 15, "periodStart": 588, "periodEnd": 484, "createdByUser": {"id": 806, "customerID": 496, "userName": "juliebrock", "name": "Gail Pineda"}, "created": 819, "finished": 427, "status": "FAILED", "output": [{"timestamp": 367778826, "text": "Event owner voice hour."}], "customerID": 677, "globalCustomer": true}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Church certainly threat outside bad.", "messageTemplate": "Factor pay position shoulder traditional which worry.", "field": "Commercial service president paper herself.", "parameter": {}, "timestamp": 878921732}], "currentPage": 122, "size": 410}
        """
        from requests import post
        from argus_api.exceptions import http

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

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

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

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

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

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

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

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

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

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

        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