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
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"spec_repo_commit": "98e3371",
"generated": "2025-08-27 08:50:12.332"
"spec_repo_commit": "2011bb0",
"generated": "2025-08-27 13:54:38.445"
}
12 changes: 12 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10662,6 +10662,11 @@ components:
CreateDataDeletionRequestBodyAttributes:
description: Attributes for creating a data deletion request.
properties:
displayed_total:
description: Total number of elements to be deleted according to the UI.
example: 25000
format: int64
type: integer
from:
description: Start of requested time window, milliseconds since Unix epoch.
example: 1672527600000
Expand Down Expand Up @@ -10694,6 +10699,7 @@ components:
- query
- from
- to
- displayed_total
type: object
CreateDataDeletionRequestBodyData:
description: Data needed to create a data deletion request.
Expand Down Expand Up @@ -12900,6 +12906,11 @@ components:
description: User who created the deletion request.
example: test.user@datadoghq.com
type: string
displayed_total:
description: Total number of elements to be deleted according to the UI.
example: 25000
format: int64
type: integer
from_time:
description: Start of requested time window, milliseconds since Unix epoch.
example: 1672527600000
Expand Down Expand Up @@ -12961,6 +12972,7 @@ components:
required:
- created_at
- created_by
- displayed_total
- from_time
- is_created
- org_id
Expand Down
1 change: 1 addition & 0 deletions examples/v2_data-deletion_CreateDataDeletionRequest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::collections::BTreeMap;
async fn main() {
let body = CreateDataDeletionRequestBody::new(CreateDataDeletionRequestBodyData::new(
CreateDataDeletionRequestBodyAttributes::new(
25000,
1672527600000,
BTreeMap::from([
("host".to_string(), "abc".to_string()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use std::fmt::{self, Formatter};
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CreateDataDeletionRequestBodyAttributes {
/// Total number of elements to be deleted according to the UI.
#[serde(rename = "displayed_total")]
pub displayed_total: i64,
/// Start of requested time window, milliseconds since Unix epoch.
#[serde(rename = "from")]
pub from: i64,
Expand All @@ -32,11 +35,13 @@ pub struct CreateDataDeletionRequestBodyAttributes {

impl CreateDataDeletionRequestBodyAttributes {
pub fn new(
displayed_total: i64,
from: i64,
query: std::collections::BTreeMap<String, String>,
to: i64,
) -> CreateDataDeletionRequestBodyAttributes {
CreateDataDeletionRequestBodyAttributes {
displayed_total,
from,
indexes: None,
query,
Expand Down Expand Up @@ -77,6 +82,7 @@ impl<'de> Deserialize<'de> for CreateDataDeletionRequestBodyAttributes {
where
M: MapAccess<'a>,
{
let mut displayed_total: Option<i64> = None;
let mut from: Option<i64> = None;
let mut indexes: Option<Vec<String>> = None;
let mut query: Option<std::collections::BTreeMap<String, String>> = None;
Expand All @@ -89,6 +95,10 @@ impl<'de> Deserialize<'de> for CreateDataDeletionRequestBodyAttributes {

while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
match k.as_str() {
"displayed_total" => {
displayed_total =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"from" => {
from = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
Expand All @@ -111,11 +121,14 @@ impl<'de> Deserialize<'de> for CreateDataDeletionRequestBodyAttributes {
}
}
}
let displayed_total =
displayed_total.ok_or_else(|| M::Error::missing_field("displayed_total"))?;
let from = from.ok_or_else(|| M::Error::missing_field("from"))?;
let query = query.ok_or_else(|| M::Error::missing_field("query"))?;
let to = to.ok_or_else(|| M::Error::missing_field("to"))?;

let content = CreateDataDeletionRequestBodyAttributes {
displayed_total,
from,
indexes,
query,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pub struct DataDeletionResponseItemAttributes {
/// User who created the deletion request.
#[serde(rename = "created_by")]
pub created_by: String,
/// Total number of elements to be deleted according to the UI.
#[serde(rename = "displayed_total")]
pub displayed_total: i64,
/// Start of requested time window, milliseconds since Unix epoch.
#[serde(rename = "from_time")]
pub from_time: i64,
Expand Down Expand Up @@ -61,6 +64,7 @@ impl DataDeletionResponseItemAttributes {
pub fn new(
created_at: String,
created_by: String,
displayed_total: i64,
from_time: i64,
is_created: bool,
org_id: i64,
Expand All @@ -75,6 +79,7 @@ impl DataDeletionResponseItemAttributes {
DataDeletionResponseItemAttributes {
created_at,
created_by,
displayed_total,
from_time,
indexes: None,
is_created,
Expand Down Expand Up @@ -124,6 +129,7 @@ impl<'de> Deserialize<'de> for DataDeletionResponseItemAttributes {
{
let mut created_at: Option<String> = None;
let mut created_by: Option<String> = None;
let mut displayed_total: Option<i64> = None;
let mut from_time: Option<i64> = None;
let mut indexes: Option<Vec<String>> = None;
let mut is_created: Option<bool> = None;
Expand All @@ -149,6 +155,10 @@ impl<'de> Deserialize<'de> for DataDeletionResponseItemAttributes {
"created_by" => {
created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"displayed_total" => {
displayed_total =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"from_time" => {
from_time = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
Expand Down Expand Up @@ -196,6 +206,8 @@ impl<'de> Deserialize<'de> for DataDeletionResponseItemAttributes {
}
let created_at = created_at.ok_or_else(|| M::Error::missing_field("created_at"))?;
let created_by = created_by.ok_or_else(|| M::Error::missing_field("created_by"))?;
let displayed_total =
displayed_total.ok_or_else(|| M::Error::missing_field("displayed_total"))?;
let from_time = from_time.ok_or_else(|| M::Error::missing_field("from_time"))?;
let is_created = is_created.ok_or_else(|| M::Error::missing_field("is_created"))?;
let org_id = org_id.ok_or_else(|| M::Error::missing_field("org_id"))?;
Expand All @@ -212,6 +224,7 @@ impl<'de> Deserialize<'de> for DataDeletionResponseItemAttributes {
let content = DataDeletionResponseItemAttributes {
created_at,
created_by,
displayed_total,
from_time,
indexes,
is_created,
Expand Down
6 changes: 3 additions & 3 deletions tests/scenarios/features/v2/data_deletion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Feature: Data Deletion
Given operation "CreateDataDeletionRequest" enabled
And new "CreateDataDeletionRequest" request
And request contains "product" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"from": 1672527600000, "indexes": ["test-index", "test-index-2"], "query": {"host": "abc", "service": "xyz"}, "to": 1704063600000}, "type": "create_deletion_req"}}
And body with value {"data": {"attributes": {"displayed_total": 25000, "from": 1672527600000, "indexes": ["test-index", "test-index-2"], "query": {"host": "abc", "service": "xyz"}, "to": 1704063600000}, "type": "create_deletion_req"}}
When the request is sent
Then the response status is 400 Bad Request

Expand All @@ -52,7 +52,7 @@ Feature: Data Deletion
Given operation "CreateDataDeletionRequest" enabled
And new "CreateDataDeletionRequest" request
And request contains "product" parameter with value "logs"
And body with value {"data": {"attributes": {"from": 1672527600000, "indexes": ["test-index", "test-index-2"], "query": {"host": "abc", "service": "xyz"}, "to": 1704063600000}, "type": "create_deletion_req"}}
And body with value {"data": {"attributes": {"displayed_total": 25000, "from": 1672527600000, "indexes": ["test-index", "test-index-2"], "query": {"host": "abc", "service": "xyz"}, "to": 1704063600000}, "type": "create_deletion_req"}}
When the request is sent
Then the response status is 200 OK
And the response "data.type" is equal to "deletion_request"
Expand All @@ -64,7 +64,7 @@ Feature: Data Deletion
Given operation "CreateDataDeletionRequest" enabled
And new "CreateDataDeletionRequest" request
And request contains "product" parameter with value "logs"
And body with value {"data": {"attributes": {"from": 1672527600000, "indexes": ["test-index", "test-index-2"], "query": {}, "to": 1704063600000}, "type": "create_deletion_req"}}
And body with value {"data": {"attributes": {"displayed_total": 25000, "from": 1672527600000, "indexes": ["test-index", "test-index-2"], "query": {}, "to": 1704063600000}, "type": "create_deletion_req"}}
When the request is sent
Then the response status is 412 Precondition failed error

Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/features/v2/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
},
{
"name": "body",
"value": "{\n \"data\": {\n \"attributes\": {\n \"from\": 1672527600000,\n \"to\": 1704063600000,\n \"indexes\": [\"test-index\", \"test-index-2\"],\n \"query\": {\"host\": \"abc\", \"service\": \"xyz\"}\n },\n \"type\": \"create_deletion_req\"\n }\n}"
"value": "{\n \"data\": {\n \"attributes\": {\n \"displayed_total\": 25000,\n \"from\": 1672527600000,\n \"to\": 1704063600000,\n \"indexes\": [\"test-index\", \"test-index-2\"],\n \"query\": {\"host\": \"abc\", \"service\": \"xyz\"}\n },\n \"type\": \"create_deletion_req\"\n }\n}"
}
],
"step": "there is a valid \"deletion_request\" in the system",
Expand Down
Loading