Source code for api.cases.v2.service

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


[docs]@register_command(extending=('cases','v2','service')) def list_services(id: list = None, shortName: list = None, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List services (INTERNAL) :param list id: List of IDs to match :param list shortName: List of shortnames to match :param int offset: Skip a number of results :param int limit: Maximum number of returned results :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 286, "limit": 577, "responseCode": 200, "count": 304, "data": [{"id": 992, "shortName": "One final wind administration there.", "name": "Mark Velez", "description": "Loss put tend interview quite.", "flags": ["NOTIFICATION_ON_CREATE"], "logoURL": "Culture raise enjoy with.", "notificationEmail": "Door certain class see involve investment argue direction.", "createdTimestamp": 325752247, "createdByUser": {"id": 400, "customerID": 204, "userName": "matthew89", "name": "Dustin Cummings"}, "lastUpdatedTimestamp": 1489101336, "lastUpdatedByUser": {"id": 759, "customerID": 174, "userName": "gmiller", "name": "Matthew Hunter"}, "caseTypes": ["securityIncident"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Scene TV key hundred bag role so.", "messageTemplate": "Piece foreign true.", "field": "Try report woman direction.", "parameter": {}, "timestamp": 43812408}], "currentPage": 938, "size": 420} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/service".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 id: body.update({"id": id}) if shortName: body.update({"shortName": shortName}) 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=('cases','v2','service')) def create_service(domain: str = None, shortName: str = None, name: str = None, description: str = None, iconURL: str = None, notificationEmail: str = None, caseTypes: list = None, readFunction: str = None, writeFunction: str = None, techFunction: str = None, adminFunction: str = None, defineFunction: str = None, fieldPolicy: str = None, notifyOnCreate: bool = 'False', notifyOnUpdate: bool = 'False', notifyOnClose: bool = 'False', notifyFullFormat: bool = 'False', handledBySoc: bool = 'False', monitoredBySocOutsideOfficeHours: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Define a new service (INTERNAL) :param str domain: Name or ID of domain to bind service to. :param str shortName: Shortname of service. This must be unique within a domain. => [a-zA-Z0-9_\-\.]* :param str name: Descriptive name of service. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str description: Longer description of service. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str iconURL: An image data-URL on the form data:image/png;base64,BASE64IMAGEDATA => Sanitize by regex data:image/.+ :param str notificationEmail: The service notification email address. :param list caseTypes: The case types to enable for this service. :param str readFunction: The name or ID of the function to set as READ function for this service. :param str writeFunction: The name or ID of the function to set as WRITE function for this service. :param str techFunction: The name or ID of the function to set as TECH function for this service. :param str adminFunction: The name or ID of the function to set as ADMIN function for this service. :param str defineFunction: The name or ID of the function to set as DEFINE function for this service. :param str fieldPolicy: The ID of a field policy to set for this service. Default is no policy. :param bool notifyOnCreate: If true, notify the service notification email address on created cases. Default is false. :param bool notifyOnUpdate: If true, notify the service notification email address on updated cases. Default is false. :param bool notifyOnClose: If true, notify the service notification email address on closed cases. Default is false. :param bool notifyFullFormat: If true, use the full format when notifying to the service notification email. Default is false. :param bool handledBySoc: If true, this service is handled by SOC 24/7. Default is false. :param bool monitoredBySocOutsideOfficeHours: If true, this service is monitored by SOC outside office hours. Default is false. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 613, "limit": 13, "responseCode": 200, "count": 710, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Power mission against in always produce.", "messageTemplate": "Short pass grow machine.", "field": "Consumer deal day.", "parameter": {}, "timestamp": 1206192798}], "currentPage": 665, "size": 838} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/service".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 domain: body.update({"domain": domain}) if shortName: body.update({"shortName": shortName}) if name: body.update({"name": name}) if description: body.update({"description": description}) if iconURL: body.update({"iconURL": iconURL}) if notificationEmail: body.update({"notificationEmail": notificationEmail}) if notifyOnCreate: body.update({"notifyOnCreate": notifyOnCreate}) if notifyOnUpdate: body.update({"notifyOnUpdate": notifyOnUpdate}) if notifyOnClose: body.update({"notifyOnClose": notifyOnClose}) if notifyFullFormat: body.update({"notifyFullFormat": notifyFullFormat}) if handledBySoc: body.update({"handledBySoc": handledBySoc}) if monitoredBySocOutsideOfficeHours: body.update({"monitoredBySocOutsideOfficeHours": monitoredBySocOutsideOfficeHours}) if caseTypes: body.update({"caseTypes": caseTypes}) if readFunction: body.update({"readFunction": readFunction}) if writeFunction: body.update({"writeFunction": writeFunction}) if techFunction: body.update({"techFunction": techFunction}) if adminFunction: body.update({"adminFunction": adminFunction}) if defineFunction: body.update({"defineFunction": defineFunction}) if fieldPolicy: body.update({"fieldPolicy": fieldPolicy}) 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=('cases','v2','service')) def search_services(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, subCriteria: list = None, id: list = None, shortName: list = None, sortBy: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Search services (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: Limit search to services with the specified numeric ID`s. :param list shortName: Limit search to services with the specified shortnames :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). :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 769, "limit": 714, "responseCode": 200, "count": 88, "data": [{"id": 915, "shortName": "Father bring simply possible news easy evidence campaign.", "name": "Casey Johnson", "description": "Against however enough ten four.", "flags": ["DELETED"], "logoURL": "Maybe those each wish commercial.", "notificationEmail": "House fund bag sort country conference.", "createdTimestamp": 263436246, "createdByUser": {"id": 117, "customerID": 265, "userName": "jason83", "name": "Jonathan Byrd"}, "lastUpdatedTimestamp": 442791677, "lastUpdatedByUser": {"id": 829, "customerID": 683, "userName": "gheath", "name": "Kevin Curtis"}, "caseTypes": ["operationalIncident"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Party today be get interview.", "messageTemplate": "Bed case choice investment lawyer nature image.", "field": "Song source condition answer minute walk strategy space.", "parameter": {}, "timestamp": 1424335848}], "currentPage": 59, "size": 308} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/service/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 shortName: body.update({"shortName": shortName}) 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
[docs]@register_command(extending=('cases','v2','service')) def get_service(id: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch service (INTERNAL) :param str id: ID or shortname of service :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 366, "limit": 874, "responseCode": 200, "count": 539, "metaData": {"additionalProperties": {}}, "messages": [{"message": "News statement special successful effect environment.", "messageTemplate": "Might thought finish station join picture item.", "field": "Especially strategy just particular tough.", "parameter": {}, "timestamp": 118910151}], "currentPage": 883, "size": 159} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/service/{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=('cases','v2','service')) def update_service(id: str, shortName: str = None, name: str = None, description: str = None, iconURL: str = None, notificationEmail: str = None, caseTypesToAdd: list = None, caseTypesToRemove: list = None, caseTypesToSet: list = None, readFunction: str = None, writeFunction: str = None, techFunction: str = None, adminFunction: str = None, defineFunction: str = None, fieldPolicy: str = None, notifyOnCreate: bool = 'False', notifyOnUpdate: bool = 'False', notifyOnClose: bool = 'False', notifyFullFormat: bool = 'False', handledBySoc: bool = 'False', monitoredBySocOutsideOfficeHours: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Update an existing service (INTERNAL) :param str id: Service id or shortname :param str shortName: If set, change the shortname of this service. This must be unique within a domain. WARNING: This may affect scripts using shortname as service identifier. => [a-zA-Z0-9_\-\.]* :param str name: If set, change the descriptive name of the service. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str description: If set, change the longer description of the service. => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]* :param str iconURL: If set, replace the icon for the service. An image data-URL on the form data:image/png;base64,BASE64IMAGEDATA => Sanitize by regex data:image/.+ :param str notificationEmail: If set, change the service notification email address. :param list caseTypesToAdd: If set, enable the requested case type for this service. :param list caseTypesToRemove: If set, disable the requested case type for this service. This will be rejected if any non-deleted cases exist which are bound to this service and casetype. :param list caseTypesToSet: If set, override existing case types for this service. If this causes the service to remove a case type which has non-deleted cases bound to it, this will be rejected. :param str readFunction: If set, change the READ function for this service, identified by function ID or shortname. :param str writeFunction: If set, change the WRITE function for this service, identified by function ID or shortname. :param str techFunction: If set, change the TECH function for this service, identified by function ID or shortname. :param str adminFunction: If set, change the ADMIN function for this service, identified by function ID or shortname. :param str defineFunction: If set, change the DEFINE function for this service, identified by function ID or shortname. :param str fieldPolicy: If set, change the field policy for this service. Changing the field policy will affect new cases and future updates to existing cases, but will not change fields set on existing cases. :param bool notifyOnCreate: If set, change settings for notifying the service notification email address on created cases. :param bool notifyOnUpdate: If set, change settings for notifying the service notification email address on updated cases. :param bool notifyOnClose: If set, change settings for notifying the service notification email address on closed cases. :param bool notifyFullFormat: If set, change the format settings for notifying to the service notification email. :param bool handledBySoc: If set, set whether this service is handled by SOC 24/7. :param bool monitoredBySocOutsideOfficeHours: If set, set whether this service is monitored by SOC outside office hours. :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 288, "limit": 149, "responseCode": 200, "count": 33, "metaData": {"additionalProperties": {}}, "messages": [{"message": "However learn key matter.", "messageTemplate": "Likely choose scene education police possible.", "field": "Pass five thousand character.", "parameter": {}, "timestamp": 362750345}], "currentPage": 542, "size": 692} """ from requests import put from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v2/service/{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 shortName: body.update({"shortName": shortName}) if name: body.update({"name": name}) if description: body.update({"description": description}) if iconURL: body.update({"iconURL": iconURL}) if notificationEmail: body.update({"notificationEmail": notificationEmail}) if caseTypesToAdd: body.update({"caseTypesToAdd": caseTypesToAdd}) if caseTypesToRemove: body.update({"caseTypesToRemove": caseTypesToRemove}) if caseTypesToSet: body.update({"caseTypesToSet": caseTypesToSet}) if readFunction: body.update({"readFunction": readFunction}) if writeFunction: body.update({"writeFunction": writeFunction}) if techFunction: body.update({"techFunction": techFunction}) if adminFunction: body.update({"adminFunction": adminFunction}) if defineFunction: body.update({"defineFunction": defineFunction}) if fieldPolicy: body.update({"fieldPolicy": fieldPolicy}) if notifyOnCreate: body.update({"notifyOnCreate": notifyOnCreate}) if notifyOnUpdate: body.update({"notifyOnUpdate": notifyOnUpdate}) if notifyOnClose: body.update({"notifyOnClose": notifyOnClose}) if notifyFullFormat: body.update({"notifyFullFormat": notifyFullFormat}) if handledBySoc: body.update({"handledBySoc": handledBySoc}) if monitoredBySocOutsideOfficeHours: body.update({"monitoredBySocOutsideOfficeHours": monitoredBySocOutsideOfficeHours}) 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