Skip to content

Commit 1aeac7f

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit be8a611 of spec repo
1 parent 1fcd8e7 commit 1aeac7f

12 files changed

+552
-2
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "d93d991",
3-
"generated": "2025-07-15 09:36:57.148"
2+
"spec_repo_commit": "be8a611",
3+
"generated": "2025-07-16 13:04:39.643"
44
}

.generator/schemas/v1/openapi.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5547,6 +5547,72 @@ components:
55475547
type: string
55485548
x-enum-varnames:
55495549
- DATE_REMAPPER
5550+
LogsDecoderProcessor:
5551+
description: 'The decoder processor decodes any source attribute containing
5552+
a
5553+
5554+
base64/base16-encoded UTF-8/ASCII string to back to its original value, storing
5555+
the
5556+
5557+
result in a target attribute.'
5558+
properties:
5559+
binary_to_text_encoding:
5560+
$ref: '#/components/schemas/LogsDecoderProcessorBinaryToTextEncoding'
5561+
input_representation:
5562+
$ref: '#/components/schemas/LogsDecoderProcessorInputRepresentation'
5563+
is_enabled:
5564+
default: false
5565+
description: Whether or not the processor is enabled.
5566+
type: boolean
5567+
name:
5568+
description: Name of the processor.
5569+
type: string
5570+
source:
5571+
description: Name of the log attribute with the encoded data.
5572+
example: encoded_message
5573+
type: string
5574+
target:
5575+
description: Name of the log attribute that contains the decoded data..
5576+
example: decoded_message
5577+
type: string
5578+
type:
5579+
$ref: '#/components/schemas/LogsDecoderProcessorType'
5580+
required:
5581+
- source
5582+
- target
5583+
- binary_to_text_encoding
5584+
- input_representation
5585+
- type
5586+
type: object
5587+
LogsDecoderProcessorBinaryToTextEncoding:
5588+
description: The encoding used to represent the binary data.
5589+
enum:
5590+
- base64
5591+
- base16
5592+
example: base64
5593+
type: string
5594+
x-enum-varnames:
5595+
- BASE64
5596+
- BASE16
5597+
LogsDecoderProcessorInputRepresentation:
5598+
description: The original representation of input string.
5599+
enum:
5600+
- utf_8
5601+
- integer
5602+
example: utf_8
5603+
type: string
5604+
x-enum-varnames:
5605+
- UTF_8
5606+
- INTEGER
5607+
LogsDecoderProcessorType:
5608+
default: decoder-processor
5609+
description: Type of logs decoder processor.
5610+
enum:
5611+
- decoder-processor
5612+
example: decoder-processor
5613+
type: string
5614+
x-enum-varnames:
5615+
- DECODER_PROCESSOR
55505616
LogsExclusion:
55515617
description: Represents the index exclusion filter object from configuration
55525618
API.
@@ -6215,6 +6281,7 @@ components:
62156281
- $ref: '#/components/schemas/LogsTraceRemapper'
62166282
- $ref: '#/components/schemas/LogsSpanRemapper'
62176283
- $ref: '#/components/schemas/LogsArrayProcessor'
6284+
- $ref: '#/components/schemas/LogsDecoderProcessor'
62186285
LogsQueryCompute:
62196286
description: Define computation for a log query.
62206287
properties:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Create a pipeline with Decoder Processor returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV1::api_logs_pipelines::LogsPipelinesAPI;
4+
use datadog_api_client::datadogV1::model::LogsDecoderProcessor;
5+
use datadog_api_client::datadogV1::model::LogsDecoderProcessorBinaryToTextEncoding;
6+
use datadog_api_client::datadogV1::model::LogsDecoderProcessorInputRepresentation;
7+
use datadog_api_client::datadogV1::model::LogsDecoderProcessorType;
8+
use datadog_api_client::datadogV1::model::LogsFilter;
9+
use datadog_api_client::datadogV1::model::LogsPipeline;
10+
use datadog_api_client::datadogV1::model::LogsProcessor;
11+
12+
#[tokio::main]
13+
async fn main() {
14+
let body = LogsPipeline::new("testDecoderProcessor".to_string())
15+
.filter(LogsFilter::new().query("source:python".to_string()))
16+
.processors(vec![LogsProcessor::LogsDecoderProcessor(Box::new(
17+
LogsDecoderProcessor::new(
18+
LogsDecoderProcessorBinaryToTextEncoding::BASE16,
19+
LogsDecoderProcessorInputRepresentation::UTF_8,
20+
"encoded_message".to_string(),
21+
"decoded_message".to_string(),
22+
LogsDecoderProcessorType::DECODER_PROCESSOR,
23+
)
24+
.is_enabled(true)
25+
.name("test_decoder".to_string()),
26+
))])
27+
.tags(vec![]);
28+
let configuration = datadog::Configuration::new();
29+
let api = LogsPipelinesAPI::with_config(configuration);
30+
let resp = api.create_logs_pipeline(body).await;
31+
if let Ok(value) = resp {
32+
println!("{:#?}", value);
33+
} else {
34+
println!("{:#?}", resp.unwrap_err());
35+
}
36+
}

