Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20219,6 +20219,13 @@ components:
$ref: '#/components/schemas/EventPayloadAttributes'
category:
$ref: '#/components/schemas/EventCategory'
host:
description: Host name to associate with the event. Any tags associated
with the host are also applied to this event. Limited to 255 characters.
example: hostname
maxLength: 255
minLength: 1
type: string
integration_id:
$ref: '#/components/schemas/EventPayloadIntegrationId'
message:
Expand Down Expand Up @@ -67608,6 +67615,7 @@ paths:
rule:
datacenter: devcycle.us1.prod
category: change
host: hostname
integration_id: custom-events
message: payment_processed feature flag has been enabled
tags:
Expand Down
1 change: 1 addition & 0 deletions examples/v2_events_CreateEvent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ async fn main() {
"payment_processed feature flag updated".to_string(),
)
.aggregation_key("aggregation_key_123".to_string())
.host("test-host".to_string())
.integration_id(EventPayloadIntegrationId::CUSTOM_EVENTS)
.message("payment_processed feature flag has been enabled".to_string())
.tags(vec!["env:api_client_test".to_string()]),
Expand Down
17 changes: 17 additions & 0 deletions src/datadogV2/model/model_event_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pub struct EventPayload {
/// Event category identifying the type of event.
#[serde(rename = "category")]
pub category: crate::datadogV2::model::EventCategory,
/// Host name to associate with the event. Any tags associated with the host are also applied to this event. Limited to 255 characters.
#[serde(rename = "host")]
pub host: Option<String>,
/// Integration ID sourced from integration manifests.
#[serde(rename = "integration_id")]
pub integration_id: Option<crate::datadogV2::model::EventPayloadIntegrationId>,
Expand Down Expand Up @@ -53,6 +56,7 @@ impl EventPayload {
aggregation_key: None,
attributes,
category,
host: None,
integration_id: None,
message: None,
tags: None,
Expand All @@ -67,6 +71,11 @@ impl EventPayload {
self
}

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

pub fn integration_id(
mut self,
value: crate::datadogV2::model::EventPayloadIntegrationId,
Expand Down Expand Up @@ -111,6 +120,7 @@ impl<'de> Deserialize<'de> for EventPayload {
let mut aggregation_key: Option<String> = None;
let mut attributes: Option<crate::datadogV2::model::EventPayloadAttributes> = None;
let mut category: Option<crate::datadogV2::model::EventCategory> = None;
let mut host: Option<String> = None;
let mut integration_id: Option<crate::datadogV2::model::EventPayloadIntegrationId> =
None;
let mut message: Option<String> = None;
Expand Down Expand Up @@ -152,6 +162,12 @@ impl<'de> Deserialize<'de> for EventPayload {
}
}
}
"host" => {
if v.is_null() {
continue;
}
host = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"integration_id" => {
if v.is_null() {
continue;
Expand Down Expand Up @@ -203,6 +219,7 @@ impl<'de> Deserialize<'de> for EventPayload {
aggregation_key,
attributes,
category,
host,
integration_id,
message,
tags,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-06-10T15:38:58.529Z
2025-12-10T21:31:06.468Z
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"request": {
"body": {
"string": "{\"data\":{\"attributes\":{\"aggregation_key\":\"aggregation_key_123\",\"attributes\":{\"author\":{\"name\":\"[email protected]\",\"type\":\"user\"},\"change_metadata\":{\"dd\":{\"team\":\"datadog_team\",\"user_email\":\"[email protected]\",\"user_id\":\"datadog_user_id\",\"user_name\":\"datadog_username\"},\"resource_link\":\"datadog.com/feature/fallback_payments_test\"},\"changed_resource\":{\"name\":\"fallback_payments_test\",\"type\":\"feature_flag\"},\"impacted_resources\":[{\"name\":\"payments_api\",\"type\":\"service\"}],\"new_value\":{\"enabled\":true,\"percentage\":\"50%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}},\"prev_value\":{\"enabled\":true,\"percentage\":\"10%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}}},\"category\":\"invalid\",\"integration_id\":\"custom-events\",\"message\":\"payment_processed feature flag has been enabled\",\"tags\":[\"env:api_client_test\"],\"title\":\"payment_processed feature flag updated\"},\"type\":\"event\"}}",
"string": "{\"data\":{\"attributes\":{\"aggregation_key\":\"aggregation_key_123\",\"attributes\":{\"author\":{\"name\":\"[email protected]\",\"type\":\"user\"},\"change_metadata\":{\"dd\":{\"team\":\"datadog_team\",\"user_email\":\"[email protected]\",\"user_id\":\"datadog_user_id\",\"user_name\":\"datadog_username\"},\"resource_link\":\"datadog.com/feature/fallback_payments_test\"},\"changed_resource\":{\"name\":\"fallback_payments_test\",\"type\":\"feature_flag\"},\"impacted_resources\":[{\"name\":\"payments_api\",\"type\":\"service\"}],\"new_value\":{\"enabled\":true,\"percentage\":\"50%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}},\"prev_value\":{\"enabled\":true,\"percentage\":\"10%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}}},\"category\":\"invalid\",\"host\":\"test-host\",\"integration_id\":\"custom-events\",\"message\":\"payment_processed feature flag has been enabled\",\"tags\":[\"env:api_client_test\"],\"title\":\"payment_processed feature flag updated\"},\"type\":\"event\"}}",
"encoding": null
},
"headers": {
Expand Down Expand Up @@ -32,7 +32,7 @@
"message": "Bad Request"
}
},
"recorded_at": "Tue, 10 Jun 2025 15:38:58 GMT"
"recorded_at": "Wed, 10 Dec 2025 21:31:06 GMT"
}
],
"recorded_with": "VCR 6.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-06-10T15:38:58.954Z
2025-12-10T21:30:25.683Z
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"request": {
"body": {
"string": "{\"data\":{\"attributes\":{\"aggregation_key\":\"aggregation_key_123\",\"attributes\":{\"author\":{\"name\":\"[email protected]\",\"type\":\"user\"},\"change_metadata\":{\"dd\":{\"team\":\"datadog_team\",\"user_email\":\"[email protected]\",\"user_id\":\"datadog_user_id\",\"user_name\":\"datadog_username\"},\"resource_link\":\"datadog.com/feature/fallback_payments_test\"},\"changed_resource\":{\"name\":\"fallback_payments_test\",\"type\":\"feature_flag\"},\"impacted_resources\":[{\"name\":\"payments_api\",\"type\":\"service\"}],\"new_value\":{\"enabled\":true,\"percentage\":\"50%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}},\"prev_value\":{\"enabled\":true,\"percentage\":\"10%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}}},\"category\":\"change\",\"integration_id\":\"custom-events\",\"message\":\"payment_processed feature flag has been enabled\",\"tags\":[\"env:api_client_test\"],\"title\":\"payment_processed feature flag updated\"},\"type\":\"event\"}}",
"string": "{\"data\":{\"attributes\":{\"aggregation_key\":\"aggregation_key_123\",\"attributes\":{\"author\":{\"name\":\"[email protected]\",\"type\":\"user\"},\"change_metadata\":{\"dd\":{\"team\":\"datadog_team\",\"user_email\":\"[email protected]\",\"user_id\":\"datadog_user_id\",\"user_name\":\"datadog_username\"},\"resource_link\":\"datadog.com/feature/fallback_payments_test\"},\"changed_resource\":{\"name\":\"fallback_payments_test\",\"type\":\"feature_flag\"},\"impacted_resources\":[{\"name\":\"payments_api\",\"type\":\"service\"}],\"new_value\":{\"enabled\":true,\"percentage\":\"50%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}},\"prev_value\":{\"enabled\":true,\"percentage\":\"10%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}}},\"category\":\"change\",\"host\":\"test-host\",\"integration_id\":\"custom-events\",\"message\":\"payment_processed feature flag has been enabled\",\"tags\":[\"env:api_client_test\"],\"title\":\"payment_processed feature flag updated\"},\"type\":\"event\"}}",
"encoding": null
},
"headers": {
Expand All @@ -19,7 +19,7 @@
},
"response": {
"body": {
"string": "{\"data\":{\"attributes\":{\"attributes\":{\"evt\":{\"uid\":\"AZdafqaTAACKG_iMQ82pmAAA\"}}},\"id\":\"_\",\"type\":\"event\"},\"links\":{\"self\":\"https://app.datadoghq.com/event/event?uid=AZdafqaTAACKG_iMQ82pmAAA\"}}",
"string": "{\"data\":{\"attributes\":{\"attributes\":{\"evt\":{\"id\":\"8407723285051133019\",\"uid\":\"AZsKLCxvAACrUQTfNDwMWwAA\"}}},\"id\":\"_\",\"type\":\"event\"},\"links\":{\"self\":\"https://app.datadoghq.com/event/event?uid=AZsKLCxvAACrUQTfNDwMWwAA\"}}",
"encoding": null
},
"headers": {
Expand All @@ -32,7 +32,7 @@
"message": "Accepted"
}
},
"recorded_at": "Tue, 10 Jun 2025 15:38:58 GMT"
"recorded_at": "Wed, 10 Dec 2025 21:30:25 GMT"
}
],
"recorded_with": "VCR 6.0.0"
Expand Down
4 changes: 2 additions & 2 deletions tests/scenarios/features/v2/events.feature
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ Feature: Events
@team:DataDog/event-management
Scenario: Post an event returns "Bad request" response
Given new "CreateEvent" request
And body with value {"data": {"attributes": {"aggregation_key": "aggregation_key_123", "attributes": {"author": {"name": "[email protected]", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "[email protected]", "user_id": "datadog_user_id", "user_name": "datadog_username"}, "resource_link": "datadog.com/feature/fallback_payments_test"}, "changed_resource": {"name": "fallback_payments_test", "type": "feature_flag"}, "impacted_resources": [{"name": "payments_api", "type": "service"}], "new_value": {"enabled": true, "percentage": "50%", "rule": {"datacenter": "devcycle.us1.prod"}}, "prev_value": {"enabled": true, "percentage": "10%", "rule": {"datacenter": "devcycle.us1.prod"}}}, "category": "invalid", "integration_id": "custom-events", "message": "payment_processed feature flag has been enabled", "tags": ["env:api_client_test"], "title": "payment_processed feature flag updated"}, "type": "event"}}
And body with value {"data": {"attributes": {"aggregation_key": "aggregation_key_123", "attributes": {"author": {"name": "[email protected]", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "[email protected]", "user_id": "datadog_user_id", "user_name": "datadog_username"}, "resource_link": "datadog.com/feature/fallback_payments_test"}, "changed_resource": {"name": "fallback_payments_test", "type": "feature_flag"}, "impacted_resources": [{"name": "payments_api", "type": "service"}], "new_value": {"enabled": true, "percentage": "50%", "rule": {"datacenter": "devcycle.us1.prod"}}, "prev_value": {"enabled": true, "percentage": "10%", "rule": {"datacenter": "devcycle.us1.prod"}}}, "category": "invalid", "integration_id": "custom-events", "host": "test-host", "message": "payment_processed feature flag has been enabled", "tags": ["env:api_client_test"], "title": "payment_processed feature flag updated"}, "type": "event"}}
When the request is sent
Then the response status is 400 Bad request

@skip-validation @team:DataDog/event-management
Scenario: Post an event returns "OK" response
Given new "CreateEvent" request
And body with value {"data": {"attributes": {"aggregation_key": "aggregation_key_123", "attributes": {"author": {"name": "[email protected]", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "[email protected]", "user_id": "datadog_user_id", "user_name": "datadog_username"}, "resource_link": "datadog.com/feature/fallback_payments_test"}, "changed_resource": {"name": "fallback_payments_test", "type": "feature_flag"}, "impacted_resources": [{"name": "payments_api", "type": "service"}], "new_value": {"enabled": true, "percentage": "50%", "rule": {"datacenter": "devcycle.us1.prod"}}, "prev_value": {"enabled": true, "percentage": "10%", "rule": {"datacenter": "devcycle.us1.prod"}}}, "category": "change", "integration_id": "custom-events", "message": "payment_processed feature flag has been enabled", "tags": ["env:api_client_test"], "title": "payment_processed feature flag updated"}, "type": "event"}}
And body with value {"data": {"attributes": {"aggregation_key": "aggregation_key_123", "attributes": {"author": {"name": "[email protected]", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "[email protected]", "user_id": "datadog_user_id", "user_name": "datadog_username"}, "resource_link": "datadog.com/feature/fallback_payments_test"}, "changed_resource": {"name": "fallback_payments_test", "type": "feature_flag"}, "impacted_resources": [{"name": "payments_api", "type": "service"}], "new_value": {"enabled": true, "percentage": "50%", "rule": {"datacenter": "devcycle.us1.prod"}}, "prev_value": {"enabled": true, "percentage": "10%", "rule": {"datacenter": "devcycle.us1.prod"}}}, "category": "change", "integration_id": "custom-events", "host": "test-host", "message": "payment_processed feature flag has been enabled", "tags": ["env:api_client_test"], "title": "payment_processed feature flag updated"}, "type": "event"}}
When the request is sent
Then the response status is 202 OK
And the response "data.type" is equal to "event"
Expand Down