in quickstart/sample_app.go [229:271]
func main() {
fmt.Println("Kusto sample app is starting...")
const configFileName = "./kusto_sample_config.json"
var config = loadConfigs(configFileName)
waitForUser = config.WaitForUser
if config.AuthenticationMode == authentication.UserPrompt {
waitForUserToProceed("You will be prompted *twice* for credentials during this script. Please return to the console after authenticating.")
}
var kustoKcs = authentication.GenerateConnectionString(config.KustoUri, config.AuthenticationMode)
kustoClient, err := azkustodata.New(kustoKcs)
if err != nil {
utils.ErrorHandler("Couldn't create Kusto client. Please validate your URIs in the configuration file.", err)
}
defer func(client *azkustodata.Client) {
err := client.Close()
if err != nil {
utils.ErrorHandler("Couldn't close client.", err)
}
}(kustoClient)
preIngestionQuerying(config, kustoClient)
ingestClient, err := azkustoingest.New(kustoKcs, azkustoingest.WithDefaultDatabase(config.DatabaseName), azkustoingest.WithDefaultTable(config.TableName))
if err != nil {
utils.ErrorHandler("Couldn't create Ingestion client. Please validate your URIs in the configuration file.", err)
}
defer func(client *azkustoingest.Ingestion) {
err := client.Close()
if err != nil {
utils.ErrorHandler("Couldn't close client.", err)
}
}(ingestClient)
if config.IngestData {
ingestionPhase(config, ingestClient)
}
if config.QueryData {
postIngestionQuerying(kustoClient, config.DatabaseName, config.TableName, config.IngestData)
}
fmt.Println("\nKusto sample app done")
}