src/datadogV1/model/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,14 @@ pub mod model_logs_array_processor_operation;
930930
pub use self::model_logs_array_processor_operation::LogsArrayProcessorOperation;
931931
pub mod model_logs_array_processor_type;
932932
pub use self::model_logs_array_processor_type::LogsArrayProcessorType;
933+
pub mod model_logs_decoder_processor;
934+
pub use self::model_logs_decoder_processor::LogsDecoderProcessor;
935+
pub mod model_logs_decoder_processor_binary_to_text_encoding;
936+
pub use self::model_logs_decoder_processor_binary_to_text_encoding::LogsDecoderProcessorBinaryToTextEncoding;
937+
pub mod model_logs_decoder_processor_input_representation;
938+
pub use self::model_logs_decoder_processor_input_representation::LogsDecoderProcessorInputRepresentation;
939+
pub mod model_logs_decoder_processor_type;
940+
pub use self::model_logs_decoder_processor_type::LogsDecoderProcessorType;
933941
pub mod model_logs_processor;
934942
pub use self::model_logs_processor::LogsProcessor;
935943
pub mod model_logs_pipeline_processor_type;
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
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+
/// The decoder processor decodes any source attribute containing a
10+
/// base64/base16-encoded UTF-8/ASCII string to back to its original value, storing the
11+
/// result in a target attribute.
12+
#[non_exhaustive]
13+
#[skip_serializing_none]
14+
#[derive(Clone, Debug, PartialEq, Serialize)]
15+
pub struct LogsDecoderProcessor {
16+
/// The encoding used to represent the binary data.
17+
#[serde(rename = "binary_to_text_encoding")]
18+
pub binary_to_text_encoding: crate::datadogV1::model::LogsDecoderProcessorBinaryToTextEncoding,
19+
/// The original representation of input string.
20+
#[serde(rename = "input_representation")]
21+
pub input_representation: crate::datadogV1::model::LogsDecoderProcessorInputRepresentation,
22+
/// Whether or not the processor is enabled.
23+
#[serde(rename = "is_enabled")]
24+
pub is_enabled: Option<bool>,
25+
/// Name of the processor.
26+
#[serde(rename = "name")]
27+
pub name: Option<String>,
28+
/// Name of the log attribute with the encoded data.
29+
#[serde(rename = "source")]
30+
pub source: String,
31+
/// Name of the log attribute that contains the decoded data..
32+
#[serde(rename = "target")]
33+
pub target: String,
34+
/// Type of logs decoder processor.
35+
#[serde(rename = "type")]
36+
pub type_: crate::datadogV1::model::LogsDecoderProcessorType,
37+
#[serde(flatten)]
38+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
39+
#[serde(skip)]
40+
#[serde(default)]
41+
pub(crate) _unparsed: bool,
42+
}
43+
44+
impl LogsDecoderProcessor {
45+
pub fn new(
46+
binary_to_text_encoding: crate::datadogV1::model::LogsDecoderProcessorBinaryToTextEncoding,
47+
input_representation: crate::datadogV1::model::LogsDecoderProcessorInputRepresentation,
48+
source: String,
49+
target: String,
50+
type_: crate::datadogV1::model::LogsDecoderProcessorType,
51+
) -> LogsDecoderProcessor {
52+
LogsDecoderProcessor {
53+
binary_to_text_encoding,
54+
input_representation,
55+
is_enabled: None,
56+
name: None,
57+
source,
58+
target,
59+
type_,
60+
additional_properties: std::collections::BTreeMap::new(),
61+
_unparsed: false,
62+
}
63+
}
64+
65+
pub fn is_enabled(mut self, value: bool) -> Self {
66+
self.is_enabled = Some(value);
67+
self
68+
}
69+
70+
pub fn name(mut self, value: String) -> Self {
71+
self.name = Some(value);
72+
self
73+
}
74+
75+
pub fn additional_properties(
76+
mut self,
77+
value: std::collections::BTreeMap<String, serde_json::Value>,
78+
) -> Self {
79+
self.additional_properties = value;
80+
self
81+
}
82+
}
83+
84+
impl<'de> Deserialize<'de> for LogsDecoderProcessor {
85+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
86+
where
87+
D: Deserializer<'de>,
88+
{
89+
struct LogsDecoderProcessorVisitor;
90+
impl<'a> Visitor<'a> for LogsDecoderProcessorVisitor {
91+
type Value = LogsDecoderProcessor;
92+
93+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
94+
f.write_str("a mapping")
95+
}
96+
97+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
98+
where
99+
M: MapAccess<'a>,
100+
{
101+
let mut binary_to_text_encoding: Option<
102+
crate::datadogV1::model::LogsDecoderProcessorBinaryToTextEncoding,
103+
> = None;
104+
let mut input_representation: Option<
105+
crate::datadogV1::model::LogsDecoderProcessorInputRepresentation,
106+
> = None;
107+
let mut is_enabled: Option<bool> = None;
108+
let mut name: Option<String> = None;
109+
let mut source: Option<String> = None;
110+
let mut target: Option<String> = None;
111+
let mut type_: Option<crate::datadogV1::model::LogsDecoderProcessorType> = None;
112+
let mut additional_properties: std::collections::BTreeMap<
113+
String,
114+
serde_json::Value,
115+
> = std::collections::BTreeMap::new();
116+
let mut _unparsed = false;
117+
118+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
119+
match k.as_str() {
120+
"binary_to_text_encoding" => {
121+
binary_to_text_encoding =
122+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
123+
if let Some(ref _binary_to_text_encoding) = binary_to_text_encoding {
124+
match _binary_to_text_encoding {
125+
crate::datadogV1::model::LogsDecoderProcessorBinaryToTextEncoding::UnparsedObject(_binary_to_text_encoding) => {
126+
_unparsed = true;
127+
},
128+
_ => {}
129+
}
130+
}
131+
}
132+
"input_representation" => {
133+
input_representation =
134+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
135+
if let Some(ref _input_representation) = input_representation {
136+
match _input_representation {
137+
crate::datadogV1::model::LogsDecoderProcessorInputRepresentation::UnparsedObject(_input_representation) => {
138+
_unparsed = true;
139+
},
140+
_ => {}
141+
}
142+
}
143+
}
144+
"is_enabled" => {
145+
if v.is_null() {
146+
continue;
147+
}
148+
is_enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
149+
}
150+
"name" => {
151+
if v.is_null() {
152+
continue;
153+
}
154+
name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
155+
}
156+
"source" => {
157+
source = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
158+
}
159+
"target" => {
160+
target = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
161+
}
162+
"type" => {
163+
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
164+
if let Some(ref _type_) = type_ {
165+
match _type_ {
166+
crate::datadogV1::model::LogsDecoderProcessorType::UnparsedObject(_type_) => {
167+
_unparsed = true;
168+
},
169+
_ => {}
170+
}
171+
}
172+
}
173+
&_ => {
174+
if let Ok(value) = serde_json::from_value(v.clone()) {
175+
additional_properties.insert(k, value);
176+
}
177+
}
178+
}
179+
}
180+
let binary_to_text_encoding = binary_to_text_encoding
181+
.ok_or_else(|| M::Error::missing_field("binary_to_text_encoding"))?;
182+
let input_representation = input_representation
183+
.ok_or_else(|| M::Error::missing_field("input_representation"))?;
184+
let source = source.ok_or_else(|| M::Error::missing_field("source"))?;
185+
let target = target.ok_or_else(|| M::Error::missing_field("target"))?;
186+
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
187+
188+
let content = LogsDecoderProcessor {
189+
binary_to_text_encoding,
190+
input_representation,
191+
is_enabled,
192+
name,
193+
source,
194+
target,
195+
type_,
196+
additional_properties,
197+
_unparsed,
198+
};
199+
200+
Ok(content)
201+
}
202+
}
203+
204+
deserializer.deserialize_any(LogsDecoderProcessorVisitor)
205+
}
206+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 LogsDecoderProcessorBinaryToTextEncoding {
10+
BASE64,
11+
BASE16,
12+
UnparsedObject(crate::datadog::UnparsedObject),
13+
}
14+
15+
impl ToString for LogsDecoderProcessorBinaryToTextEncoding {
16+
fn to_string(&self) -> String {
17+
match self {
18+
Self::BASE64 => String::from("base64"),
19+
Self::BASE16 => String::from("base16"),
20+
Self::UnparsedObject(v) => v.value.to_string(),
21+
}
22+
}
23+
}
24+
25+
impl Serialize for LogsDecoderProcessorBinaryToTextEncoding {
26+
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27+
where
28+
S: Serializer,
29+
{
30+
match self {
31+
Self::UnparsedObject(v) => v.serialize(serializer),
32+
_ => serializer.serialize_str(self.to_string().as_str()),
33+
}
34+
}
35+
}
36+
37+
impl<'de> Deserialize<'de> for LogsDecoderProcessorBinaryToTextEncoding {
38+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39+
where
40+
D: Deserializer<'de>,
41+
{
42+
let s: String = String::deserialize(deserializer)?;
43+
Ok(match s.as_str() {
44+
"base64" => Self::BASE64,
45+
"base16" => Self::BASE16,
46+
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
47+
value: serde_json::Value::String(s.into()),
48+
}),
49+
})
50+
}
51+
}

0 commit comments

Comments
 (0)