Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29098,6 +29098,7 @@ components:
- $ref: '#/components/schemas/ObservabilityPipelineGooglePubSubSource'
- $ref: '#/components/schemas/ObservabilityPipelineHttpClientSource'
- $ref: '#/components/schemas/ObservabilityPipelineLogstashSource'
- $ref: '#/components/schemas/ObservabilityPipelineOpentelemetrySource'
- $ref: '#/components/schemas/ObservabilityPipelineSocketSource'
ObservabilityPipelineCrowdStrikeNextGenSiemDestination:
description: The `crowdstrike_next_gen_siem` destination forwards logs to CrowdStrike
Expand Down Expand Up @@ -30547,6 +30548,33 @@ components:
type: string
x-enum-varnames:
- OPENSEARCH
ObservabilityPipelineOpentelemetrySource:
description: The `opentelemetry` source receives OpenTelemetry data through
gRPC or HTTP.
properties:
id:
description: The unique identifier for this component. Used to reference
this component in other parts of the pipeline (e.g., as input to downstream
components).
example: opentelemetry-source
type: string
tls:
$ref: '#/components/schemas/ObservabilityPipelineTls'
type:
$ref: '#/components/schemas/ObservabilityPipelineOpentelemetrySourceType'
required:
- id
- type
type: object
ObservabilityPipelineOpentelemetrySourceType:
default: opentelemetry
description: The source type. The value should always be `opentelemetry`.
enum:
- opentelemetry
example: opentelemetry
type: string
x-enum-varnames:
- OPENTELEMETRY
ObservabilityPipelineParseGrokProcessor:
description: The `parse_grok` processor extracts structured fields from unstructured
log messages using Grok patterns.
Expand Down
4 changes: 4 additions & 0 deletions src/datadogV2/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4538,6 +4538,10 @@ pub mod model_observability_pipeline_logstash_source;
pub use self::model_observability_pipeline_logstash_source::ObservabilityPipelineLogstashSource;
pub mod model_observability_pipeline_logstash_source_type;
pub use self::model_observability_pipeline_logstash_source_type::ObservabilityPipelineLogstashSourceType;
pub mod model_observability_pipeline_opentelemetry_source;
pub use self::model_observability_pipeline_opentelemetry_source::ObservabilityPipelineOpentelemetrySource;
pub mod model_observability_pipeline_opentelemetry_source_type;
pub use self::model_observability_pipeline_opentelemetry_source_type::ObservabilityPipelineOpentelemetrySourceType;
pub mod model_observability_pipeline_socket_source;
pub use self::model_observability_pipeline_socket_source::ObservabilityPipelineSocketSource;
pub mod model_observability_pipeline_socket_source_framing_newline_delimited;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ pub enum ObservabilityPipelineConfigSourceItem {
ObservabilityPipelineLogstashSource(
Box<crate::datadogV2::model::ObservabilityPipelineLogstashSource>,
),
ObservabilityPipelineOpentelemetrySource(
Box<crate::datadogV2::model::ObservabilityPipelineOpentelemetrySource>,
),
ObservabilityPipelineSocketSource(
Box<crate::datadogV2::model::ObservabilityPipelineSocketSource>,
),
Expand Down Expand Up @@ -221,6 +224,18 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineConfigSourceItem {
);
}
}
if let Ok(_v) = serde_json::from_value::<
Box<crate::datadogV2::model::ObservabilityPipelineOpentelemetrySource>,
>(value.clone())
{
if !_v._unparsed {
return Ok(
ObservabilityPipelineConfigSourceItem::ObservabilityPipelineOpentelemetrySource(
_v,
),
);
}
}
if let Ok(_v) = serde_json::from_value::<
Box<crate::datadogV2::model::ObservabilityPipelineSocketSource>,
>(value.clone())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.
use serde::de::{Error, MapAccess, Visitor};
use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// The `opentelemetry` source receives OpenTelemetry data through gRPC or HTTP.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct ObservabilityPipelineOpentelemetrySource {
/// The unique identifier for this component. Used to reference this component in other parts of the pipeline (e.g., as input to downstream components).
#[serde(rename = "id")]
pub id: String,
/// Configuration for enabling TLS encryption between the pipeline component and external services.
#[serde(rename = "tls")]
pub tls: Option<crate::datadogV2::model::ObservabilityPipelineTls>,
/// The source type. The value should always be `opentelemetry`.
#[serde(rename = "type")]
pub type_: crate::datadogV2::model::ObservabilityPipelineOpentelemetrySourceType,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
}

impl ObservabilityPipelineOpentelemetrySource {
pub fn new(
id: String,
type_: crate::datadogV2::model::ObservabilityPipelineOpentelemetrySourceType,
) -> ObservabilityPipelineOpentelemetrySource {
ObservabilityPipelineOpentelemetrySource {
id,
tls: None,
type_,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}

pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineTls) -> Self {
self.tls = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
) -> Self {
self.additional_properties = value;
self
}
}

impl<'de> Deserialize<'de> for ObservabilityPipelineOpentelemetrySource {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct ObservabilityPipelineOpentelemetrySourceVisitor;
impl<'a> Visitor<'a> for ObservabilityPipelineOpentelemetrySourceVisitor {
type Value = ObservabilityPipelineOpentelemetrySource;

fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str("a mapping")
}

fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'a>,
{
let mut id: Option<String> = None;
let mut tls: Option<crate::datadogV2::model::ObservabilityPipelineTls> = None;
let mut type_: Option<
crate::datadogV2::model::ObservabilityPipelineOpentelemetrySourceType,
> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
> = std::collections::BTreeMap::new();
let mut _unparsed = false;

while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
match k.as_str() {
"id" => {
id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tls" => {
if v.is_null() {
continue;
}
tls = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"type" => {
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _type_) = type_ {
match _type_ {
crate::datadogV2::model::ObservabilityPipelineOpentelemetrySourceType::UnparsedObject(_type_) => {
_unparsed = true;
},
_ => {}
}
}
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
additional_properties.insert(k, value);
}
}
}
}
let id = id.ok_or_else(|| M::Error::missing_field("id"))?;
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;

let content = ObservabilityPipelineOpentelemetrySource {
id,
tls,
type_,
additional_properties,
_unparsed,
};

Ok(content)
}
}

deserializer.deserialize_any(ObservabilityPipelineOpentelemetrySourceVisitor)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[non_exhaustive]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ObservabilityPipelineOpentelemetrySourceType {
OPENTELEMETRY,
UnparsedObject(crate::datadog::UnparsedObject),
}

impl ToString for ObservabilityPipelineOpentelemetrySourceType {
fn to_string(&self) -> String {
match self {
Self::OPENTELEMETRY => String::from("opentelemetry"),
Self::UnparsedObject(v) => v.value.to_string(),
}
}
}

impl Serialize for ObservabilityPipelineOpentelemetrySourceType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
match self {
Self::UnparsedObject(v) => v.serialize(serializer),
_ => serializer.serialize_str(self.to_string().as_str()),
}
}
}

impl<'de> Deserialize<'de> for ObservabilityPipelineOpentelemetrySourceType {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let s: String = String::deserialize(deserializer)?;
Ok(match s.as_str() {
"opentelemetry" => Self::OPENTELEMETRY,
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
value: serde_json::Value::String(s.into()),
}),
})
}
}