Skip to content

Commit c1bd6db

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 6e3be67 of spec repo
1 parent 375c663 commit c1bd6db

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20219,6 +20219,13 @@ components:
2021920219
$ref: '#/components/schemas/EventPayloadAttributes'
2022020220
category:
2022120221
$ref: '#/components/schemas/EventCategory'
20222+
host:
20223+
description: Host name to associate with the event. Any tags associated
20224+
with the host are also applied to this event. Limited to 255 characters.
20225+
example: hostname
20226+
maxLength: 255
20227+
minLength: 1
20228+
type: string
2022220229
integration_id:
2022320230
$ref: '#/components/schemas/EventPayloadIntegrationId'
2022420231
message:
@@ -67608,6 +67615,7 @@ paths:
6760867615
rule:
6760967616
datacenter: devcycle.us1.prod
6761067617
category: change
67618+
host: hostname
6761167619
integration_id: custom-events
6761267620
message: payment_processed feature flag has been enabled
6761367621
tags:
@@ -67654,6 +67662,7 @@ paths:
6765467662
- us3.datadoghq.com
6765567663
- us5.datadoghq.com
6765667664
- ap1.datadoghq.com
67665+
- ap2.datadoghq.com
6765767666
- datadoghq.eu
6765867667
- ddog-gov.com
6765967668
subdomain:

examples/v2_events_CreateEvent.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ async fn main() {
5454
"payment_processed feature flag updated".to_string(),
5555
)
5656
.aggregation_key("aggregation_key_123".to_string())
57+
.host("test-host".to_string())
5758
.integration_id(EventPayloadIntegrationId::CUSTOM_EVENTS)
5859
.message("payment_processed feature flag has been enabled".to_string())
5960
.tags(vec!["env:api_client_test".to_string()]),

src/datadog/configuration.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ lazy_static! {
580580
"us3.datadoghq.com".into(),
581581
"us5.datadoghq.com".into(),
582582
"ap1.datadoghq.com".into(),
583+
"ap2.datadoghq.com".into(),
583584
"datadoghq.eu".into(),
584585
"ddog-gov.com".into(),
585586
],

src/datadogV2/model/model_event_payload.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ pub struct EventPayload {
2020
/// Event category identifying the type of event.
2121
#[serde(rename = "category")]
2222
pub category: crate::datadogV2::model::EventCategory,
23+
/// Host name to associate with the event. Any tags associated with the host are also applied to this event. Limited to 255 characters.
24+
#[serde(rename = "host")]
25+
pub host: Option<String>,
2326
/// Integration ID sourced from integration manifests.
2427
#[serde(rename = "integration_id")]
2528
pub integration_id: Option<crate::datadogV2::model::EventPayloadIntegrationId>,
@@ -53,6 +56,7 @@ impl EventPayload {
5356
aggregation_key: None,
5457
attributes,
5558
category,
59+
host: None,
5660
integration_id: None,
5761
message: None,
5862
tags: None,
@@ -67,6 +71,11 @@ impl EventPayload {
6771
self
6872
}
6973

74+
pub fn host(mut self, value: String) -> Self {
75+
self.host = Some(value);
76+
self
77+
}
78+
7079
pub fn integration_id(
7180
mut self,
7281
value: crate::datadogV2::model::EventPayloadIntegrationId,
@@ -111,6 +120,7 @@ impl<'de> Deserialize<'de> for EventPayload {
111120
let mut aggregation_key: Option<String> = None;
112121
let mut attributes: Option<crate::datadogV2::model::EventPayloadAttributes> = None;
113122
let mut category: Option<crate::datadogV2::model::EventCategory> = None;
123+
let mut host: Option<String> = None;
114124
let mut integration_id: Option<crate::datadogV2::model::EventPayloadIntegrationId> =
115125
None;
116126
let mut message: Option<String> = None;
@@ -152,6 +162,12 @@ impl<'de> Deserialize<'de> for EventPayload {
152162
}
153163
}
154164
}
165+
"host" => {
166+
if v.is_null() {
167+
continue;
168+
}
169+
host = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
170+
}
155171
"integration_id" => {
156172
if v.is_null() {
157173
continue;
@@ -203,6 +219,7 @@ impl<'de> Deserialize<'de> for EventPayload {
203219
aggregation_key,
204220
attributes,
205221
category,
222+
host,
206223
integration_id,
207224
message,
208225
tags,

tests/scenarios/features/v2/events.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ Feature: Events
7474
@team:DataDog/event-management
7575
Scenario: Post an event returns "Bad request" response
7676
Given new "CreateEvent" request
77-
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"}}
77+
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"}}
7878
When the request is sent
7979
Then the response status is 400 Bad request
8080

8181
@skip-validation @team:DataDog/event-management
8282
Scenario: Post an event returns "OK" response
8383
Given new "CreateEvent" request
84-
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"}}
84+
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"}}
8585
When the request is sent
8686
Then the response status is 202 OK
8787
And the response "data.type" is equal to "event"

0 commit comments

Comments
 (0)