-
Notifications
You must be signed in to change notification settings - Fork 173
/
grafanadatasource_types.go
204 lines (184 loc) · 10.1 KB
/
grafanadatasource_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// GrafanaDataSourceSpec defines the desired state of GrafanaDataSource
type GrafanaDataSourceSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
Datasources []GrafanaDataSourceFields `json:"datasources"`
Name string `json:"name"`
}
// GrafanaDataSourceStatus defines the observed state of GrafanaDatasource
type GrafanaDataSourceStatus struct {
Phase StatusPhase `json:"phase"`
Message string `json:"message"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// GrafanaDataSource is the Schema for the grafanadatasources API
type GrafanaDataSource struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec GrafanaDataSourceSpec `json:"spec,omitempty"`
Status GrafanaDataSourceStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// GrafanaDataSourceList contains a list of GrafanaDataSource
// +kubebuilder:object:root=true
type GrafanaDataSourceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []GrafanaDataSource `json:"items"`
}
// GrafanaDataSourceFields ...
type GrafanaDataSourceFields struct {
Name string `json:"name"`
Type string `json:"type"`
UID string `json:"uid,omitempty"`
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"`
}
// GrafanaDataSourceJSONData The most common json options
// See https://grafana.com/docs/administration/provisioning/#datasources
type GrafanaDataSourceJSONData struct {
OauthPassThru bool `json:"oauthPassThru,omitempty"`
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"`
// Useful fields for clickhouse datasource
// See https://github.com/Vertamedia/clickhouse-grafana/tree/master/dist/README.md#configure-the-datasource-with-provisioning
// See https://github.com/Vertamedia/clickhouse-grafana/tree/master/src/datasource.ts#L44
AddCorsHeader bool `json:"addCorsHeader,omitempty"`
DefaultDatabase string `json:"defaultDatabase,omitempty"`
UsePOST bool `json:"usePOST,omitempty"`
UseYandexCloudAuthorization bool `json:"useYandexCloudAuthorization,omitempty"`
XHeaderUser string `json:"xHeaderUser,omitempty"`
XHeaderKey string `json:"xHeaderKey,omitempty"`
// Custom HTTP headers for datasources
// See https://grafana.com/docs/grafana/latest/administration/provisioning/#datasources
HTTPHeaderName1 string `json:"httpHeaderName1,omitempty"`
HTTPHeaderName2 string `json:"httpHeaderName2,omitempty"`
HTTPHeaderName3 string `json:"httpHeaderName3,omitempty"`
HTTPHeaderName4 string `json:"httpHeaderName4,omitempty"`
HTTPHeaderName5 string `json:"httpHeaderName5,omitempty"`
HTTPHeaderName6 string `json:"httpHeaderName6,omitempty"`
HTTPHeaderName7 string `json:"httpHeaderName7,omitempty"`
HTTPHeaderName8 string `json:"httpHeaderName8,omitempty"`
HTTPHeaderName9 string `json:"httpHeaderName9,omitempty"`
// Fields for Stackdriver data sources
TokenURI string `json:"tokenUri,omitempty"`
ClientEmail string `json:"clientEmail,omitempty"`
AuthenticationType string `json:"authenticationType,omitempty"`
DefaultProject string `json:"defaultProject,omitempty"`
// Fields for Azure data sources
AppInsightsAppID string `json:"appInsightsAppId,omitempty"`
AzureLogAnalyticsSameAs string `json:"azureLogAnalyticsSameAs,omitempty"`
ClientID string `json:"clientId,omitempty"`
CloudName string `json:"cloudName,omitempty"`
LogAnalyticsDefaultWorkspace string `json:"logAnalyticsDefaultWorkspace,omitempty"`
LogAnalyticsClientID string `json:"logAnalyticsClientId,omitempty"`
LogAnalyticsSubscriptionID string `json:"logAnalyticsSubscriptionId,omitempty"`
LogAnalyticsTenantID string `json:"logAnalyticsTenantId,omitempty"`
SubscriptionID string `json:"subscriptionId,omitempty"`
TenantID string `json:"tenantId,omitempty"`
// Fields for InfluxDB data sources
HTTPMode string `json:"httpMode,omitempty"`
Version string `json:"version,omitempty"`
Organization string `json:"organization,omitempty"`
DefaultBucket string `json:"defaultBucket,omitempty"`
// Fields for Loki data sources
MaxLines int `json:"maxLines,omitempty"`
DerivedFields []GrafanaDataSourceJSONDerivedFields `json:"derivedFields,omitempty"`
// Fields for Prometheus data sources
CustomQueryParameters string `json:"customQueryParameters,omitempty"`
HTTPMethod string `json:"httpMethod,omitempty"`
}
// GrafanaDataSourceJSONDerivedFields ...
type GrafanaDataSourceJSONDerivedFields struct {
DatasourceUID string `json:"datasourceUid,omitempty"`
MatcherRegex string `json:"matcherRegex,omitempty"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
}
// GrafanaDataSourceSecureJSONData 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"`
// Custom HTTP headers for datasources
// See https://grafana.com/docs/grafana/latest/administration/provisioning/#datasources
HTTPHeaderValue1 string `json:"httpHeaderValue1,omitempty"`
HTTPHeaderValue2 string `json:"httpHeaderValue2,omitempty"`
HTTPHeaderValue3 string `json:"httpHeaderValue3,omitempty"`
HTTPHeaderValue4 string `json:"httpHeaderValue4,omitempty"`
HTTPHeaderValue5 string `json:"httpHeaderValue5,omitempty"`
HTTPHeaderValue6 string `json:"httpHeaderValue6,omitempty"`
HTTPHeaderValue7 string `json:"httpHeaderValue7,omitempty"`
HTTPHeaderValue8 string `json:"httpHeaderValue8,omitempty"`
HTTPHeaderValue9 string `json:"httpHeaderValue9,omitempty"`
// Fields for Stackdriver data sources
PrivateKey string `json:"privateKey,omitempty"`
// Fields for Azure data sources
ClientSecret string `json:"clientSecret,omitempty"`
AppInsightsAPIKey string `json:"appInsightsApiKey,omitempty"`
LogAnalyticsClientSecret string `json:"logAnalyticsClientSecret,omitempty"`
// Fields for InfluxDB data sources
Token string `json:"token,omitempty"`
}
func init() {
SchemeBuilder.Register(&GrafanaDataSource{}, &GrafanaDataSourceList{})
}