Skip to content

Commit

Permalink
Merge pull request #40 from integr8ly/fix-extra-json
Browse files Browse the repository at this point in the history
fix datasource json and secure json fields
  • Loading branch information
pb82 authored Aug 28, 2019
2 parents 3106d08 + 906af99 commit 383f7c0
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 35 deletions.
1 change: 1 addition & 0 deletions deploy/examples/datasources/Prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ spec:
version: 1
editable: true
jsonData:
tlsSkipVerify: true
timeInterval: "5s"
74 changes: 57 additions & 17 deletions pkg/apis/integreatly/v1alpha1/grafanadatasource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,63 @@ type GrafanaDataSourceList struct {
}

type GrafanaDataSourceFields struct {
Name string `json:"name"`
Type string `json:"type"`
Access string `json:"access"`
OrgId int `json:"orgId,omitempty"`
Url string `json:"url"`
Password string `json:"password,omitempty"`
User string `json:"user,omitempty"`
Database string `json:"database,omitempty"`
BasicAuth bool `json:"basicAuth,omitempty"`
BasicAuthUser string `json:"basicAuthUser,omitempty"`
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`
WithCredentials bool `json:"withCredentials,omitempty"`
IsDefault bool `json:"isDefault,omitempty"`
JsonData map[string]string `json:"jsonData,omitempty"`
SecureJsonData map[string]string `json:"secureJsonData,omitempty"`
Version int `json:"version,omitempty"`
Editable bool `json:"editable,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Access string `json:"access"`
OrgId int `json:"orgId,omitempty"`
Url string `json:"url"`
Password string `json:"password,omitempty"`
User string `json:"user,omitempty"`
Database string `json:"database,omitempty"`
BasicAuth bool `json:"basicAuth,omitempty"`
BasicAuthUser string `json:"basicAuthUser,omitempty"`
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`
WithCredentials bool `json:"withCredentials,omitempty"`
IsDefault bool `json:"isDefault,omitempty"`
JsonData GrafanaDataSourceJsonData `json:"jsonData,omitempty"`
SecureJsonData GrafanaDataSourceSecureJsonData `json:"secureJsonData,omitempty"`
Version int `json:"version,omitempty"`
Editable bool `json:"editable,omitempty"`
}

// The most common json options
// See https://grafana.com/docs/administration/provisioning/#datasources
type GrafanaDataSourceJsonData struct {
TlsAuth bool `json:"tlsAuth,omitempty"`
TlsAuthWithCACert bool `json:"tlsAuthWithCACert,omitempty"`
TlsSkipVerify bool `json:"tlsSkipVerify,omitempty"`
GraphiteVersion string `json:"graphiteVersion,omitempty"`
TimeInterval string `json:"timeInterval,omitempty"`
EsVersion int `json:"esVersion,omitempty"`
TimeField string `json:"timeField,omitempty"`
Interval string `json:"interval,omitempty"`
LogMessageField string `json:"logMessageField,omitempty"`
LogLevelField string `json:"logLevelField,omitempty"`
AuthType string `json:"authType,omitempty"`
AssumeRoleArn string `json:"assumeRoleArn,omitempty"`
DefaultRegion string `json:"defaultRegion,omitempty"`
CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"`
TsdbVersion string `json:"tsdbVersion,omitempty"`
TsdbResolution string `json:"tsdbResolution,omitempty"`
Sslmode string `json:"sslmode,omitempty"`
Encrypt string `json:"encrypt,omitempty"`
PostgresVersion int `json:"postgresVersion,omitempty"`
Timescaledb bool `json:"timescaledb,omitempty"`
MaxOpenConns int `json:"maxOpenConns,omitempty"`
MaxIdleConns int `json:"maxIdleConns,omitempty"`
ConnMaxLifetime int `json:"connMaxLifetime,omitempty"`
}

// The most common secure json options
// See https://grafana.com/docs/administration/provisioning/#datasources
type GrafanaDataSourceSecureJsonData struct {
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"`
AccessKey string `json:"accessKey,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
}

func init() {
Expand Down
54 changes: 36 additions & 18 deletions pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 383f7c0

Please sign in to comment.