Skip to content

Commit 3c19782

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add TLS support and server_name SNI option to Observability Pipelines client components (#1866)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent e110341 commit 3c19782

8 files changed

Lines changed: 210 additions & 20 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67238,6 +67238,32 @@ components:
6723867238
type: string
6723967239
x-enum-varnames:
6724067240
- CLICKHOUSE
67241+
ObservabilityPipelineClientTls:
67242+
description: Configuration for enabling TLS encryption between the pipeline component and external services.
67243+
properties:
67244+
ca_file:
67245+
description: Path to the Certificate Authority (CA) file used to validate the server’s TLS certificate.
67246+
type: string
67247+
crt_file:
67248+
description: Path to the TLS client certificate file used to authenticate the pipeline component with upstream or downstream services.
67249+
example: "/path/to/cert.crt"
67250+
type: string
67251+
key_file:
67252+
description: Path to the private key file associated with the TLS client certificate. Used for mutual TLS authentication.
67253+
type: string
67254+
key_pass_key:
67255+
description: Name of the environment variable or secret that holds the passphrase for the private key file.
67256+
example: TLS_KEY_PASSPHRASE
67257+
type: string
67258+
server_name:
67259+
description: Server name to use for Server Name Indication (SNI) and to verify against the certificate presented by the remote host. Use this when the address you connect to doesn't match the certificate's Common Name or Subject Alternative Name.
67260+
example: server.example.com
67261+
maxLength: 253
67262+
minLength: 1
67263+
type: string
67264+
required:
67265+
- crt_file
67266+
type: object
6724167267
ObservabilityPipelineCloudPremDestination:
6724267268
description: |-
6724367269
The `cloud_prem` destination sends logs to Datadog CloudPrem.
@@ -67262,7 +67288,7 @@ components:
6726267288
type: string
6726367289
type: array
6726467290
tls:
67265-
$ref: "#/components/schemas/ObservabilityPipelineTls"
67291+
$ref: "#/components/schemas/ObservabilityPipelineClientTls"
6726667292
description: Configuration for TLS encryption.
6726767293
type:
6726867294
$ref: "#/components/schemas/ObservabilityPipelineCloudPremDestinationType"
@@ -68977,7 +69003,7 @@ components:
6897769003
example: HTTP_AUTH_PASSWORD
6897869004
type: string
6897969005
tls:
68980-
$ref: "#/components/schemas/ObservabilityPipelineTls"
69006+
$ref: "#/components/schemas/ObservabilityPipelineClientTls"
6898169007
token_key:
6898269008
description: Name of the environment variable or secret that holds the bearer token (used when `auth_strategy` is `bearer`).
6898369009
example: HTTP_AUTH_TOKEN
@@ -69075,7 +69101,7 @@ components:
6907569101
format: int64
6907669102
type: integer
6907769103
tls:
69078-
$ref: "#/components/schemas/ObservabilityPipelineTls"
69104+
$ref: "#/components/schemas/ObservabilityPipelineClientTls"
6907969105
token_key:
6908069106
description: Name of the environment variable or secret that holds the bearer token (used when `auth_strategy` is `bearer`).
6908169107
example: HTTP_AUTH_TOKEN
@@ -71158,7 +71184,7 @@ components:
7115871184
mode:
7115971185
$ref: "#/components/schemas/ObservabilityPipelineSocketDestinationMode"
7116071186
tls:
71161-
$ref: "#/components/schemas/ObservabilityPipelineTls"
71187+
$ref: "#/components/schemas/ObservabilityPipelineClientTls"
7116271188
description: TLS configuration. Relevant only when `mode` is `tcp`.
7116371189
type:
7116471190
$ref: "#/components/schemas/ObservabilityPipelineSocketDestinationType"
@@ -71890,7 +71916,7 @@ components:
7189071916
minimum: 0
7189171917
type: integer
7189271918
tls:
71893-
$ref: "#/components/schemas/ObservabilityPipelineTls"
71919+
$ref: "#/components/schemas/ObservabilityPipelineClientTls"
7189471920
type:
7189571921
$ref: "#/components/schemas/ObservabilityPipelineSyslogNgDestinationType"
7189671922
required:

src/datadogV2/model/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7338,6 +7338,8 @@ pub mod model_observability_pipeline_http_client_destination_compression_algorit
73387338
pub use self::model_observability_pipeline_http_client_destination_compression_algorithm::ObservabilityPipelineHttpClientDestinationCompressionAlgorithm;
73397339
pub mod model_observability_pipeline_http_client_destination_encoding;
73407340
pub use self::model_observability_pipeline_http_client_destination_encoding::ObservabilityPipelineHttpClientDestinationEncoding;
7341+
pub mod model_observability_pipeline_client_tls;
7342+
pub use self::model_observability_pipeline_client_tls::ObservabilityPipelineClientTls;
73417343
pub mod model_observability_pipeline_http_client_destination_type;
73427344
pub use self::model_observability_pipeline_http_client_destination_type::ObservabilityPipelineHttpClientDestinationType;
73437345
pub mod model_observability_pipeline_amazon_open_search_destination;
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
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+
/// Configuration for enabling TLS encryption between the pipeline component and external services.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct ObservabilityPipelineClientTls {
14+
/// Path to the Certificate Authority (CA) file used to validate the server’s TLS certificate.
15+
#[serde(rename = "ca_file")]
16+
pub ca_file: Option<String>,
17+
/// Path to the TLS client certificate file used to authenticate the pipeline component with upstream or downstream services.
18+
#[serde(rename = "crt_file")]
19+
pub crt_file: String,
20+
/// Path to the private key file associated with the TLS client certificate. Used for mutual TLS authentication.
21+
#[serde(rename = "key_file")]
22+
pub key_file: Option<String>,
23+
/// Name of the environment variable or secret that holds the passphrase for the private key file.
24+
#[serde(rename = "key_pass_key")]
25+
pub key_pass_key: Option<String>,
26+
/// Server name to use for Server Name Indication (SNI) and to verify against the certificate presented by the remote host. Use this when the address you connect to doesn't match the certificate's Common Name or Subject Alternative Name.
27+
#[serde(rename = "server_name")]
28+
pub server_name: Option<String>,
29+
#[serde(flatten)]
30+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
31+
#[serde(skip)]
32+
#[serde(default)]
33+
pub(crate) _unparsed: bool,
34+
}
35+
36+
impl ObservabilityPipelineClientTls {
37+
pub fn new(crt_file: String) -> ObservabilityPipelineClientTls {
38+
ObservabilityPipelineClientTls {
39+
ca_file: None,
40+
crt_file,
41+
key_file: None,
42+
key_pass_key: None,
43+
server_name: None,
44+
additional_properties: std::collections::BTreeMap::new(),
45+
_unparsed: false,
46+
}
47+
}
48+
49+
pub fn ca_file(mut self, value: String) -> Self {
50+
self.ca_file = Some(value);
51+
self
52+
}
53+
54+
pub fn key_file(mut self, value: String) -> Self {
55+
self.key_file = Some(value);
56+
self
57+
}
58+
59+
pub fn key_pass_key(mut self, value: String) -> Self {
60+
self.key_pass_key = Some(value);
61+
self
62+
}
63+
64+
pub fn server_name(mut self, value: String) -> Self {
65+
self.server_name = Some(value);
66+
self
67+
}
68+
69+
pub fn additional_properties(
70+
mut self,
71+
value: std::collections::BTreeMap<String, serde_json::Value>,
72+
) -> Self {
73+
self.additional_properties = value;
74+
self
75+
}
76+
}
77+
78+
impl<'de> Deserialize<'de> for ObservabilityPipelineClientTls {
79+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
80+
where
81+
D: Deserializer<'de>,
82+
{
83+
struct ObservabilityPipelineClientTlsVisitor;
84+
impl<'a> Visitor<'a> for ObservabilityPipelineClientTlsVisitor {
85+
type Value = ObservabilityPipelineClientTls;
86+
87+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
88+
f.write_str("a mapping")
89+
}
90+
91+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
92+
where
93+
M: MapAccess<'a>,
94+
{
95+
let mut ca_file: Option<String> = None;
96+
let mut crt_file: Option<String> = None;
97+
let mut key_file: Option<String> = None;
98+
let mut key_pass_key: Option<String> = None;
99+
let mut server_name: Option<String> = None;
100+
let mut additional_properties: std::collections::BTreeMap<
101+
String,
102+
serde_json::Value,
103+
> = std::collections::BTreeMap::new();
104+
let mut _unparsed = false;
105+
106+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
107+
match k.as_str() {
108+
"ca_file" => {
109+
if v.is_null() {
110+
continue;
111+
}
112+
ca_file = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
113+
}
114+
"crt_file" => {
115+
crt_file = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
116+
}
117+
"key_file" => {
118+
if v.is_null() {
119+
continue;
120+
}
121+
key_file = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
122+
}
123+
"key_pass_key" => {
124+
if v.is_null() {
125+
continue;
126+
}
127+
key_pass_key =
128+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
129+
}
130+
"server_name" => {
131+
if v.is_null() {
132+
continue;
133+
}
134+
server_name =
135+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
136+
}
137+
&_ => {
138+
if let Ok(value) = serde_json::from_value(v.clone()) {
139+
additional_properties.insert(k, value);
140+
}
141+
}
142+
}
143+
}
144+
let crt_file = crt_file.ok_or_else(|| M::Error::missing_field("crt_file"))?;
145+
146+
let content = ObservabilityPipelineClientTls {
147+
ca_file,
148+
crt_file,
149+
key_file,
150+
key_pass_key,
151+
server_name,
152+
additional_properties,
153+
_unparsed,
154+
};
155+
156+
Ok(content)
157+
}
158+
}
159+
160+
deserializer.deserialize_any(ObservabilityPipelineClientTlsVisitor)
161+
}
162+
}

