public void WriteScriptExecution(INamedScriptExecution scriptExecution) { _scriptExecutionDataLock.EnterWriteLock(); try { _scriptExecution = scriptExecution; } finally { _scriptExecutionDataLock.ExitWriteLock(); } }
public ScriptExecution(INamedScriptExecution scriptResult) { Id = scriptResult.Id; ExecutionState = ScriptStateConvert.From(scriptResult.State); Reason = scriptResult.Reason; Output_Ojects_Format = Enum.Parse <OutputObjectsFormat>(scriptResult.OutputObjectsFormat.ToString()); Name = scriptResult.Name; StarTime = scriptResult.StarTime; EndTime = scriptResult.EndTime; }
public override bool Equals(object obj) { INamedScriptExecution source = obj as INamedScriptExecution; if (source == null) { return(false); } return(source.Name == Name && source.State == State); }
public INamedScriptExecution ReadScriptExecution() { INamedScriptExecution result = null; if (FileExists(ScriptExecutionFileNames.ScriptExecution)) { var jsonContent = GetFileContent(ScriptExecutionFileNames.ScriptExecution); try { result = JsonConvert.DeserializeObject <NamedScriptExecution>(jsonContent); } catch (Exception exc) { _logger.Log(LogLevel.Error, exc.ToString()); } } return(result); }
public override bool Equals(object obj) { bool isInterface = true; INamedScriptExecution source = obj as INamedScriptExecution; if (source == null) { isInterface = false; } return(isInterface && source.Id == Id && source.Name == Name && source.State == State && source.OutputObjectsFormat == OutputObjectsFormat && source.StarTime == StarTime && source.EndTime == EndTime); }
// Out of scope for MVP release // It is allowed to retrieve a partial representation of the **script execution** resources giving desired fields on the **fields** query parameter. // When fields are requested in the query parameter other fields will remain null. // <param name="fields"></param> //public ActionResult<DataTypes.ScriptExecution> Get([FromRoute] string id, [FromQuery]string[] fields) public ActionResult <DataTypes.ScriptExecution> Get([FromRoute] string id) { ActionResult <DataTypes.ScriptExecution> result = null; INamedScriptExecution scriptResult = null; // Get Script Execution from ScriptExecutionMediator try { var authzToken = SessionToken.FromHeaders(Request.Headers); scriptResult = ScriptExecutionMediatorSingleton. Instance. ScriptExecutionMediator. GetScriptExecution(authzToken.UserName, id); if (scriptResult != null) { result = Ok(new DataTypes.ScriptExecution(scriptResult)); } 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.ScriptsController_ScriptStorageService_FailedToRetrieveScripts)), APIGatewayResources.ScriptsController_ScriptStorageService_FailedToRetrieveScripts, exc.ToString())); } return(result); }