Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Flesh Out Datasource struct #35

Merged
merged 2 commits into from
Jan 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 54 additions & 8 deletions datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ type DataSource struct {

Database string `json:"database,omitempty"`
User string `json:"user,omitempty"`
// Deprecated in favor of secureJsonData.password
Password string `json:"password,omitempty"`

OrgId int64 `json:"orgId,omitempty"`
IsDefault bool `json:"isDefault"`

BasicAuth bool `json:"basicAuth"`
BasicAuthUser string `json:"basicAuthUser,omitempty"`
BasicAuth bool `json:"basicAuth"`
BasicAuthUser string `json:"basicAuthUser,omitempty"`
// Deprecated in favor of secureJsonData.basicAuthPassword
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`

JSONData JSONData `json:"jsonData,omitempty"`
Expand All @@ -32,18 +34,62 @@ type DataSource struct {

// JSONData is a representation of the datasource `jsonData` property
type JSONData struct {
AssumeRoleArn string `json:"assumeRoleArn,omitempty"`
// Used by all datasources
TlsAuth bool `json:"tlsAuth,omitempty"`
TlsAuthWithCACert bool `json:"tlsAuthWithCACert,omitempty"`
TlsSkipVerify bool `json:"tlsSkipVerify,omitempty"`

// Used by Graphite
GraphiteVersion string `json:"graphiteVersion,omitempty"`

// Used by Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL and MSSQL
TimeInterval string `json:"timeInterval,omitempty"`

// Used by Elasticsearch
EsVersion int64 `json:"esVersion,omitempty"`
TimeField string `json:"timeField,omitempty"`
Interval string `json:"inteval,omitempty"`
LogMessageField string `json:"logMessageField,omitempty"`
LogLevelField string `json:"logLevelField,omitempty"`

// Used by Cloudwatch
AuthType string `json:"authType,omitempty"`
CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"`
AssumeRoleArn string `json:"assumeRoleArn,omitempty"`
DefaultRegion string `json:"defaultRegion,omitempty"`
TlsSkipVerify bool `json:"tlsSkipVerify,omitempty"`
HttpMethod string `json:"httpMethod,omitempty"`
QueryTimeout string `json:"queryTimeout,omitempty"`
TimeInterval string `json:"timeInterval,omitempty"`
CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"`

// Used by OpenTSDB
TsdbVersion string `json:"tsdbVersion,omitempty"`
TsdbResolution string `json:"tsdbResolution,omitempty"`

// Used by MSSQL
Encrypt string `json:"encrypt,omitempty"`

// Used by PostgreSQL
Sslmode string `json:"sslmode,omitempty"`
PostgresVersion int64 `json:"postgresVersion,omitempty"`
Timescaledb bool `json:"timescaledb,omitempty"`

// Used by MySQL, PostgreSQL and MSSQL
MaxOpenConns int64 `json:"maxOpenConns,omitempty"`
MaxIdleConns int64 `json:"maxIdleConns,omitempty"`
ConnMaxLifetime int64 `json:"connMaxLifetime,omitempty"`

// Used by Prometheus
HttpMethod string `json:"httpMethod,omitempty"`
QueryTimeout string `json:"queryTimeout,omitempty"`
}

// SecureJSONData is a representation of the datasource `secureJsonData` property
type SecureJSONData struct {
// Used by all datasources
TlsCACert string `json:"tlsCACert,omitempty"`
TlsClientCert string `json:"tlsClientCert,omitempty"`
TlsClientKey string `json:"tlsClientKey,omitempty"`
Password string `json:"password,omitempty"`
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`

// Used by Cloudwatch
AccessKey string `json:"accessKey,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
}
Expand Down