Skip to content

Commit 2118b9e

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit deab122 of spec repo
1 parent 2e523af commit 2118b9e

13 files changed

+1287
-251
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 264 additions & 173 deletions
Large diffs are not rendered by default.

src/datadogV2/api/api_dora_metrics.rs

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,10 @@ impl DORAMetricsAPI {
808808
pub async fn get_dora_deployment(
809809
&self,
810810
deployment_id: String,
811-
) -> Result<crate::datadogV2::model::DORAFetchResponse, datadog::Error<GetDORADeploymentError>>
812-
{
811+
) -> Result<
812+
crate::datadogV2::model::DORADeploymentFetchResponse,
813+
datadog::Error<GetDORADeploymentError>,
814+
> {
813815
match self.get_dora_deployment_with_http_info(deployment_id).await {
814816
Ok(response_content) => {
815817
if let Some(e) = response_content.entity {
@@ -829,7 +831,7 @@ impl DORAMetricsAPI {
829831
&self,
830832
deployment_id: String,
831833
) -> Result<
832-
datadog::ResponseContent<crate::datadogV2::model::DORAFetchResponse>,
834+
datadog::ResponseContent<crate::datadogV2::model::DORADeploymentFetchResponse>,
833835
datadog::Error<GetDORADeploymentError>,
834836
> {
835837
let local_configuration = &self.config;
@@ -887,8 +889,9 @@ impl DORAMetricsAPI {
887889
log::debug!("response content: {}", local_content);
888890

889891
if !local_status.is_client_error() && !local_status.is_server_error() {
890-
match serde_json::from_str::<crate::datadogV2::model::DORAFetchResponse>(&local_content)
891-
{
892+
match serde_json::from_str::<crate::datadogV2::model::DORADeploymentFetchResponse>(
893+
&local_content,
894+
) {
892895
Ok(e) => {
893896
return Ok(datadog::ResponseContent {
894897
status: local_status,
@@ -914,8 +917,10 @@ impl DORAMetricsAPI {
914917
pub async fn get_dora_failure(
915918
&self,
916919
failure_id: String,
917-
) -> Result<crate::datadogV2::model::DORAFetchResponse, datadog::Error<GetDORAFailureError>>
918-
{
920+
) -> Result<
921+
crate::datadogV2::model::DORAFailureFetchResponse,
922+
datadog::Error<GetDORAFailureError>,
923+
> {
919924
match self.get_dora_failure_with_http_info(failure_id).await {
920925
Ok(response_content) => {
921926
if let Some(e) = response_content.entity {
@@ -935,7 +940,7 @@ impl DORAMetricsAPI {
935940
&self,
936941
failure_id: String,
937942
) -> Result<
938-
datadog::ResponseContent<crate::datadogV2::model::DORAFetchResponse>,
943+
datadog::ResponseContent<crate::datadogV2::model::DORAFailureFetchResponse>,
939944
datadog::Error<GetDORAFailureError>,
940945
> {
941946
let local_configuration = &self.config;
@@ -993,8 +998,9 @@ impl DORAMetricsAPI {
993998
log::debug!("response content: {}", local_content);
994999

9951000
if !local_status.is_client_error() && !local_status.is_server_error() {
996-
match serde_json::from_str::<crate::datadogV2::model::DORAFetchResponse>(&local_content)
997-
{
1001+
match serde_json::from_str::<crate::datadogV2::model::DORAFailureFetchResponse>(
1002+
&local_content,
1003+
) {
9981004
Ok(e) => {
9991005
return Ok(datadog::ResponseContent {
10001006
status: local_status,
@@ -1020,8 +1026,10 @@ impl DORAMetricsAPI {
10201026
pub async fn list_dora_deployments(
10211027
&self,
10221028
body: crate::datadogV2::model::DORAListDeploymentsRequest,
1023-
) -> Result<crate::datadogV2::model::DORAListResponse, datadog::Error<ListDORADeploymentsError>>
1024-
{
1029+
) -> Result<
1030+
crate::datadogV2::model::DORADeploymentsListResponse,
1031+
datadog::Error<ListDORADeploymentsError>,
1032+
> {
10251033
match self.list_dora_deployments_with_http_info(body).await {
10261034
Ok(response_content) => {
10271035
if let Some(e) = response_content.entity {
@@ -1041,7 +1049,7 @@ impl DORAMetricsAPI {
10411049
&self,
10421050
body: crate::datadogV2::model::DORAListDeploymentsRequest,
10431051
) -> Result<
1044-
datadog::ResponseContent<crate::datadogV2::model::DORAListResponse>,
1052+
datadog::ResponseContent<crate::datadogV2::model::DORADeploymentsListResponse>,
10451053
datadog::Error<ListDORADeploymentsError>,
10461054
> {
10471055
let local_configuration = &self.config;
@@ -1144,8 +1152,9 @@ impl DORAMetricsAPI {
11441152
log::debug!("response content: {}", local_content);
11451153

11461154
if !local_status.is_client_error() && !local_status.is_server_error() {
1147-
match serde_json::from_str::<crate::datadogV2::model::DORAListResponse>(&local_content)
1148-
{
1155+
match serde_json::from_str::<crate::datadogV2::model::DORADeploymentsListResponse>(
1156+
&local_content,
1157+
) {
11491158
Ok(e) => {
11501159
return Ok(datadog::ResponseContent {
11511160
status: local_status,
@@ -1171,8 +1180,10 @@ impl DORAMetricsAPI {
11711180
pub async fn list_dora_failures(
11721181
&self,
11731182
body: crate::datadogV2::model::DORAListFailuresRequest,
1174-
) -> Result<crate::datadogV2::model::DORAListResponse, datadog::Error<ListDORAFailuresError>>
1175-
{
1183+
) -> Result<
1184+
crate::datadogV2::model::DORAFailuresListResponse,
1185+
datadog::Error<ListDORAFailuresError>,
1186+
> {
11761187
match self.list_dora_failures_with_http_info(body).await {
11771188
Ok(response_content) => {
11781189
if let Some(e) = response_content.entity {
@@ -1192,7 +1203,7 @@ impl DORAMetricsAPI {
11921203
&self,
11931204
body: crate::datadogV2::model::DORAListFailuresRequest,
11941205
) -> Result<
1195-
datadog::ResponseContent<crate::datadogV2::model::DORAListResponse>,
1206+
datadog::ResponseContent<crate::datadogV2::model::DORAFailuresListResponse>,
11961207
datadog::Error<ListDORAFailuresError>,
11971208
> {
11981209
let local_configuration = &self.config;
@@ -1295,8 +1306,9 @@ impl DORAMetricsAPI {
12951306
log::debug!("response content: {}", local_content);
12961307

12971308
if !local_status.is_client_error() && !local_status.is_server_error() {
1298-
match serde_json::from_str::<crate::datadogV2::model::DORAListResponse>(&local_content)
1299-
{
1309+
match serde_json::from_str::<crate::datadogV2::model::DORAFailuresListResponse>(
1310+
&local_content,
1311+
) {
13001312
Ok(e) => {
13011313
return Ok(datadog::ResponseContent {
13021314
status: local_status,

src/datadogV2/model/mod.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,12 +2306,16 @@ pub mod model_dora_list_deployments_request_attributes;
23062306
pub use self::model_dora_list_deployments_request_attributes::DORAListDeploymentsRequestAttributes;
23072307
pub mod model_dora_list_deployments_request_data_type;
23082308
pub use self::model_dora_list_deployments_request_data_type::DORAListDeploymentsRequestDataType;
2309-
pub mod model_dora_list_response;
2310-
pub use self::model_dora_list_response::DORAListResponse;
2311-
pub mod model_dora_event;
2312-
pub use self::model_dora_event::DORAEvent;
2313-
pub mod model_dora_fetch_response;
2314-
pub use self::model_dora_fetch_response::DORAFetchResponse;
2309+
pub mod model_dora_deployments_list_response;
2310+
pub use self::model_dora_deployments_list_response::DORADeploymentsListResponse;
2311+
pub mod model_dora_deployment_object;
2312+
pub use self::model_dora_deployment_object::DORADeploymentObject;
2313+
pub mod model_dora_deployment_object_attributes;
2314+
pub use self::model_dora_deployment_object_attributes::DORADeploymentObjectAttributes;
2315+
pub mod model_dora_deployment_object_type;
2316+
pub use self::model_dora_deployment_object_type::DORADeploymentObjectType;
2317+
pub mod model_dora_deployment_fetch_response;
2318+
pub use self::model_dora_deployment_fetch_response::DORADeploymentFetchResponse;
23152319
pub mod model_dora_failure_request;
23162320
pub use self::model_dora_failure_request::DORAFailureRequest;
23172321
pub mod model_dora_failure_request_data;
@@ -2332,6 +2336,16 @@ pub mod model_dora_list_failures_request_attributes;
23322336
pub use self::model_dora_list_failures_request_attributes::DORAListFailuresRequestAttributes;
23332337
pub mod model_dora_list_failures_request_data_type;
23342338
pub use self::model_dora_list_failures_request_data_type::DORAListFailuresRequestDataType;
2339+
pub mod model_dora_failures_list_response;
2340+
pub use self::model_dora_failures_list_response::DORAFailuresListResponse;
2341+
pub mod model_dora_incident_object;
2342+
pub use self::model_dora_incident_object::DORAIncidentObject;
2343+
pub mod model_dora_incident_object_attributes;
2344+
pub use self::model_dora_incident_object_attributes::DORAIncidentObjectAttributes;
2345+
pub mod model_dora_incident_object_type;
2346+
pub use self::model_dora_incident_object_type::DORAIncidentObjectType;
2347+
pub mod model_dora_failure_fetch_response;
2348+
pub use self::model_dora_failure_fetch_response::DORAFailureFetchResponse;
23352349
pub mod model_list_downtimes_response;
23362350
pub use self::model_list_downtimes_response::ListDowntimesResponse;
23372351
pub mod model_downtime_response_data;
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
/// Response for fetching a single deployment event.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct DORADeploymentFetchResponse {
14+
/// A DORA deployment event.
15+
#[serde(rename = "data")]
16+
pub data: Option<crate::datadogV2::model::DORADeploymentObject>,
17+
#[serde(flatten)]
18+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
19+
#[serde(skip)]
20+
#[serde(default)]
21+
pub(crate) _unparsed: bool,
22+
}
23+
24+
impl DORADeploymentFetchResponse {
25+
pub fn new() -> DORADeploymentFetchResponse {
26+
DORADeploymentFetchResponse {
27+
data: None,
28+
additional_properties: std::collections::BTreeMap::new(),
29+
_unparsed: false,
30+
}
31+
}
32+
33+
pub fn data(mut self, value: crate::datadogV2::model::DORADeploymentObject) -> Self {
34+
self.data = Some(value);
35+
self
36+
}
37+
38+
pub fn additional_properties(
39+
mut self,
40+
value: std::collections::BTreeMap<String, serde_json::Value>,
41+
) -> Self {
42+
self.additional_properties = value;
43+
self
44+
}
45+
}
46+
47+
impl Default for DORADeploymentFetchResponse {
48+
fn default() -> Self {
49+
Self::new()
50+
}
51+
}
52+
53+
impl<'de> Deserialize<'de> for DORADeploymentFetchResponse {
54+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
55+
where
56+
D: Deserializer<'de>,
57+
{
58+
struct DORADeploymentFetchResponseVisitor;
59+
impl<'a> Visitor<'a> for DORADeploymentFetchResponseVisitor {
60+
type Value = DORADeploymentFetchResponse;
61+
62+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
63+
f.write_str("a mapping")
64+
}
65+
66+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
67+
where
68+
M: MapAccess<'a>,
69+
{
70+
let mut data: Option<crate::datadogV2::model::DORADeploymentObject> = None;
71+
let mut additional_properties: std::collections::BTreeMap<
72+
String,
73+
serde_json::Value,
74+
> = std::collections::BTreeMap::new();
75+
let mut _unparsed = false;
76+
77+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
78+
match k.as_str() {
79+
"data" => {
80+
if v.is_null() {
81+
continue;
82+
}
83+
data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
84+
}
85+
&_ => {
86+
if let Ok(value) = serde_json::from_value(v.clone()) {
87+
additional_properties.insert(k, value);
88+
}
89+
}
90+
}
91+
}
92+
93+
let content = DORADeploymentFetchResponse {
94+
data,
95+
additional_properties,
96+
_unparsed,
97+
};
98+
99+
Ok(content)
100+
}
101+
}
102+
103+
deserializer.deserialize_any(DORADeploymentFetchResponseVisitor)
104+
}
105+
}

0 commit comments

Comments
 (0)