-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
36 lines (30 loc) · 1.23 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package snowflakereceiver
import (
"fmt"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/receiver/scraperhelper"
)
type Config struct {
scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
confighttp.HTTPClientSettings `mapstructure:",squash"`
// Metrics metadata.MetricsSettings `mapstructure:"metrics"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Account string `mapstructure:"account"`
Schema string `mapstructure:"schema"`
Warehouse string `mapstructure:"warehouse"`
Database string `mapstructure:"database"`
Role string `mapstructure:"role"`
}
func (cfg *Config) Validate() error {
if (cfg.Username == "") {
return fmt.Errorf("You must provide a valid snowflake username")
}
if (cfg.Password == "") {
return fmt.Errorf("You must provide a password for the snowflake username")
}
if (cfg.Account == "") {
return fmt.Errorf("You must provide a valid account name")
}
return nil
}