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
7 changes: 1 addition & 6 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37791,18 +37791,13 @@ components:
example: 10.0
format: double
type: number
rate:
description: Number of events to sample (1 in N).
example: 10
format: int64
minimum: 1
type: integer
type:
$ref: '#/components/schemas/ObservabilityPipelineSampleProcessorType'
required:
- id
- type
- include
- percentage
- enabled
type: object
ObservabilityPipelineSampleProcessorType:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ pub struct ObservabilityPipelineSampleProcessor {
pub include: String,
/// The percentage of logs to sample.
#[serde(rename = "percentage")]
pub percentage: Option<f64>,
/// Number of events to sample (1 in N).
#[serde(rename = "rate")]
pub rate: Option<i64>,
pub percentage: f64,
/// The processor type. The value should always be `sample`.
#[serde(rename = "type")]
pub type_: crate::datadogV2::model::ObservabilityPipelineSampleProcessorType,
Expand All @@ -44,15 +41,15 @@ impl ObservabilityPipelineSampleProcessor {
enabled: bool,
id: String,
include: String,
percentage: f64,
type_: crate::datadogV2::model::ObservabilityPipelineSampleProcessorType,
) -> ObservabilityPipelineSampleProcessor {
ObservabilityPipelineSampleProcessor {
display_name: None,
enabled,
id,
include,
percentage: None,
rate: None,
percentage,
type_,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
Expand All @@ -64,16 +61,6 @@ impl ObservabilityPipelineSampleProcessor {
self
}

pub fn percentage(mut self, value: f64) -> Self {
self.percentage = Some(value);
self
}

pub fn rate(mut self, value: i64) -> Self {
self.rate = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
Expand Down Expand Up @@ -105,7 +92,6 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineSampleProcessor {
let mut id: Option<String> = None;
let mut include: Option<String> = None;
let mut percentage: Option<f64> = None;
let mut rate: Option<i64> = None;
let mut type_: Option<
crate::datadogV2::model::ObservabilityPipelineSampleProcessorType,
> = None;
Expand Down Expand Up @@ -134,17 +120,8 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineSampleProcessor {
include = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"percentage" => {
if v.is_null() {
continue;
}
percentage = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"rate" => {
if v.is_null() {
continue;
}
rate = 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_ {
Expand All @@ -166,6 +143,7 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineSampleProcessor {
let enabled = enabled.ok_or_else(|| M::Error::missing_field("enabled"))?;
let id = id.ok_or_else(|| M::Error::missing_field("id"))?;
let include = include.ok_or_else(|| M::Error::missing_field("include"))?;
let percentage = percentage.ok_or_else(|| M::Error::missing_field("percentage"))?;
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;

let content = ObservabilityPipelineSampleProcessor {
Expand All @@ -174,7 +152,6 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineSampleProcessor {
id,
include,
percentage,
rate,
type_,
additional_properties,
_unparsed,
Expand Down