Source code for api.reports.v1.schedule

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




[docs]@register_command(extending=('reports','v1','schedule')) def add(setFlags: int = None, description: str = None, planID: int = None, schedule: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """null (DEV) :param int setFlags: :param str description: Report schedule description => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param int planID: :param str schedule: Report schedule :returns: {} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/schedule".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 setFlags: body.update({"setFlags": setFlags}) if description: body.update({"description": description}) if planID: body.update({"planID": planID}) if schedule: body.update({"schedule": schedule}) 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=('reports','v1','schedule')) def get(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch a report schedule (DEV) :param int id: ID of schedule to fetch :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :raises ScheduleNotFoundException: on 404 :returns: {"offset": 626, "limit": 767, "responseCode": 200, "count": 963, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Listen management mother accept statement.", "messageTemplate": "Special sister father necessary seek.", "field": "Dark until include tonight Congress debate rise.", "parameter": {}, "timestamp": 406436141}], "currentPage": 885, "size": 799} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/schedule/{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
[docs]@register_command(extending=('reports','v1','schedule')) def delete(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Delete a report schedule (DEV) :param int id: ID of plan to delete :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 851, "limit": 45, "responseCode": 200, "count": 587, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Dinner herself should green couple.", "messageTemplate": "View remember look trade far listen maybe.", "field": "May oil pressure draw laugh or.", "parameter": {}, "timestamp": 998758538}], "currentPage": 387, "size": 794} """ from requests import delete from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/schedule/{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
[docs]@register_command(extending=('reports','v1','schedule')) def generate_from_schedule(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """null (DEV) :param int id: :returns: {} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/schedule/{id}/generate".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 = 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