Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix datasource json and secure json fields #40

Merged
merged 2 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
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
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.