src/datadogV2/model/model_observability_pipeline_cloud_prem_destination.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct ObservabilityPipelineCloudPremDestination {
2727
pub inputs: Vec<String>,
2828
/// Configuration for enabling TLS encryption between the pipeline component and external services.
2929
#[serde(rename = "tls")]
30-
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineTls>,
30+
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls>,
3131
/// The destination type. The value should always be `cloud_prem`.
3232
#[serde(rename = "type")]
3333
pub type_: crate::datadogV2::model::ObservabilityPipelineCloudPremDestinationType,
@@ -69,7 +69,7 @@ impl ObservabilityPipelineCloudPremDestination {
6969
self
7070
}
7171

72-
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineTls) -> Self {
72+
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineClientTls) -> Self {
7373
self.tls = Some(value);
7474
self
7575
}
@@ -106,7 +106,7 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineCloudPremDestination {
106106
let mut endpoint_url_key: Option<String> = None;
107107
let mut id: Option<String> = None;
108108
let mut inputs: Option<Vec<String>> = None;
109-
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineTls> = None;
109+
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls> = None;
110110
let mut type_: Option<
111111
crate::datadogV2::model::ObservabilityPipelineCloudPremDestinationType,
112112
> = None;

src/datadogV2/model/model_observability_pipeline_http_client_destination.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub struct ObservabilityPipelineHttpClientDestination {
4141
pub password_key: Option<String>,
4242
/// Configuration for enabling TLS encryption between the pipeline component and external services.
4343
#[serde(rename = "tls")]
44-
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineTls>,
44+
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls>,
4545
/// Name of the environment variable or secret that holds the bearer token (used when `auth_strategy` is `bearer`).
4646
#[serde(rename = "token_key")]
4747
pub token_key: Option<String>,
@@ -121,7 +121,7 @@ impl ObservabilityPipelineHttpClientDestination {
121121
self
122122
}
123123

124-
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineTls) -> Self {
124+
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineClientTls) -> Self {
125125
self.tls = Some(value);
126126
self
127127
}
@@ -183,7 +183,7 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineHttpClientDestination {
183183
let mut id: Option<String> = None;
184184
let mut inputs: Option<Vec<String>> = None;
185185
let mut password_key: Option<String> = None;
186-
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineTls> = None;
186+
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls> = None;
187187
let mut token_key: Option<String> = None;
188188
let mut type_: Option<
189189
crate::datadogV2::model::ObservabilityPipelineHttpClientDestinationType,

src/datadogV2/model/model_observability_pipeline_http_client_source.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct ObservabilityPipelineHttpClientSource {
4040
pub scrape_timeout_secs: Option<i64>,
4141
/// Configuration for enabling TLS encryption between the pipeline component and external services.
4242
#[serde(rename = "tls")]
43-
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineTls>,
43+
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls>,
4444
/// Name of the environment variable or secret that holds the bearer token (used when `auth_strategy` is `bearer`).
4545
#[serde(rename = "token_key")]
4646
pub token_key: Option<String>,
@@ -114,7 +114,7 @@ impl ObservabilityPipelineHttpClientSource {
114114
self
115115
}
116116

117-
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineTls) -> Self {
117+
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineClientTls) -> Self {
118118
self.tls = Some(value);
119119
self
120120
}
@@ -166,7 +166,7 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineHttpClientSource {
166166
let mut password_key: Option<String> = None;
167167
let mut scrape_interval_secs: Option<i64> = None;
168168
let mut scrape_timeout_secs: Option<i64> = None;
169-
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineTls> = None;
169+
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls> = None;
170170
let mut token_key: Option<String> = None;
171171
let mut type_: Option<
172172
crate::datadogV2::model::ObservabilityPipelineHttpClientSourceType,

src/datadogV2/model/model_observability_pipeline_socket_destination.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct ObservabilityPipelineSocketDestination {
3636
pub mode: crate::datadogV2::model::ObservabilityPipelineSocketDestinationMode,
3737
/// Configuration for enabling TLS encryption between the pipeline component and external services.
3838
#[serde(rename = "tls")]
39-
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineTls>,
39+
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls>,
4040
/// The destination type. The value should always be `socket`.
4141
#[serde(rename = "type")]
4242
pub type_: crate::datadogV2::model::ObservabilityPipelineSocketDestinationType,
@@ -84,7 +84,7 @@ impl ObservabilityPipelineSocketDestination {
8484
self
8585
}
8686

87-
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineTls) -> Self {
87+
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineClientTls) -> Self {
8888
self.tls = Some(value);
8989
self
9090
}
@@ -130,7 +130,7 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineSocketDestination {
130130
let mut mode: Option<
131131
crate::datadogV2::model::ObservabilityPipelineSocketDestinationMode,
132132
> = None;
133-
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineTls> = None;
133+
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls> = None;
134134
let mut type_: Option<
135135
crate::datadogV2::model::ObservabilityPipelineSocketDestinationType,
136136
> = None;

src/datadogV2/model/model_observability_pipeline_syslog_ng_destination.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub struct ObservabilityPipelineSyslogNgDestination {
3030
pub keepalive: Option<i64>,
3131
/// Configuration for enabling TLS encryption between the pipeline component and external services.
3232
#[serde(rename = "tls")]
33-
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineTls>,
33+
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls>,
3434
/// The destination type. The value should always be `syslog_ng`.
3535
#[serde(rename = "type")]
3636
pub type_: crate::datadogV2::model::ObservabilityPipelineSyslogNgDestinationType,
@@ -78,7 +78,7 @@ impl ObservabilityPipelineSyslogNgDestination {
7878
self
7979
}
8080

81-
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineTls) -> Self {
81+
pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineClientTls) -> Self {
8282
self.tls = Some(value);
8383
self
8484
}
@@ -116,7 +116,7 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineSyslogNgDestination {
116116
let mut id: Option<String> = None;
117117
let mut inputs: Option<Vec<String>> = None;
118118
let mut keepalive: Option<i64> = None;
119-
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineTls> = None;
119+
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineClientTls> = None;
120120
let mut type_: Option<
121121
crate::datadogV2::model::ObservabilityPipelineSyslogNgDestinationType,
122122
> = None;

0 commit comments

Comments
 (0)