datadog_api_client/datadogV2/model/
model_sensitive_data_scanner_meta.rs

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.
4use serde::de::{Error, MapAccess, Visitor};
5use serde::{Deserialize, Deserializer, Serialize};
6use serde_with::skip_serializing_none;
7use std::fmt::{self, Formatter};
8
9/// Meta response containing information about the API.
10#[non_exhaustive]
11#[skip_serializing_none]
12#[derive(Clone, Debug, PartialEq, Serialize)]
13pub struct SensitiveDataScannerMeta {
14    /// Maximum number of scanning rules allowed for the org.
15    #[serde(rename = "count_limit")]
16    pub count_limit: Option<i64>,
17    /// Maximum number of scanning groups allowed for the org.
18    #[serde(rename = "group_count_limit")]
19    pub group_count_limit: Option<i64>,
20    /// (Deprecated) Whether or not scanned events are highlighted in Logs or RUM for the org.
21    #[deprecated]
22    #[serde(rename = "has_highlight_enabled")]
23    pub has_highlight_enabled: Option<bool>,
24    /// (Deprecated) Whether or not scanned events have multi-pass enabled.
25    #[deprecated]
26    #[serde(rename = "has_multi_pass_enabled")]
27    pub has_multi_pass_enabled: Option<bool>,
28    /// Whether or not the org is compliant to the payment card industry standard.
29    #[serde(rename = "is_pci_compliant")]
30    pub is_pci_compliant: Option<bool>,
31    /// Version of the API.
32    #[serde(rename = "version")]
33    pub version: Option<i64>,
34    #[serde(flatten)]
35    pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
36    #[serde(skip)]
37    #[serde(default)]
38    pub(crate) _unparsed: bool,
39}
40
41impl SensitiveDataScannerMeta {
42    pub fn new() -> SensitiveDataScannerMeta {
43        #[allow(deprecated)]
44        SensitiveDataScannerMeta {
45            count_limit: None,
46            group_count_limit: None,
47            has_highlight_enabled: None,
48            has_multi_pass_enabled: None,
49            is_pci_compliant: None,
50            version: None,
51            additional_properties: std::collections::BTreeMap::new(),
52            _unparsed: false,
53        }
54    }
55
56    #[allow(deprecated)]
57    pub fn count_limit(mut self, value: i64) -> Self {
58        self.count_limit = Some(value);
59        self
60    }
61
62    #[allow(deprecated)]
63    pub fn group_count_limit(mut self, value: i64) -> Self {
64        self.group_count_limit = Some(value);
65        self
66    }
67
68    #[allow(deprecated)]
69    pub fn has_highlight_enabled(mut self, value: bool) -> Self {
70        self.has_highlight_enabled = Some(value);
71        self
72    }
73
74    #[allow(deprecated)]
75    pub fn has_multi_pass_enabled(mut self, value: bool) -> Self {
76        self.has_multi_pass_enabled = Some(value);
77        self
78    }
79
80    #[allow(deprecated)]
81    pub fn is_pci_compliant(mut self, value: bool) -> Self {
82        self.is_pci_compliant = Some(value);
83        self
84    }
85
86    #[allow(deprecated)]
87    pub fn version(mut self, value: i64) -> Self {
88        self.version = Some(value);
89        self
90    }
91
92    pub fn additional_properties(
93        mut self,
94        value: std::collections::BTreeMap<String, serde_json::Value>,
95    ) -> Self {
96        self.additional_properties = value;
97        self
98    }
99}
100
101impl Default for SensitiveDataScannerMeta {
102    fn default() -> Self {
103        Self::new()
104    }
105}
106
107impl<'de> Deserialize<'de> for SensitiveDataScannerMeta {
108    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
109    where
110        D: Deserializer<'de>,
111    {
112        struct SensitiveDataScannerMetaVisitor;
113        impl<'a> Visitor<'a> for SensitiveDataScannerMetaVisitor {
114            type Value = SensitiveDataScannerMeta;
115
116            fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
117                f.write_str("a mapping")
118            }
119
120            fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
121            where
122                M: MapAccess<'a>,
123            {
124                let mut count_limit: Option<i64> = None;
125                let mut group_count_limit: Option<i64> = None;
126                let mut has_highlight_enabled: Option<bool> = None;
127                let mut has_multi_pass_enabled: Option<bool> = None;
128                let mut is_pci_compliant: Option<bool> = None;
129                let mut version: Option<i64> = None;
130                let mut additional_properties: std::collections::BTreeMap<
131                    String,
132                    serde_json::Value,
133                > = std::collections::BTreeMap::new();
134                let mut _unparsed = false;
135
136                while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
137                    match k.as_str() {
138                        "count_limit" => {
139                            if v.is_null() {
140                                continue;
141                            }
142                            count_limit =
143                                Some(serde_json::from_value(v).map_err(M::Error::custom)?);
144                        }
145                        "group_count_limit" => {
146                            if v.is_null() {
147                                continue;
148                            }
149                            group_count_limit =
150                                Some(serde_json::from_value(v).map_err(M::Error::custom)?);
151                        }
152                        "has_highlight_enabled" => {
153                            if v.is_null() {
154                                continue;
155                            }
156                            has_highlight_enabled =
157                                Some(serde_json::from_value(v).map_err(M::Error::custom)?);
158                        }
159                        "has_multi_pass_enabled" => {
160                            if v.is_null() {
161                                continue;
162                            }
163                            has_multi_pass_enabled =
164                                Some(serde_json::from_value(v).map_err(M::Error::custom)?);
165                        }
166                        "is_pci_compliant" => {
167                            if v.is_null() {
168                                continue;
169                            }
170                            is_pci_compliant =
171                                Some(serde_json::from_value(v).map_err(M::Error::custom)?);
172                        }
173                        "version" => {
174                            if v.is_null() {
175                                continue;
176                            }
177                            version = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
178                        }
179                        &_ => {
180                            if let Ok(value) = serde_json::from_value(v.clone()) {
181                                additional_properties.insert(k, value);
182                            }
183                        }
184                    }
185                }
186
187                #[allow(deprecated)]
188                let content = SensitiveDataScannerMeta {
189                    count_limit,
190                    group_count_limit,
191                    has_highlight_enabled,
192                    has_multi_pass_enabled,
193                    is_pci_compliant,
194                    version,
195                    additional_properties,
196                    _unparsed,
197                };
198
199                Ok(content)
200            }
201        }
202
203        deserializer.deserialize_any(SensitiveDataScannerMetaVisitor)
204    }
205}