-
Notifications
You must be signed in to change notification settings - Fork 90
/
report_datasource.go
112 lines (91 loc) · 3.98 KB
/
report_datasource.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
package v1
import (
v1 "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)
var ReportDataSourceGVK = SchemeGroupVersion.WithKind("ReportDataSource")
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ReportDataSourceList struct {
meta.TypeMeta `json:",inline"`
meta.ListMeta `json:"metadata,omitempty"`
Items []*ReportDataSource `json:"items"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ReportDataSource struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"`
Spec ReportDataSourceSpec `json:"spec"`
Status ReportDataSourceStatus `json:"status"`
}
type ReportDataSourceSpec struct {
// Prometheus represents a datasource which holds Prometheus metrics
PrometheusMetricsImporter *PrometheusMetricsImporterDataSource `json:"prometheusMetricsImporter,omitempty"`
// AWSBilling represents a datasource which points to a pre-existing S3
// bucket.
AWSBilling *AWSBillingDataSource `json:"awsBilling,omitempty"`
// PrestoTable represents a datasource which points to an existing
// PrestoTable CR.
PrestoTable *PrestoTableDataSource `json:"prestoTable,omitempty"`
// LinkExistingTable represents a datasource that points to an
// table in Presto. As a result, this will create an unmanaged PrestoTable
LinkExistingTable *LinkExistingTableDataSource `json:"linkExistingTable,omitempty"`
// ReportQueryView represents a datasource which creates a Presto
// view from a ReportQuery
ReportQueryView *ReportQueryViewDataSource `json:"reportQueryView,omitempty"`
}
type AWSBillingDataSource struct {
Source *S3Bucket `json:"source"`
DatabaseName string `json:"databaseName,omitempty"`
}
type S3Bucket struct {
Region string `json:"region"`
Bucket string `json:"bucket"`
Prefix string `json:"prefix"`
}
type PrometheusQueryConfig struct {
QueryInterval *meta.Duration `json:"queryInterval,omitempty"`
StepSize *meta.Duration `json:"stepSize,omitempty"`
ChunkSize *meta.Duration `json:"chunkSize,omitempty"`
}
type PrometheusConnectionConfig struct {
URL string `json:"url,omitempty"`
}
type PrometheusMetricsImporterDataSource struct {
Query string `json:"query"`
QueryConfig *PrometheusQueryConfig `json:"queryConfig,omitempty"`
Storage *StorageLocationRef `json:"storage,omitempty"`
PrometheusConfig *PrometheusConnectionConfig `json:"prometheusConfig,omitempty"`
}
type PrestoTableDataSource struct {
TableRef v1.LocalObjectReference `json:"tableRef"`
}
type LinkExistingTableDataSource struct {
TableName string `json:"tableName"`
}
type ReportQueryViewDataSource struct {
// QueryName specifies the ReportQuery to execute when the report
// runs.
QueryName string `json:"queryName"`
// Inputs are the inputs to the ReportQuery
Inputs ReportQueryInputValues `json:"inputs,omitempty"`
Storage *StorageLocationRef `json:"storage,omitempty"`
}
type ReportDataSourceStatus struct {
TableRef v1.LocalObjectReference `json:"tableRef"`
PrometheusMetricsImportStatus *PrometheusMetricsImportStatus `json:"prometheusMetricsImportStatus,omitempty"`
}
type PrometheusMetricsImportStatus struct {
// LastImportTime is the time the import last import was ran.
LastImportTime *meta.Time `json:"lastImportTime,omitempty"`
// ImportDataStartTime is the start of the time first time range queried.
ImportDataStartTime *meta.Time `json:"importDataStartTime,omitempty"`
// ImportDataEndTime is the end of the time last time range queried.
ImportDataEndTime *meta.Time `json:"importDataEndTime,omitempty"`
// EarliestImportedMetricTime is the timestamp for the earliest metric
// imported for this ReportDataSource.
EarliestImportedMetricTime *meta.Time `json:"earliestImportedMetricTime,omitempty"`
// NewestImportedMetricTime is the timestamp for the newest metric
// imported for this ReportDataSource.
NewestImportedMetricTime *meta.Time `json:"newestImportedMetricTime,omitempty"`
}