Skip to content

Commit 721bb2e

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 795c134 of spec repo
1 parent 375c663 commit 721bb2e

File tree

9 files changed

+298
-11
lines changed

9 files changed

+298
-11
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11481,6 +11481,60 @@ components:
1148111481
example: UTC
1148211482
type: string
1148311483
type: object
11484+
SLOCountCondition:
11485+
description: 'A metric SLI specification, composed of three parts: the good
11486+
events formula, the total events formula,
11487+
11488+
and the involved queries.'
11489+
example:
11490+
good_events_formula: query1 - query2
11491+
queries:
11492+
- data_source: metrics
11493+
name: query1
11494+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
11495+
- data_source: metrics
11496+
name: query2
11497+
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
11498+
total_events_formula: query1
11499+
properties:
11500+
good_events_formula:
11501+
$ref: '#/components/schemas/SLOFormula'
11502+
queries:
11503+
example:
11504+
- data_source: metrics
11505+
name: query1
11506+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
11507+
items:
11508+
$ref: '#/components/schemas/SLODataSourceQueryDefinition'
11509+
minItems: 1
11510+
type: array
11511+
total_events_formula:
11512+
$ref: '#/components/schemas/SLOFormula'
11513+
required:
11514+
- good_events_formula
11515+
- total_events_formula
11516+
- queries
11517+
type: object
11518+
SLOCountSpec:
11519+
additionalProperties: false
11520+
description: A metric SLI specification.
11521+
example:
11522+
count:
11523+
good_events_formula: query1 - query2
11524+
queries:
11525+
- data_source: metrics
11526+
name: query1
11527+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
11528+
- data_source: metrics
11529+
name: query2
11530+
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
11531+
total_events_formula: query1
11532+
properties:
11533+
count:
11534+
$ref: '#/components/schemas/SLOCountCondition'
11535+
required:
11536+
- count
11537+
type: object
1148411538
SLOCreator:
1148511539
description: The creator of the SLO
1148611540
nullable: true
@@ -12328,8 +12382,16 @@ components:
1232812382
type: string
1232912383
query:
1233012384
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
12385+
description: 'The metric query of good / total events. This is not allowed
12386+
if the `sli_specification` field
12387+
12388+
is used in the same request.'
1233112389
sli_specification:
1233212390
$ref: '#/components/schemas/SLOSliSpec'
12391+
description: 'A generic SLI specification. This is currently used for time-slice
12392+
and metric SLOs only.
12393+
12394+
This is not allowed if the `query` field is used in the same request.'
1233312395
tags:
1233412396
description: 'A list of tags associated with this service level objective.
1233512397

@@ -12386,9 +12448,10 @@ components:
1238612448
type: object
1238712449
SLOSliSpec:
1238812450
description: A generic SLI specification. This is currently used for time-slice
12389-
SLOs only.
12451+
and metric SLOs only.
1239012452
oneOf:
1239112453
- $ref: '#/components/schemas/SLOTimeSliceSpec'
12454+
- $ref: '#/components/schemas/SLOCountSpec'
1239212455
SLOState:
1239312456
description: State of the SLO.
1239412457
enum:
@@ -13479,8 +13542,16 @@ components:
1347913542
type: string
1348013543
query:
1348113544
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
13545+
description: 'The metric query of good / total events. This is not allowed
13546+
if the `sli_specification` field
13547+
13548+
is used in the same request.'
1348213549
sli_specification:
1348313550
$ref: '#/components/schemas/SLOSliSpec'
13551+
description: 'A generic SLI specification. This is currently used for time-slice
13552+
and metric SLOs only.
13553+
13554+
This is not allowed if the `query` field is used in the same request.'
1348413555
tags:
1348513556
description: 'A list of tags associated with this service level objective.
1348613557

@@ -13540,8 +13611,8 @@ components:
1354013611
- type
1354113612
type: object
1354213613
ServiceLevelObjectiveQuery:
13543-
description: 'A metric-based SLO. **Required if type is `metric`**. Note that
13544-
Datadog only allows the sum by aggregator
13614+
description: 'A now deprecated metric SLO. Note that Datadog only allows the
13615+
sum by aggregator
1354513616

1354613617
to be used because this will sum up all request counts instead of averaging
1354713618
them, or taking the max or
@@ -13610,8 +13681,16 @@ components:
1361013681
type: string
1361113682
query:
1361213683
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
13684+
description: 'The metric query of good / total events. This is not allowed
13685+
if the `sli_specification` field
13686+
13687+
is used in the same request.'
1361313688
sli_specification:
1361413689
$ref: '#/components/schemas/SLOSliSpec'
13690+
description: 'A generic SLI specification. This is currently used for time-slice
13691+
and metric SLOs only.
13692+
13693+
This is not allowed if the `query` field is used in the same request.'
1361513694
tags:
1361613695
description: 'A list of tags associated with this service level objective.
1361713696

