@@ -12,13 +12,15 @@ type Slos struct {
12
12
Slos []Slo `json:"slos"`
13
13
}
14
14
15
+ // Defines values for QueryType.
15
16
const (
16
17
QueryTypeFreeform QueryType = "freeform"
17
18
QueryTypeHistogram QueryType = "histogram"
18
19
QueryTypeRatio QueryType = "ratio"
19
20
QueryTypeThreshold QueryType = "threshold"
20
21
)
21
22
23
+ // Defines values for ThresholdOperator.
22
24
const (
23
25
ThresholdOperatorEmpty ThresholdOperator = "<"
24
26
ThresholdOperatorEqualEqual ThresholdOperator = "=="
@@ -27,48 +29,63 @@ const (
27
29
ThresholdOperatorN3 ThresholdOperator = ">"
28
30
)
29
31
32
+ // Alerting defines model for Alerting.
30
33
type Alerting struct {
31
34
Annotations []Label `json:"annotations,omitempty"`
32
35
FastBurn * AlertingMetadata `json:"fastBurn,omitempty"`
33
36
Labels []Label `json:"labels,omitempty"`
34
37
SlowBurn * AlertingMetadata `json:"slowBurn,omitempty"`
35
38
}
36
39
40
+ // AlertingMetadata defines model for AlertingMetadata.
37
41
type AlertingMetadata struct {
38
42
Annotations []Label `json:"annotations,omitempty"`
39
43
Labels []Label `json:"labels,omitempty"`
40
44
}
41
45
46
+ // DashboardRef defines model for DashboardRef.
42
47
type DashboardRef struct {
43
48
UID string `json:"UID"`
44
49
}
45
50
51
+ // DestinationDatasource defines model for DestinationDatasource.
52
+ type DestinationDatasource struct {
53
+ Type string `json:"type,omitempty"`
54
+ UID string `json:"uid,omitempty"`
55
+ }
56
+
57
+ // FreeformQuery defines model for FreeformQuery.
46
58
type FreeformQuery struct {
47
59
Query string `json:"query"`
48
60
}
49
61
62
+ // HistogramQuery defines model for HistogramQuery.
50
63
type HistogramQuery struct {
51
64
GroupByLabels []string `json:"groupByLabels,omitempty"`
52
65
Metric MetricDef `json:"metric"`
53
66
Percentile float64 `json:"percentile"`
54
67
Threshold Threshold `json:"threshold"`
55
68
}
56
69
70
+ // Label defines model for Label.
57
71
type Label struct {
58
72
Key string `json:"key"`
59
73
Value string `json:"value"`
60
74
}
61
75
76
+ // MetricDef defines model for MetricDef.
62
77
type MetricDef struct {
63
- PrometheusMetric string `json:"prometheusMetric"`
64
- Type * string `json:"type,omitempty"`
78
+ PrometheusMetric string `json:"prometheusMetric"`
79
+ Type string `json:"type,omitempty"`
65
80
}
66
81
82
+ // Objective defines model for Objective.
67
83
type Objective struct {
68
84
Value float64 `json:"value"`
69
85
Window string `json:"window"`
70
86
}
71
87
88
+ // Query defines model for Query.
72
89
type Query struct {
73
90
Freeform * FreeformQuery `json:"freeform,omitempty"`
74
91
Histogram * HistogramQuery `json:"histogram,omitempty"`
@@ -77,32 +94,52 @@ type Query struct {
77
94
Type QueryType `json:"type"`
78
95
}
79
96
97
+ // QueryType defines model for Query.Type.
80
98
type QueryType string
81
99
100
+ // RatioQuery defines model for RatioQuery.
82
101
type RatioQuery struct {
83
102
GroupByLabels []string `json:"groupByLabels,omitempty"`
84
103
SuccessMetric MetricDef `json:"successMetric"`
85
104
TotalMetric MetricDef `json:"totalMetric"`
86
105
}
87
106
88
- type Slo struct {
89
- Alerting * Alerting `json:"alerting,omitempty"`
90
- Description string `json:"description"`
107
+ // ReadOnly defines model for ReadOnly.
108
+ type ReadOnly struct {
91
109
DrillDownDashboardRef * DashboardRef `json:"drillDownDashboardRef,omitempty"`
92
- Labels []Label `json:"labels,omitempty"`
93
- Name string `json:"name"`
94
- Objectives []Objective `json:"objectives"`
95
- Query Query `json:"query"`
96
- UUID string `json:"uuid"`
110
+ Provenance string `json:"provenance,omitempty"`
111
+ Status * Status `json:"status,omitempty"`
112
+ }
113
+
114
+ // Slo defines model for Slo.
115
+ type Slo struct {
116
+ Alerting * Alerting `json:"alerting,omitempty"`
117
+ Description string `json:"description"`
118
+ DestinationDatasource * DestinationDatasource `json:"destinationDatasource,omitempty"`
119
+ Labels []Label `json:"labels,omitempty"`
120
+ Name string `json:"name"`
121
+ Objectives []Objective `json:"objectives"`
122
+ Query Query `json:"query"`
123
+ ReadOnly * ReadOnly `json:"readOnly,omitempty"`
124
+ UUID string `json:"uuid"`
125
+ }
126
+
127
+ // Status defines model for Status.
128
+ type Status struct {
129
+ Message string `json:"message,omitempty"`
130
+ Type string `json:"type"`
97
131
}
98
132
133
+ // Threshold defines model for Threshold.
99
134
type Threshold struct {
100
135
Operator ThresholdOperator `json:"operator"`
101
136
Value float64 `json:"value"`
102
137
}
103
138
139
+ // ThresholdOperator defines model for Threshold.Operator.
104
140
type ThresholdOperator string
105
141
142
+ // ThresholdQuery defines model for ThresholdQuery.
106
143
type ThresholdQuery struct {
107
144
GroupByLabels []string `json:"groupByLabels,omitempty"`
108
145
Metric MetricDef `json:"metric"`
0 commit comments