Skip to content

Commit 725ae58

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit d3ea9aa of spec repo
1 parent 51c701f commit 725ae58

6 files changed

Lines changed: 270 additions & 24 deletions

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6215,6 +6215,38 @@ components:
62156215
type: string
62166216
x-enum-varnames:
62176217
- DECODER_PROCESSOR
6218+
LogsExcludeAttributeProcessor:
6219+
description: |-
6220+
Use this processor to remove an attribute from a log during processing.
6221+
The processor strips the specified attribute from the log event, which is useful
6222+
when the attribute contains sensitive data or is no longer needed downstream.
6223+
properties:
6224+
attribute_to_exclude:
6225+
description: Name of the log attribute to remove from the log event.
6226+
example: foo
6227+
type: string
6228+
is_enabled:
6229+
default: false
6230+
description: Whether or not the processor is enabled.
6231+
type: boolean
6232+
name:
6233+
description: Name of the processor.
6234+
type: string
6235+
type:
6236+
$ref: "#/components/schemas/LogsExcludeAttributeProcessorType"
6237+
required:
6238+
- type
6239+
- attribute_to_exclude
6240+
type: object
6241+
LogsExcludeAttributeProcessorType:
6242+
default: exclude-attribute
6243+
description: Type of logs exclude attribute processor.
6244+
enum:
6245+
- exclude-attribute
6246+
example: exclude-attribute
6247+
type: string
6248+
x-enum-varnames:
6249+
- EXCLUDE_ATTRIBUTE
62186250
LogsExclusion:
62196251
description: Represents the index exclusion filter object from configuration API.
62206252
properties:
@@ -6822,6 +6854,7 @@ components:
68226854
- $ref: "#/components/schemas/LogsArrayProcessor"
68236855
- $ref: "#/components/schemas/LogsDecoderProcessor"
68246856
- $ref: "#/components/schemas/LogsSchemaProcessor"
6857+
- $ref: "#/components/schemas/LogsExcludeAttributeProcessor"
68256858
LogsQueryCompute:
68266859
description: Define computation for a log query.
68276860
properties:

