public async Task <SnowflakeTenant> GetReaderAsync(string clientName) { SnowflakeTenant t = new SnowflakeTenant(); //authenticator=https://<your_okta_account_name>.okta.com if (_connection.State == System.Data.ConnectionState.Open) { _connection.Close(); } await _connection.OpenAsync(); var x = await _connection.QueryAsync <Share>($"show managed accounts like '{clientName}_READER'", null, null, 10, System.Data.CommandType.Text); var share = x.Where(i => i.name.StartsWith(clientName)).First(); t.Locator = share.locator; t.OvcId = share.comment.Trim(); t.Name = clientName; _connection.Close(); Tenant = t; return(t); }
public async Task <string> CreateReaderAsync(Connection parmList, string commandText, string clientName) { SnowflakeTenant tenant = new SnowflakeTenant(); _connection.ConnectionString = BuildConnectionString(parmList); await _connection.OpenAsync(); using (DbCommand cmd = new SnowflakeDbCommand()) { cmd.CommandType = System.Data.CommandType.Text; cmd.CommandTimeout = 0; cmd.CommandText = commandText; cmd.Connection = _connection; try { _ = await cmd.ExecuteScalarAsync(); System.Threading.Thread.Sleep(2000); } catch (Exception ex) { throw ex; } } _connection.Close(); try { var t = await GetReaderAsync(clientName); } catch (Exception ex) { throw ex; } return(Tenant.Locator); }
public TemplateService(string yamlFile, string client, string password, string ovcId, string path = "", string locator = "") { Tenant = new SnowflakeTenant { Name = client, Description = "Corporate Solutions client: " + client, OvcId = ovcId, Locator = locator.Length > 0 ? locator : "!!locator!!", Password = password }; YamlFile = yamlFile; variables = new Dictionary <string, object> { { "client", Tenant.Name }, { "password", Tenant.Password }, { "environment", Environment.GetEnvironmentVariable("Environment") }, { "locator", Tenant.Locator }, { "ovcid", Tenant.OvcId } }; }
public async Task <Response> ExecuteAsync(TenantQueryCommand command, Response previousResult) { Response tenant = new Response(); try { var tb = new TableauTenant(); var sf = new SnowflakeTenant(); var tasks = new Task[] { Task.Run(async() => tb = await _tableauService.GetTableauSiteAsync(command.Name)), Task.Run(async() => sf = await _snowflakeService.GetReaderAsync(command.Name)) }; await Task.WhenAll(tasks); tenant.TenantDetails.Tableau = tb; tenant.TenantDetails.Snowflake = sf; //tenant.Tableau = await _tableauService.GetTableauSiteAsync(command.Name); //tenant.Snowflake = await _snowflakeService.GetReaderAsync(command.Name); } catch (Exception ex) { Console.WriteLine(ex.Message); ErrorManager em = new ErrorManager(); em = _tableauService.Error; tenant.ErrorMessages = new List <ErrorDetails> { em.Error }; } return(tenant); }