public void SaveElasticsearchServiceSource(IElasticsearchSourceDefinition elasticsearchServiceSource, Guid serverWorkspaceId) { var con = Connection; var comsController = CommunicationControllerFactory.CreateController(nameof(SaveElasticsearchSource)); var serialiser = new Dev2JsonSerializer(); comsController.AddPayloadArgument(SaveElasticsearchSource.ElasticsearchSource, serialiser.SerializeToBuilder(elasticsearchServiceSource)); var output = comsController.ExecuteCommand <IExecuteMessage>(con, GlobalConstants.ServerWorkspaceID); if (output.HasError) { throw new WarewolfSaveException(output.Message.ToString(), null); } }
public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace) { var msg = new ExecuteMessage(); var serializer = new Dev2JsonSerializer(); try { Dev2Logger.Info("Save Elasticsearch Resource Service", GlobalConstants.WarewolfInfo); values.TryGetValue(Warewolf.Service.SaveElasticsearchSource.ElasticsearchSource, out StringBuilder resourceDefinition); IElasticsearchSourceDefinition elasticsearchSourceDef = serializer.Deserialize <ElasticsearchSourceDefinition>(resourceDefinition); if (elasticsearchSourceDef.Path == null) { elasticsearchSourceDef.Path = string.Empty; } if (elasticsearchSourceDef.Path.EndsWith("\\")) { elasticsearchSourceDef.Path = elasticsearchSourceDef.Path.Substring(0, elasticsearchSourceDef.Path.LastIndexOf("\\", StringComparison.Ordinal)); } var elasticsearchSource = new ElasticsearchSource { ResourceID = elasticsearchSourceDef.Id, HostName = elasticsearchSourceDef.HostName, Port = elasticsearchSourceDef.Port, SearchIndex = elasticsearchSourceDef.SearchIndex, AuthenticationType = elasticsearchSourceDef.AuthenticationType, Password = elasticsearchSourceDef.Password, Username = elasticsearchSourceDef.Username, ResourceName = elasticsearchSourceDef.Name }; ResourceCat.SaveResource(GlobalConstants.ServerWorkspaceID, elasticsearchSource, elasticsearchSourceDef.Path); msg.HasError = false; } catch (Exception err) { msg.HasError = true; msg.Message = new StringBuilder(err.Message); Dev2Logger.Error(err, GlobalConstants.WarewolfError); } return(serializer.SerializeToBuilder(msg)); }
public string TestConnection(IElasticsearchSourceDefinition elasticsearchServiceSource) { var con = Connection; var comsController = CommunicationControllerFactory.CreateController(nameof(TestElasticsearchSource)); var serialiser = new Dev2JsonSerializer(); comsController.AddPayloadArgument(nameof(ElasticsearchSource), serialiser.SerializeToBuilder(elasticsearchServiceSource)); var output = comsController.ExecuteCommand <IExecuteMessage>(con, GlobalConstants.ServerWorkspaceID); if (output == null) { throw new WarewolfTestException(ErrorResource.UnableToContactServer, null); } if (output.HasError) { throw new WarewolfTestException(output.Message.ToString(), null); } return(output.Message.ToString()); }
public bool Equals(IElasticsearchSourceDefinition other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } var equals = true; equals &= string.Equals(HostName, other.HostName); equals &= string.Equals(Password, other.Password); equals &= string.Equals(Username, other.Username); equals &= string.Equals(SearchIndex, other.SearchIndex); equals &= Id == other.Id; equals &= string.Equals(Name, other.Name); equals &= AuthenticationType == other.AuthenticationType; return(equals); }
public string TestConnection(IElasticsearchSourceDefinition source) => _updateRepository.TestConnection(source);
public void Save(IElasticsearchSourceDefinition source) => _updateRepository.Save(source);
public void EditSource(IElasticsearchSourceDefinition source) => _shellViewModel.EditResource(source);
public string TestConnection(IElasticsearchSourceDefinition elasticServiceSource) => UpdateManagerProxy.TestConnection(elasticServiceSource);
public void Save(IElasticsearchSourceDefinition elasticsearchServiceSource) => UpdateManagerProxy.SaveElasticsearchServiceSource(elasticsearchServiceSource, GlobalConstants.ServerWorkspaceID);