src/datadogV1/model/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,10 @@ pub mod model_logs_schema_data;
12101210
pub use self::model_logs_schema_data::LogsSchemaData;
12111211
pub mod model_logs_schema_processor_type;
12121212
pub use self::model_logs_schema_processor_type::LogsSchemaProcessorType;
1213+
pub mod model_logs_exclude_attribute_processor;
1214+
pub use self::model_logs_exclude_attribute_processor::LogsExcludeAttributeProcessor;
1215+
pub mod model_logs_exclude_attribute_processor_type;
1216+
pub use self::model_logs_exclude_attribute_processor_type::LogsExcludeAttributeProcessorType;
12131217
pub mod model_logs_processor;
12141218
pub use self::model_logs_processor::LogsProcessor;
12151219
pub mod model_logs_pipeline_processor_type;
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
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+
/// Use this processor to remove an attribute from a log during processing.
10+
/// The processor strips the specified attribute from the log event, which is useful
11+
/// when the attribute contains sensitive data or is no longer needed downstream.
12+
#[non_exhaustive]
13+
#[skip_serializing_none]
14+
#[derive(Clone, Debug, PartialEq, Serialize)]
15+
pub struct LogsExcludeAttributeProcessor {
16+
/// Name of the log attribute to remove from the log event.
17+
#[serde(rename = "attribute_to_exclude")]
18+
pub attribute_to_exclude: String,
19+
/// Whether or not the processor is enabled.
20+
#[serde(rename = "is_enabled")]
21+
pub is_enabled: Option<bool>,
22+
/// Name of the processor.
23+
#[serde(rename = "name")]
24+
pub name: Option<String>,
25+
/// Type of logs exclude attribute processor.
26+
#[serde(rename = "type")]
27+
pub type_: crate::datadogV1::model::LogsExcludeAttributeProcessorType,
28+
#[serde(flatten)]
29+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
30+
#[serde(skip)]
31+
#[serde(default)]
32+
pub(crate) _unparsed: bool,
33+
}
34+
35+
impl LogsExcludeAttributeProcessor {
36+
pub fn new(
37+
attribute_to_exclude: String,
38+
type_: crate::datadogV1::model::LogsExcludeAttributeProcessorType,
39+
) -> LogsExcludeAttributeProcessor {
40+
LogsExcludeAttributeProcessor {
41+
attribute_to_exclude,
42+
is_enabled: None,
43+
name: None,
44+
type_,
45+
additional_properties: std::collections::BTreeMap::new(),
46+
_unparsed: false,
47+
}
48+
}
49+
50+
pub fn is_enabled(mut self, value: bool) -> Self {
51+
self.is_enabled = Some(value);
52+
self
53+
}
54+
55+
pub fn name(mut self, value: String) -> Self {
56+
self.name = Some(value);
57+
self
58+
}
59+
60+
pub fn additional_properties(
61+
mut self,
62+
value: std::collections::BTreeMap<String, serde_json::Value>,
63+
) -> Self {
64+
self.additional_properties = value;
65+
self
66+
}
67+
}
68+
69+
impl<'de> Deserialize<'de> for LogsExcludeAttributeProcessor {
70+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
71+
where
72+
D: Deserializer<'de>,
73+
{
74+
struct LogsExcludeAttributeProcessorVisitor;
75+
impl<'a> Visitor<'a> for LogsExcludeAttributeProcessorVisitor {
76+
type Value = LogsExcludeAttributeProcessor;
77+
78+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
79+
f.write_str("a mapping")
80+
}
81+
82+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
83+
where
84+
M: MapAccess<'a>,
85+
{
86+
let mut attribute_to_exclude: Option<String> = None;
87+
let mut is_enabled: Option<bool> = None;
88+
let mut name: Option<String> = None;
89+
let mut type_: Option<crate::datadogV1::model::LogsExcludeAttributeProcessorType> =
90+
None;
91+
let mut additional_properties: std::collections::BTreeMap<
92+
String,
93+
serde_json::Value,
94+
> = std::collections::BTreeMap::new();
95+
let mut _unparsed = false;
96+
97+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
98+
match k.as_str() {
99+
"attribute_to_exclude" => {
100+
attribute_to_exclude =
101+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
102+
}
103+
"is_enabled" => {
104+
if v.is_null() {
105+
continue;
106+
}
107+
is_enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
108+
}
109+
"name" => {
110+
if v.is_null() {
111+
continue;
112+
}
113+
name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
114+
}
115+
"type" => {
116+
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
117+
if let Some(ref _type_) = type_ {
118+
match _type_ {
119+
crate::datadogV1::model::LogsExcludeAttributeProcessorType::UnparsedObject(_type_) => {
120+
_unparsed = true;
121+
},
122+
_ => {}
123+
}
124+
}
125+
}
126+
&_ => {
127+
if let Ok(value) = serde_json::from_value(v.clone()) {
128+
additional_properties.insert(k, value);
129+
}
130+
}
131+
}
132+
}
133+
let attribute_to_exclude = attribute_to_exclude
134+
.ok_or_else(|| M::Error::missing_field("attribute_to_exclude"))?;
135+
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
136+
137+
let content = LogsExcludeAttributeProcessor {
138+
attribute_to_exclude,
139+
is_enabled,
140+
name,
141+
type_,
142+
additional_properties,
143+
_unparsed,
144+
};
145+
146+
Ok(content)
147+
}
148+
}
149+
150+
deserializer.deserialize_any(LogsExcludeAttributeProcessorVisitor)
151+
}
152+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
5+
use serde::{Deserialize, Deserializer, Serialize, Serializer};
6+
7+
#[non_exhaustive]
8+
#[derive(Clone, Debug, Eq, PartialEq)]
9+
pub enum LogsExcludeAttributeProcessorType {
10+
EXCLUDE_ATTRIBUTE,
11+
UnparsedObject(crate::datadog::UnparsedObject),
12+
}
13+
14+
impl ToString for LogsExcludeAttributeProcessorType {
15+
fn to_string(&self) -> String {
16+
match self {
17+
Self::EXCLUDE_ATTRIBUTE => String::from("exclude-attribute"),
18+
Self::UnparsedObject(v) => v.value.to_string(),
19+
}
20+
}
21+
}
22+
23+
impl Serialize for LogsExcludeAttributeProcessorType {
24+
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25+
where
26+
S: Serializer,
27+
{
28+
match self {
29+
Self::UnparsedObject(v) => v.serialize(serializer),
30+
_ => serializer.serialize_str(self.to_string().as_str()),
31+
}
32+
}
33+
}
34+
35+
impl<'de> Deserialize<'de> for LogsExcludeAttributeProcessorType {
36+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37+
where
38+
D: Deserializer<'de>,
39+
{
40+
let s: String = String::deserialize(deserializer)?;
41+
Ok(match s.as_str() {
42+
"exclude-attribute" => Self::EXCLUDE_ATTRIBUTE,
43+
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
44+
value: serde_json::Value::String(s.into()),
45+
}),
46+
})
47+
}
48+
}

src/datadogV1/model/model_logs_processor.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub enum LogsProcessor {
3030
LogsArrayProcessor(Box<crate::datadogV1::model::LogsArrayProcessor>),
3131
LogsDecoderProcessor(Box<crate::datadogV1::model::LogsDecoderProcessor>),
3232
LogsSchemaProcessor(Box<crate::datadogV1::model::LogsSchemaProcessor>),
33+
LogsExcludeAttributeProcessor(Box<crate::datadogV1::model::LogsExcludeAttributeProcessor>),
3334
UnparsedObject(crate::datadog::UnparsedObject),
3435
}
3536

@@ -182,6 +183,14 @@ impl<'de> Deserialize<'de> for LogsProcessor {
182183
return Ok(LogsProcessor::LogsSchemaProcessor(_v));
183184
}
184185
}
186+
if let Ok(_v) = serde_json::from_value::<
187+
Box<crate::datadogV1::model::LogsExcludeAttributeProcessor>,
188+
>(value.clone())
189+
{
190+
if !_v._unparsed {
191+
return Ok(LogsProcessor::LogsExcludeAttributeProcessor(_v));
192+
}
193+
}
185194

186195
return Ok(LogsProcessor::UnparsedObject(
187196
crate::datadog::UnparsedObject { value },

0 commit comments

Comments
 (0)