def get_service_error(cache_key, **_): """ Get the content off a given service error cache key. Variables: cache_key => Service result cache key as (SRL.ServiceName) Arguments: None Data Block: None Result example: {"response": { # Service Response "milestones": {}, # Timing object "supplementary": [], # Supplementary files "status": "FAIL", # Status "service_version": "", # Service Version "service_name": "NSRL", # Service Name "extracted": [], # Extracted files "score": 0, # Service Score "message": "Err Message"}, # Error Message "result": []} # Result objets """ data = STORAGE.get_error(cache_key) if data is None: return make_api_response("", "Cache key %s does not exists." % cache_key, 404) return make_api_response(data)
def get_error(error_key, **kwargs): """ Get the error details for a given error key Variables: error_key => Error key to get the details for Arguments: None Data Block: None Result example: { KEY: VALUE, # All fields of an error in key/value pair } """ user = kwargs['user'] data = STORAGE.get_error(error_key) if user and data and Classification.is_accessible(user['classification'], data['classification']): return make_api_response(data) else: return make_api_response("", "You are not allowed to see this error...", 403)