Skip to content

Commit 624be24

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add buffer support to remaining Observability Pipelines destinations (#1635)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 08abe4b commit 624be24

9 files changed

Lines changed: 273 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53206,6 +53206,8 @@ components:
5320653206
description: S3 bucket name.
5320753207
example: "my-bucket"
5320853208
type: string
53209+
buffer:
53210+
$ref: "#/components/schemas/ObservabilityPipelineBufferOptions"
5320953211
compression:
5321053212
$ref: "#/components/schemas/ObservabilityPipelineAmazonS3GenericCompression"
5321153213
encoding:
@@ -53455,6 +53457,8 @@ components:
5345553457

5345653458
**Supported pipeline types:** logs
5345753459
properties:
53460+
buffer:
53461+
$ref: "#/components/schemas/ObservabilityPipelineBufferOptions"
5345853462
endpoint_url_key:
5345953463
description: Name of the environment variable or secret that holds the CloudPrem endpoint URL.
5346053464
example: CLOUDPREM_ENDPOINT_URL
@@ -55105,6 +55109,8 @@ components:
5510555109
properties:
5510655110
auth_strategy:
5510755111
$ref: "#/components/schemas/ObservabilityPipelineHttpClientDestinationAuthStrategy"
55112+
buffer:
55113+
$ref: "#/components/schemas/ObservabilityPipelineBufferOptions"
5510855114
compression:
5510955115
$ref: "#/components/schemas/ObservabilityPipelineHttpClientDestinationCompression"
5511055116
custom_key:
@@ -55389,6 +55395,8 @@ components:
5538955395
description: Name of the environment variable or secret that holds the Kafka bootstrap servers list.
5539055396
example: KAFKA_BOOTSTRAP_SERVERS
5539155397
type: string
55398+
buffer:
55399+
$ref: "#/components/schemas/ObservabilityPipelineBufferOptions"
5539255400
compression:
5539355401
$ref: "#/components/schemas/ObservabilityPipelineKafkaDestinationCompression"
5539455402
encoding:
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// Validate an observability pipeline with cloud_prem destination buffer returns
2+
// "OK" response
3+
use datadog_api_client::datadog;
4+
use datadog_api_client::datadogV2::api_observability_pipelines::ObservabilityPipelinesAPI;
5+
use datadog_api_client::datadogV2::model::ObservabilityPipelineBufferOptions;
6+
use datadog_api_client::datadogV2::model::ObservabilityPipelineBufferOptionsDiskType;
7+
use datadog_api_client::datadogV2::model::ObservabilityPipelineBufferOptionsWhenFull;
8+
use datadog_api_client::datadogV2::model::ObservabilityPipelineCloudPremDestination;
9+
use datadog_api_client::datadogV2::model::ObservabilityPipelineCloudPremDestinationType;
10+
use datadog_api_client::datadogV2::model::ObservabilityPipelineConfig;
11+
use datadog_api_client::datadogV2::model::ObservabilityPipelineConfigDestinationItem;
12+
use datadog_api_client::datadogV2::model::ObservabilityPipelineConfigProcessorGroup;
13+
use datadog_api_client::datadogV2::model::ObservabilityPipelineConfigProcessorItem;
14+
use datadog_api_client::datadogV2::model::ObservabilityPipelineConfigSourceItem;
15+
use datadog_api_client::datadogV2::model::ObservabilityPipelineDataAttributes;
16+
use datadog_api_client::datadogV2::model::ObservabilityPipelineDatadogAgentSource;
17+
use datadog_api_client::datadogV2::model::ObservabilityPipelineDatadogAgentSourceType;
18+
use datadog_api_client::datadogV2::model::ObservabilityPipelineDiskBufferOptions;
19+
use datadog_api_client::datadogV2::model::ObservabilityPipelineFilterProcessor;
20+
use datadog_api_client::datadogV2::model::ObservabilityPipelineFilterProcessorType;
21+
use datadog_api_client::datadogV2::model::ObservabilityPipelineSpec;
22+
use datadog_api_client::datadogV2::model::ObservabilityPipelineSpecData;
23+
24+
#[tokio::main]
25+
async fn main() {
26+
let body =
27+
ObservabilityPipelineSpec::new(
28+
ObservabilityPipelineSpecData::new(
29+
ObservabilityPipelineDataAttributes::new(
30+
ObservabilityPipelineConfig::new(
31+
vec![
32+
ObservabilityPipelineConfigDestinationItem::ObservabilityPipelineCloudPremDestination(
33+
Box::new(
34+
ObservabilityPipelineCloudPremDestination::new(
35+
"cloud-prem-destination".to_string(),
36+
vec!["my-processor-group".to_string()],
37+
ObservabilityPipelineCloudPremDestinationType::CLOUD_PREM,
38+
)
39+
.buffer(
40+
ObservabilityPipelineBufferOptions::ObservabilityPipelineDiskBufferOptions(
41+
Box::new(
42+
ObservabilityPipelineDiskBufferOptions::new(1073741824)
43+
.type_(ObservabilityPipelineBufferOptionsDiskType::DISK)
44+
.when_full(ObservabilityPipelineBufferOptionsWhenFull::BLOCK),
45+
),
46+
),
47+
)
48+
.endpoint_url_key("CLOUDPREM_ENDPOINT_URL".to_string()),
49+
),
50+
)
51+
],
52+
vec![
53+
ObservabilityPipelineConfigSourceItem::ObservabilityPipelineDatadogAgentSource(
54+
Box::new(
55+
ObservabilityPipelineDatadogAgentSource::new(
56+
"datadog-agent-source".to_string(),
57+
ObservabilityPipelineDatadogAgentSourceType::DATADOG_AGENT,
58+
),
59+
),
60+
)
61+
],
62+
).processor_groups(
63+
vec![
64+
ObservabilityPipelineConfigProcessorGroup::new(
65+
true,
66+
"my-processor-group".to_string(),
67+
"service:my-service".to_string(),
68+
vec!["datadog-agent-source".to_string()],
69+
vec![
70+
ObservabilityPipelineConfigProcessorItem::ObservabilityPipelineFilterProcessor(
71+
Box::new(
72+
ObservabilityPipelineFilterProcessor::new(
73+
true,
74+
"filter-processor".to_string(),
75+
"status:error".to_string(),
76+
ObservabilityPipelineFilterProcessorType::FILTER,
77+
),
78+
),
79+
)
80+
],
81+
)
82+
],
83+
),
84+
"Pipeline with CloudPrem Buffer".to_string(),
85+
),
86+
"pipelines".to_string(),
87+
),
88+
);
89+
let configuration = datadog::Configuration::new();
90+
let api = ObservabilityPipelinesAPI::with_config(configuration);
91+
let resp = api.validate_pipeline(body).await;
92+
if let Ok(value) = resp {
93+
println!("{:#?}", value);
94+
} else {
95+
println!("{:#?}", resp.unwrap_err());
96+
}
97+
}

src/datadogV2/model/model_observability_pipeline_amazon_s3_generic_destination.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ pub struct ObservabilityPipelineAmazonS3GenericDestination {
2424
/// S3 bucket name.
2525
#[serde(rename = "bucket")]
2626
pub bucket: String,
27+
/// Configuration for buffer settings on destination components.
28+
#[serde(rename = "buffer")]
29+
pub buffer: Option<crate::datadogV2::model::ObservabilityPipelineBufferOptions>,
2730
/// Compression algorithm applied to encoded logs.
2831
#[serde(rename = "compression")]
2932
pub compression: crate::datadogV2::model::ObservabilityPipelineAmazonS3GenericCompression,
@@ -71,6 +74,7 @@ impl ObservabilityPipelineAmazonS3GenericDestination {
7174
auth: None,
7275
batch_settings: None,
7376
bucket,
77+
buffer: None,
7478
compression,
7579
encoding,
7680
id,
@@ -97,6 +101,14 @@ impl ObservabilityPipelineAmazonS3GenericDestination {
97101
self
98102
}
99103

104+
pub fn buffer(
105+
mut self,
106+
value: crate::datadogV2::model::ObservabilityPipelineBufferOptions,
107+
) -> Self {
108+
self.buffer = Some(value);
109+
self
110+
}
111+
100112
pub fn key_prefix(mut self, value: String) -> Self {
101113
self.key_prefix = Some(value);
102114
self
@@ -133,6 +145,9 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineAmazonS3GenericDestination {
133145
crate::datadogV2::model::ObservabilityPipelineAmazonS3GenericBatchSettings,
134146
> = None;
135147
let mut bucket: Option<String> = None;
148+
let mut buffer: Option<
149+
crate::datadogV2::model::ObservabilityPipelineBufferOptions,
150+
> = None;
136151
let mut compression: Option<
137152
crate::datadogV2::model::ObservabilityPipelineAmazonS3GenericCompression,
138153
> = None;
@@ -173,6 +188,20 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineAmazonS3GenericDestination {
173188
"bucket" => {
174189
bucket = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
175190
}
191+
"buffer" => {
192+
if v.is_null() {
193+
continue;
194+
}
195+
buffer = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
196+
if let Some(ref _buffer) = buffer {
197+
match _buffer {
198+
crate::datadogV2::model::ObservabilityPipelineBufferOptions::UnparsedObject(_buffer) => {
199+
_unparsed = true;
200+
},
201+
_ => {}
202+
}
203+
}
204+
}
176205
"compression" => {
177206
compression =
178207
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
@@ -256,6 +285,7 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineAmazonS3GenericDestination {
256285
auth,
257286
batch_settings,
258287
bucket,
288+
buffer,
259289
compression,
260290
encoding,
261291
id,

src/datadogV2/model/model_observability_pipeline_cloud_prem_destination.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ use std::fmt::{self, Formatter};
1313
#[skip_serializing_none]
1414
#[derive(Clone, Debug, PartialEq, Serialize)]
1515
pub struct ObservabilityPipelineCloudPremDestination {
16+
/// Configuration for buffer settings on destination components.
17+
#[serde(rename = "buffer")]
18+
pub buffer: Option<crate::datadogV2::model::ObservabilityPipelineBufferOptions>,
1619
/// Name of the environment variable or secret that holds the CloudPrem endpoint URL.
1720
#[serde(rename = "endpoint_url_key")]
1821
pub endpoint_url_key: Option<String>,
@@ -39,6 +42,7 @@ impl ObservabilityPipelineCloudPremDestination {
3942
type_: crate::datadogV2::model::ObservabilityPipelineCloudPremDestinationType,
4043
) -> ObservabilityPipelineCloudPremDestination {
4144
ObservabilityPipelineCloudPremDestination {
45+
buffer: None,
4246
endpoint_url_key: None,
4347
id,
4448
inputs,
@@ -48,6 +52,14 @@ impl ObservabilityPipelineCloudPremDestination {
4852
}
4953
}
5054

55+
pub fn buffer(
56+
mut self,
57+
value: crate::datadogV2::model::ObservabilityPipelineBufferOptions,
58+
) -> Self {
59+
self.buffer = Some(value);
60+
self
61+
}
62+
5163
pub fn endpoint_url_key(mut self, value: String) -> Self {
5264
self.endpoint_url_key = Some(value);
5365
self
@@ -79,6 +91,9 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineCloudPremDestination {
7991
where
8092
M: MapAccess<'a>,
8193
{
94+
let mut buffer: Option<
95+
crate::datadogV2::model::ObservabilityPipelineBufferOptions,
96+
> = None;
8297
let mut endpoint_url_key: Option<String> = None;
8398
let mut id: Option<String> = None;
8499
let mut inputs: Option<Vec<String>> = None;
@@ -93,6 +108,20 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineCloudPremDestination {
93108

94109
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
95110
match k.as_str() {
111+
"buffer" => {
112+
if v.is_null() {
113+
continue;
114+
}
115+
buffer = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
116+
if let Some(ref _buffer) = buffer {
117+
match _buffer {
118+
crate::datadogV2::model::ObservabilityPipelineBufferOptions::UnparsedObject(_buffer) => {
119+
_unparsed = true;
120+
},
121+
_ => {}
122+
}
123+
}
124+
}
96125
"endpoint_url_key" => {
97126
if v.is_null() {
98127
continue;
@@ -129,6 +158,7 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineCloudPremDestination {
129158
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
130159

131160
let content = ObservabilityPipelineCloudPremDestination {
161+
buffer,
132162
endpoint_url_key,
133163
id,
134164
inputs,

src/datadogV2/model/model_observability_pipeline_http_client_destination.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ pub struct ObservabilityPipelineHttpClientDestination {
1717
#[serde(rename = "auth_strategy")]
1818
pub auth_strategy:
1919
Option<crate::datadogV2::model::ObservabilityPipelineHttpClientDestinationAuthStrategy>,
20+
/// Configuration for buffer settings on destination components.
21+
#[serde(rename = "buffer")]
22+
pub buffer: Option<crate::datadogV2::model::ObservabilityPipelineBufferOptions>,
2023
/// Compression configuration for HTTP requests.
2124
#[serde(rename = "compression")]
2225
pub compression:
@@ -67,6 +70,7 @@ impl ObservabilityPipelineHttpClientDestination {
6770
) -> ObservabilityPipelineHttpClientDestination {
6871
ObservabilityPipelineHttpClientDestination {
6972
auth_strategy: None,
73+
buffer: None,
7074
compression: None,
7175
custom_key: None,
7276
encoding,
@@ -91,6 +95,14 @@ impl ObservabilityPipelineHttpClientDestination {
9195
self
9296
}
9397

98+
pub fn buffer(
99+
mut self,
100+
value: crate::datadogV2::model::ObservabilityPipelineBufferOptions,
101+
) -> Self {
102+
self.buffer = Some(value);
103+
self
104+
}
105+
94106
pub fn compression(
95107
mut self,
96108
value: crate::datadogV2::model::ObservabilityPipelineHttpClientDestinationCompression,
@@ -158,6 +170,9 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineHttpClientDestination {
158170
let mut auth_strategy: Option<
159171
crate::datadogV2::model::ObservabilityPipelineHttpClientDestinationAuthStrategy,
160172
> = None;
173+
let mut buffer: Option<
174+
crate::datadogV2::model::ObservabilityPipelineBufferOptions,
175+
> = None;
161176
let mut compression: Option<
162177
crate::datadogV2::model::ObservabilityPipelineHttpClientDestinationCompression,
163178
> = None;
@@ -198,6 +213,20 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineHttpClientDestination {
198213
}
199214
}
200215
}
216+
"buffer" => {
217+
if v.is_null() {
218+
continue;
219+
}
220+
buffer = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
221+
if let Some(ref _buffer) = buffer {
222+
match _buffer {
223+
crate::datadogV2::model::ObservabilityPipelineBufferOptions::UnparsedObject(_buffer) => {
224+
_unparsed = true;
225+
},
226+
_ => {}
227+
}
228+
}
229+
}
201230
"compression" => {
202231
if v.is_null() {
203232
continue;
@@ -285,6 +314,7 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineHttpClientDestination {
285314

286315
let content = ObservabilityPipelineHttpClientDestination {
287316
auth_strategy,
317+
buffer,
288318
compression,
289319
custom_key,
290320
encoding,

0 commit comments

Comments
 (0)