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

Commit a8cf075

Browse files
authored
Merge branch 'master' into dashboard-tests
2 parents ea90ab9 + 23ff932 commit a8cf075

File tree

2 files changed

+65
-10
lines changed

2 files changed

+65
-10
lines changed

client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ func New(auth, baseURL string) (*Client, error) {
2929
}
3030
key := ""
3131
if strings.Contains(auth, ":") {
32-
split := strings.Split(auth, ":")
32+
split := strings.SplitN(auth, ":", 2)
3333
u.User = url.UserPassword(split[0], split[1])
34-
} else {
34+
} else if auth != "" {
3535
key = fmt.Sprintf("Bearer %s", auth)
3636
}
3737
return &Client{

datasource.go

Lines changed: 63 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,20 +34,73 @@ 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"`
81+
82+
// Used by Stackdriver
83+
AuthenticationType string `json:"authenticationType,omitempty"`
84+
ClientEmail string `json:"clientEmail,omitempty"`
85+
DefaultProject string `json:"defaultProject,omitempty"`
86+
TokenUri string `json:"tokenUri,omitempty"`
4387
}
4488

4589
// SecureJSONData is a representation of the datasource `secureJsonData` property
4690
type SecureJSONData struct {
91+
// Used by all datasources
92+
TlsCACert string `json:"tlsCACert,omitempty"`
93+
TlsClientCert string `json:"tlsClientCert,omitempty"`
94+
TlsClientKey string `json:"tlsClientKey,omitempty"`
95+
Password string `json:"password,omitempty"`
96+
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`
97+
98+
// Used by Cloudwatch
4799
AccessKey string `json:"accessKey,omitempty"`
48100
SecretKey string `json:"secretKey,omitempty"`
101+
102+
// Used by Stackdriver
103+
PrivateKey string `json:"privateKey,omitempty"`
49104
}
50105

51106
func (c *Client) NewDataSource(s *DataSource) (int64, error) {

0 commit comments

Comments
 (0)