public void WriteScriptExecutionOutput(IScriptExecutionOutputObjects scriptExecutionOutput) { _scriptExecutionOutputDataLock.EnterWriteLock(); try { _scriptExecutionOutput = scriptExecutionOutput; } finally { _scriptExecutionOutputDataLock.ExitWriteLock(); } }
public IScriptExecutionOutputObjects ReadScriptExecutionOutput() { IScriptExecutionOutputObjects result = null; if (FileExists(ScriptExecutionFileNames.ScriptExecution)) { var jsonContent = GetFileContent(ScriptExecutionFileNames.ScriptExecutionOutput); try { result = JsonConvert.DeserializeObject <ScriptExecutionOutput>(jsonContent); } catch (Exception exc) { _logger.Log(LogLevel.Error, exc.ToString()); } } return(result); }
// Out of scope for MVP release // Since the number of output object could be large the retrieval operation supports pagination. // There are two query parameters limit and start which can be used to move through the output objects list. // Start 0 means the last retrieved output object. // <param name="limit">Maximum number of records to be retrieved</param> // <param name="start">Position in the history of output records where the retrieval is requested from</param> //public ActionResult<string[]> Get([FromRoute] string id, [FromQuery] int limit = 20, [FromQuery] int start = 0) { public ActionResult <string[]> Get([FromRoute] string id) { ActionResult <string[]> result = null; IScriptExecutionOutputObjects scriptOutput = null; // Get Script Execution from ScriptExecutionMediator try { var authzToken = SessionToken.FromHeaders(Request.Headers); scriptOutput = ScriptExecutionMediatorSingleton. Instance. ScriptExecutionMediator. GetScriptExecutionOutput(authzToken.UserName, id); if (scriptOutput != null) { result = Ok(scriptOutput.OutputObjects); } else { result = NotFound( new ErrorDetails( ApiErrorCodes.GetErrorCode( nameof(APIGatewayResources.ScriptsController_ScriptNotFound)), string.Format(APIGatewayResources.ScriptsController_ScriptNotFound, id))); } } catch (RunspaceEndpointException runspaceEndointException) { result = StatusCode( runspaceEndointException.HttpErrorCode, new ErrorDetails( ApiErrorCodes.CalculateScriptsErrorCode(runspaceEndointException.ErrorCode), runspaceEndointException.Message, runspaceEndointException.ToString())); } catch (Exception exc) { result = StatusCode( 500, new ErrorDetails( ApiErrorCodes.GetErrorCode( nameof(APIGatewayResources.ScriptOutputController_ScriptStorageService_FailedToRetrieveScriptOutput)), APIGatewayResources.ScriptOutputController_ScriptStorageService_FailedToRetrieveScriptOutput, exc.ToString())); } return(result); }