/// <summary> /// Constructor /// </summary> /// <param name="jobName">Name to associate with this work</param> /// <param name="onlineUrls"></param> /// <param name="userName"></param> /// <param name="password"></param> /// <param name="taskOptions"></param> /// <param name="manualActions"></param> public TaskMaster( string jobName, TableauServerUrls onlineUrls, string userName, string password, TaskMasterOptions taskOptions, CustomerManualActionManager manualActions = null) { this.JobName = jobName; _manualActions = manualActions; if (_manualActions == null) { _manualActions = new CustomerManualActionManager(); } //Get any export path _exportToLocalPath = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_PathDownloadTo); _onlineUrls = onlineUrls; _userName = userName; _password = password; //Store the status log at the class level where it is accessable _statusLog = new TaskStatusLogs(); //Store the options _taskOptions = taskOptions; if (_taskOptions.IsOptionSet(TaskMasterOptions.Option_LogVerbose)) { _statusLog.SetStatusLoggingLevel(int.MinValue); } }
/// <summary> /// Constructor /// </summary> /// <param name="jobName">Name to associate with this work</param> /// <param name="onlineUrls"></param> /// <param name="userName"></param> /// <param name="password"></param> /// <param name="taskOptions"></param> /// <param name="manualActions"></param> public TaskMaster( string jobName, TableauServerUrls onlineUrls, string userName, string password, TaskMasterOptions taskOptions, CustomerManualActionManager manualActions = null) { this.JobName = jobName; _manualActions = manualActions; if(_manualActions == null) { _manualActions = new CustomerManualActionManager(); } //Get any export path _exportToLocalPath = taskOptions.GetOptionValue(TaskMasterOptions.OptionParameter_PathDownloadTo); _onlineUrls = onlineUrls; _userName = userName; _password = password; //Store the status log at the class level where it is accessable _statusLog = new TaskStatusLogs(); //Store the options _taskOptions = taskOptions; if(_taskOptions.IsOptionSet(TaskMasterOptions.Option_LogVerbose)) { _statusLog.SetStatusLoggingLevel(int.MinValue); } }
/// <summary> /// Called to perform Uploads of the data sources /// </summary> /// <param name="onlineLogin"></param> /// <param name="localBasePath"></param> /// <param name="credentialManager">Database credentials that will be associaed with uploaded content</param> private void Execute_UploadDatasources( TableauServerSignIn onlineLogin, string localBasePath, CredentialManager credentialManager) { StatusLog.AddStatusHeader("Upload datasources"); if (string.IsNullOrWhiteSpace(localBasePath)) { _statusLog.AddError("Abort uploads. Local path is not specified"); return; } string pathDataSources = Path.Combine(localBasePath, "datasources"); if (!Directory.Exists(pathDataSources)) { _statusLog.AddStatus("Skipping datasources upload. Local datasources path does not exist: \"" + pathDataSources + "\""); return; } //Upload all the files var uploadProjectBehavior = new UploadBehaviorProjects( _taskOptions.IsOptionSet(TaskMasterOptions.Option_UploadCreateNeededProjects), true); var dsUploader = new UploadDatasources( _onlineUrls, onlineLogin, credentialManager, pathDataSources, uploadProjectBehavior, _manualActions, this.UploadChunksSizeBytes, this.UploadChunksDelaySeconds); try { dsUploader.ExecuteRequest(); } catch (Exception exUploader) { StatusLog.AddError("Aborted upload datasources. Unexpected error + " + exUploader.Message); } }