@@ -7,6 +7,8 @@ use serde_with::skip_serializing_none;
77use std:: fmt:: { self , Formatter } ;
88
99/// The attribute object associated with the SLO correction to be created.
10+ ///
11+ /// Exactly one of `slo_id` or `slo_query` must be provided.
1012#[ non_exhaustive]
1113#[ skip_serializing_none]
1214#[ derive( Clone , Debug , PartialEq , Serialize ) ]
@@ -27,9 +29,14 @@ pub struct SLOCorrectionCreateRequestAttributes {
2729 /// are `FREQ`, `INTERVAL`, `COUNT`, `UNTIL` and `BYDAY`.
2830 #[ serde( rename = "rrule" ) ]
2931 pub rrule : Option < String > ,
30- /// ID of the SLO that this correction applies to.
32+ /// ID of the single SLO that this correction applies to.
3133 #[ serde( rename = "slo_id" ) ]
32- pub slo_id : String ,
34+ pub slo_id : Option < String > ,
35+ /// Query that matches the SLOs this correction applies to.
36+ /// The query uses the [Events search syntax](<https://docs.datadoghq.com/events/explorer/searching/>)
37+ /// and can filter SLOs by SLO tags.
38+ #[ serde( rename = "slo_query" ) ]
39+ pub slo_query : Option < String > ,
3340 /// Starting time of the correction in epoch seconds.
3441 #[ serde( rename = "start" ) ]
3542 pub start : i64 ,
@@ -46,7 +53,6 @@ pub struct SLOCorrectionCreateRequestAttributes {
4653impl SLOCorrectionCreateRequestAttributes {
4754 pub fn new (
4855 category : crate :: datadogV1:: model:: SLOCorrectionCategory ,
49- slo_id : String ,
5056 start : i64 ,
5157 ) -> SLOCorrectionCreateRequestAttributes {
5258 SLOCorrectionCreateRequestAttributes {
@@ -55,7 +61,8 @@ impl SLOCorrectionCreateRequestAttributes {
5561 duration : None ,
5662 end : None ,
5763 rrule : None ,
58- slo_id,
64+ slo_id : None ,
65+ slo_query : None ,
5966 start,
6067 timezone : None ,
6168 additional_properties : std:: collections:: BTreeMap :: new ( ) ,
@@ -83,6 +90,16 @@ impl SLOCorrectionCreateRequestAttributes {
8390 self
8491 }
8592
93+ pub fn slo_id ( mut self , value : String ) -> Self {
94+ self . slo_id = Some ( value) ;
95+ self
96+ }
97+
98+ pub fn slo_query ( mut self , value : String ) -> Self {
99+ self . slo_query = Some ( value) ;
100+ self
101+ }
102+
86103 pub fn timezone ( mut self , value : String ) -> Self {
87104 self . timezone = Some ( value) ;
88105 self
@@ -120,6 +137,7 @@ impl<'de> Deserialize<'de> for SLOCorrectionCreateRequestAttributes {
120137 let mut end: Option < i64 > = None ;
121138 let mut rrule: Option < String > = None ;
122139 let mut slo_id: Option < String > = None ;
140+ let mut slo_query: Option < String > = None ;
123141 let mut start: Option < i64 > = None ;
124142 let mut timezone: Option < String > = None ;
125143 let mut additional_properties: std:: collections:: BTreeMap <
@@ -167,8 +185,17 @@ impl<'de> Deserialize<'de> for SLOCorrectionCreateRequestAttributes {
167185 rrule = Some ( serde_json:: from_value ( v) . map_err ( M :: Error :: custom) ?) ;
168186 }
169187 "slo_id" => {
188+ if v. is_null ( ) {
189+ continue ;
190+ }
170191 slo_id = Some ( serde_json:: from_value ( v) . map_err ( M :: Error :: custom) ?) ;
171192 }
193+ "slo_query" => {
194+ if v. is_null ( ) {
195+ continue ;
196+ }
197+ slo_query = Some ( serde_json:: from_value ( v) . map_err ( M :: Error :: custom) ?) ;
198+ }
172199 "start" => {
173200 start = Some ( serde_json:: from_value ( v) . map_err ( M :: Error :: custom) ?) ;
174201 }
@@ -186,7 +213,6 @@ impl<'de> Deserialize<'de> for SLOCorrectionCreateRequestAttributes {
186213 }
187214 }
188215 let category = category. ok_or_else ( || M :: Error :: missing_field ( "category" ) ) ?;
189- let slo_id = slo_id. ok_or_else ( || M :: Error :: missing_field ( "slo_id" ) ) ?;
190216 let start = start. ok_or_else ( || M :: Error :: missing_field ( "start" ) ) ?;
191217
192218 let content = SLOCorrectionCreateRequestAttributes {
@@ -196,6 +222,7 @@ impl<'de> Deserialize<'de> for SLOCorrectionCreateRequestAttributes {
196222 end,
197223 rrule,
198224 slo_id,
225+ slo_query,
199226 start,
200227 timezone,
201228 additional_properties,
0 commit comments