datadog_api_client/datadogV2/model/
model_entity_v3_datadog_pipelines.rs1use serde::de::{Error, MapAccess, Visitor};
5use serde::{Deserialize, Deserializer, Serialize};
6use serde_with::skip_serializing_none;
7use std::fmt::{self, Formatter};
8
9#[non_exhaustive]
11#[skip_serializing_none]
12#[derive(Clone, Debug, PartialEq, Serialize)]
13pub struct EntityV3DatadogPipelines {
14 #[serde(rename = "fingerprints")]
16 pub fingerprints: Option<Vec<String>>,
17 #[serde(skip)]
18 #[serde(default)]
19 pub(crate) _unparsed: bool,
20}
21
22impl EntityV3DatadogPipelines {
23 pub fn new() -> EntityV3DatadogPipelines {
24 EntityV3DatadogPipelines {
25 fingerprints: None,
26 _unparsed: false,
27 }
28 }
29
30 pub fn fingerprints(mut self, value: Vec<String>) -> Self {
31 self.fingerprints = Some(value);
32 self
33 }
34}
35
36impl Default for EntityV3DatadogPipelines {
37 fn default() -> Self {
38 Self::new()
39 }
40}
41
42impl<'de> Deserialize<'de> for EntityV3DatadogPipelines {
43 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
44 where
45 D: Deserializer<'de>,
46 {
47 struct EntityV3DatadogPipelinesVisitor;
48 impl<'a> Visitor<'a> for EntityV3DatadogPipelinesVisitor {
49 type Value = EntityV3DatadogPipelines;
50
51 fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
52 f.write_str("a mapping")
53 }
54
55 fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
56 where
57 M: MapAccess<'a>,
58 {
59 let mut fingerprints: Option<Vec<String>> = None;
60 let mut _unparsed = false;
61
62 while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
63 match k.as_str() {
64 "fingerprints" => {
65 if v.is_null() {
66 continue;
67 }
68 fingerprints =
69 Some(serde_json::from_value(v).map_err(M::Error::custom)?);
70 }
71 &_ => {
72 return Err(serde::de::Error::custom(
73 "Additional properties not allowed",
74 ));
75 }
76 }
77 }
78
79 let content = EntityV3DatadogPipelines {
80 fingerprints,
81 _unparsed,
82 };
83
84 Ok(content)
85 }
86 }
87
88 deserializer.deserialize_any(EntityV3DatadogPipelinesVisitor)
89 }
90}