src/datadogV1/model/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,10 @@ pub mod model_slo_data_source_query_definition;
12321232
pub use self::model_slo_data_source_query_definition::SLODataSourceQueryDefinition;
12331233
pub mod model_slo_time_slice_interval;
12341234
pub use self::model_slo_time_slice_interval::SLOTimeSliceInterval;
1235+
pub mod model_slo_count_spec;
1236+
pub use self::model_slo_count_spec::SLOCountSpec;
1237+
pub mod model_slo_count_condition;
1238+
pub use self::model_slo_count_condition::SLOCountCondition;
12351239
pub mod model_slo_sli_spec;
12361240
pub use self::model_slo_sli_spec::SLOSliSpec;
12371241
pub mod model_slo_threshold;

src/datadogV1/model/model_service_level_objective.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ pub struct ServiceLevelObjective {
6262
/// The name of the service level objective object.
6363
#[serde(rename = "name")]
6464
pub name: String,
65-
/// A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator
65+
/// A now deprecated metric SLO. Note that Datadog only allows the sum by aggregator
6666
/// to be used because this will sum up all request counts instead of averaging them, or taking the max or
6767
/// min of all of those requests.
6868
#[serde(rename = "query")]
6969
pub query: Option<crate::datadogV1::model::ServiceLevelObjectiveQuery>,
70-
/// A generic SLI specification. This is currently used for time-slice SLOs only.
70+
/// A generic SLI specification. This is currently used for time-slice and metric SLOs only.
7171
#[serde(rename = "sli_specification")]
7272
pub sli_specification: Option<crate::datadogV1::model::SLOSliSpec>,
7373
/// A list of tags associated with this service level objective.

src/datadogV1/model/model_service_level_objective_query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use serde::{Deserialize, Deserializer, Serialize};
66
use serde_with::skip_serializing_none;
77
use std::fmt::{self, Formatter};
88

9-
/// A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator
9+
/// A now deprecated metric SLO. Note that Datadog only allows the sum by aggregator
1010
/// to be used because this will sum up all request counts instead of averaging them, or taking the max or
1111
/// min of all of those requests.
1212
#[non_exhaustive]

src/datadogV1/model/model_service_level_objective_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ pub struct ServiceLevelObjectiveRequest {
3636
/// The name of the service level objective object.
3737
#[serde(rename = "name")]
3838
pub name: String,
39-
/// A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator
39+
/// A now deprecated metric SLO. Note that Datadog only allows the sum by aggregator
4040
/// to be used because this will sum up all request counts instead of averaging them, or taking the max or
4141
/// min of all of those requests.
4242
#[serde(rename = "query")]
4343
pub query: Option<crate::datadogV1::model::ServiceLevelObjectiveQuery>,
44-
/// A generic SLI specification. This is currently used for time-slice SLOs only.
44+
/// A generic SLI specification. This is currently used for time-slice and metric SLOs only.
4545
#[serde(rename = "sli_specification")]
4646
pub sli_specification: Option<crate::datadogV1::model::SLOSliSpec>,
4747
/// A list of tags associated with this service level objective.
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// A metric SLI specification, composed of three parts: the good events formula, the total events formula,
10+
/// and the involved queries.
11+
#[non_exhaustive]
12+
#[skip_serializing_none]
13+
#[derive(Clone, Debug, PartialEq, Serialize)]
14+
pub struct SLOCountCondition {
15+
/// A formula that specifies how to combine the results of multiple queries.
16+
#[serde(rename = "good_events_formula")]
17+
pub good_events_formula: crate::datadogV1::model::SLOFormula,
18+
#[serde(rename = "queries")]
19+
pub queries: Vec<crate::datadogV1::model::SLODataSourceQueryDefinition>,
20+
/// A formula that specifies how to combine the results of multiple queries.
21+
#[serde(rename = "total_events_formula")]
22+
pub total_events_formula: crate::datadogV1::model::SLOFormula,
23+
#[serde(flatten)]
24+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
25+
#[serde(skip)]
26+
#[serde(default)]
27+
pub(crate) _unparsed: bool,
28+
}
29+
30+
impl SLOCountCondition {
31+
pub fn new(
32+
good_events_formula: crate::datadogV1::model::SLOFormula,
33+
queries: Vec<crate::datadogV1::model::SLODataSourceQueryDefinition>,
34+
total_events_formula: crate::datadogV1::model::SLOFormula,
35+
) -> SLOCountCondition {
36+
SLOCountCondition {
37+
good_events_formula,
38+
queries,
39+
total_events_formula,
40+
additional_properties: std::collections::BTreeMap::new(),
41+
_unparsed: false,
42+
}
43+
}
44+
45+
pub fn additional_properties(
46+
mut self,
47+
value: std::collections::BTreeMap<String, serde_json::Value>,
48+
) -> Self {
49+
self.additional_properties = value;
50+
self
51+
}
52+
}
53+
54+
impl<'de> Deserialize<'de> for SLOCountCondition {
55+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
56+
where
57+
D: Deserializer<'de>,
58+
{
59+
struct SLOCountConditionVisitor;
60+
impl<'a> Visitor<'a> for SLOCountConditionVisitor {
61+
type Value = SLOCountCondition;
62+
63+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
64+
f.write_str("a mapping")
65+
}
66+
67+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
68+
where
69+
M: MapAccess<'a>,
70+
{
71+
let mut good_events_formula: Option<crate::datadogV1::model::SLOFormula> = None;
72+
let mut queries: Option<
73+
Vec<crate::datadogV1::model::SLODataSourceQueryDefinition>,
74+
> = None;
75+
let mut total_events_formula: Option<crate::datadogV1::model::SLOFormula> = None;
76+
let mut additional_properties: std::collections::BTreeMap<
77+
String,
78+
serde_json::Value,
79+
> = std::collections::BTreeMap::new();
80+
let mut _unparsed = false;
81+
82+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
83+
match k.as_str() {
84+
"good_events_formula" => {
85+
good_events_formula =
86+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
87+
}
88+
"queries" => {
89+
queries = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
90+
}
91+
"total_events_formula" => {
92+
total_events_formula =
93+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
94+
}
95+
&_ => {
96+
if let Ok(value) = serde_json::from_value(v.clone()) {
97+
additional_properties.insert(k, value);
98+
}
99+
}
100+
}
101+
}
102+
let good_events_formula = good_events_formula
103+
.ok_or_else(|| M::Error::missing_field("good_events_formula"))?;
104+
let queries = queries.ok_or_else(|| M::Error::missing_field("queries"))?;
105+
let total_events_formula = total_events_formula
106+
.ok_or_else(|| M::Error::missing_field("total_events_formula"))?;
107+
108+
let content = SLOCountCondition {
109+
good_events_formula,
110+
queries,
111+
total_events_formula,
112+
additional_properties,
113+
_unparsed,
114+
};
115+
116+
Ok(content)
117+
}
118+
}
119+
120+
deserializer.deserialize_any(SLOCountConditionVisitor)
121+
}
122+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// A metric SLI specification.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct SLOCountSpec {
14+
/// A metric SLI specification, composed of three parts: the good events formula, the total events formula,
15+
/// and the involved queries.
16+
#[serde(rename = "count")]
17+
pub count: crate::datadogV1::model::SLOCountCondition,
18+
#[serde(skip)]
19+
#[serde(default)]
20+
pub(crate) _unparsed: bool,
21+
}
22+
23+
impl SLOCountSpec {
24+
pub fn new(count: crate::datadogV1::model::SLOCountCondition) -> SLOCountSpec {
25+
SLOCountSpec {
26+
count,
27+
_unparsed: false,
28+
}
29+
}
30+
}
31+
32+
impl<'de> Deserialize<'de> for SLOCountSpec {
33+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
34+
where
35+
D: Deserializer<'de>,
36+
{
37+
struct SLOCountSpecVisitor;
38+
impl<'a> Visitor<'a> for SLOCountSpecVisitor {
39+
type Value = SLOCountSpec;
40+
41+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
42+
f.write_str("a mapping")
43+
}
44+
45+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
46+
where
47+
M: MapAccess<'a>,
48+
{
49+
let mut count: Option<crate::datadogV1::model::SLOCountCondition> = None;
50+
let mut _unparsed = false;
51+
52+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
53+
match k.as_str() {
54+
"count" => {
55+
count = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
56+
}
57+
&_ => {
58+
return Err(serde::de::Error::custom(
59+
"Additional properties not allowed",
60+
));
61+
}
62+
}
63+
}
64+
let count = count.ok_or_else(|| M::Error::missing_field("count"))?;
65+
66+
let content = SLOCountSpec { count, _unparsed };
67+
68+
Ok(content)
69+
}
70+
}
71+
72+
deserializer.deserialize_any(SLOCountSpecVisitor)
73+
}
74+
}

src/datadogV1/model/model_slo_response_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ pub struct SLOResponseData {
6565
/// The name of the service level objective object.
6666
#[serde(rename = "name")]
6767
pub name: Option<String>,
68-
/// A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator
68+
/// A now deprecated metric SLO. Note that Datadog only allows the sum by aggregator
6969
/// to be used because this will sum up all request counts instead of averaging them, or taking the max or
7070
/// min of all of those requests.
7171
#[serde(rename = "query")]
7272
pub query: Option<crate::datadogV1::model::ServiceLevelObjectiveQuery>,
73-
/// A generic SLI specification. This is currently used for time-slice SLOs only.
73+
/// A generic SLI specification. This is currently used for time-slice and metric SLOs only.
7474
#[serde(rename = "sli_specification")]
7575
pub sli_specification: Option<crate::datadogV1::model::SLOSliSpec>,
7676
/// A list of tags associated with this service level objective.

0 commit comments

Comments
 (0)