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

Commit 5cf70a2

Browse files
authored
Flesh Out Datasource struct (#35)
* add other datasource types * add deprecations
1 parent 5aaccba commit 5cf70a2

File tree

1 file changed

+54
-8
lines changed

1 file changed

+54
-8
lines changed

datasource.go

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ type DataSource struct {
1717

1818
Database string `json:"database,omitempty"`
1919
User string `json:"user,omitempty"`
20+
// Deprecated in favor of secureJsonData.password
2021
Password string `json:"password,omitempty"`
2122

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

25-
BasicAuth bool `json:"basicAuth"`
26-
BasicAuthUser string `json:"basicAuthUser,omitempty"`
26+
BasicAuth bool `json:"basicAuth"`
27+
BasicAuthUser string `json:"basicAuthUser,omitempty"`
28+
// Deprecated in favor of secureJsonData.basicAuthPassword
2729
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`
2830

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

3335
// JSONData is a representation of the datasource `jsonData` property
3436
type JSONData struct {
35-
AssumeRoleArn string `json:"assumeRoleArn,omitempty"`
37+
// Used by all datasources
38+
TlsAuth bool `json:"tlsAuth,omitempty"`
39+
TlsAuthWithCACert bool `json:"tlsAuthWithCACert,omitempty"`
40+
TlsSkipVerify bool `json:"tlsSkipVerify,omitempty"`
41+
42+
// Used by Graphite
43+
GraphiteVersion string `json:"graphiteVersion,omitempty"`
44+
45+
// Used by Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL and MSSQL
46+
TimeInterval string `json:"timeInterval,omitempty"`
47+
48+
// Used by Elasticsearch
49+
EsVersion int64 `json:"esVersion,omitempty"`
50+
TimeField string `json:"timeField,omitempty"`
51+
Interval string `json:"inteval,omitempty"`
52+
LogMessageField string `json:"logMessageField,omitempty"`
53+
LogLevelField string `json:"logLevelField,omitempty"`
54+
55+
// Used by Cloudwatch
3656
AuthType string `json:"authType,omitempty"`
37-
CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"`
57+
AssumeRoleArn string `json:"assumeRoleArn,omitempty"`
3858
DefaultRegion string `json:"defaultRegion,omitempty"`
39-
TlsSkipVerify bool `json:"tlsSkipVerify,omitempty"`
40-
HttpMethod string `json:"httpMethod,omitempty"`
41-
QueryTimeout string `json:"queryTimeout,omitempty"`
42-
TimeInterval string `json:"timeInterval,omitempty"`
59+
CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"`
60+
61+
// Used by OpenTSDB
62+
TsdbVersion string `json:"tsdbVersion,omitempty"`
63+
TsdbResolution string `json:"tsdbResolution,omitempty"`
64+
65+
// Used by MSSQL
66+
Encrypt string `json:"encrypt,omitempty"`
67+
68+
// Used by PostgreSQL
69+
Sslmode string `json:"sslmode,omitempty"`
70+
PostgresVersion int64 `json:"postgresVersion,omitempty"`
71+
Timescaledb bool `json:"timescaledb,omitempty"`
72+
73+
// Used by MySQL, PostgreSQL and MSSQL
74+
MaxOpenConns int64 `json:"maxOpenConns,omitempty"`
75+
MaxIdleConns int64 `json:"maxIdleConns,omitempty"`
76+
ConnMaxLifetime int64 `json:"connMaxLifetime,omitempty"`
77+
78+
// Used by Prometheus
79+
HttpMethod string `json:"httpMethod,omitempty"`
80+
QueryTimeout string `json:"queryTimeout,omitempty"`
4381
}
4482

4583
// SecureJSONData is a representation of the datasource `secureJsonData` property
4684
type SecureJSONData struct {
85+
// Used by all datasources
86+
TlsCACert string `json:"tlsCACert,omitempty"`
87+
TlsClientCert string `json:"tlsClientCert,omitempty"`
88+
TlsClientKey string `json:"tlsClientKey,omitempty"`
89+
Password string `json:"password,omitempty"`
90+
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`
91+
92+
// Used by Cloudwatch
4793
AccessKey string `json:"accessKey,omitempty"`
4894
SecretKey string `json:"secretKey,omitempty"`
4995
}

0 commit comments

Comments
 (0)