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.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
),
category=EventCategory.CHANGE,
integration_id=EventPayloadIntegrationId.CUSTOM_EVENTS,
host="test-host",
message="payment_processed feature flag has been enabled",
tags=[
"env:api_client_test",
Expand Down
12 changes: 12 additions & 0 deletions src/datadog_api_client/v2/model/event_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class EventPayload(ModelNormal):
"max_length": 100,
"min_length": 1,
},
"host": {
"max_length": 255,
"min_length": 1,
},
"message": {
"max_length": 4000,
"min_length": 1,
Expand Down Expand Up @@ -55,6 +59,7 @@ def openapi_types(_):
"aggregation_key": (str,),
"attributes": (EventPayloadAttributes,),
"category": (EventCategory,),
"host": (str,),
"integration_id": (EventPayloadIntegrationId,),
"message": (str,),
"tags": ([str],),
Expand All @@ -66,6 +71,7 @@ def openapi_types(_):
"aggregation_key": "aggregation_key",
"attributes": "attributes",
"category": "category",
"host": "host",
"integration_id": "integration_id",
"message": "message",
"tags": "tags",
Expand All @@ -79,6 +85,7 @@ def __init__(
category: EventCategory,
title: str,
aggregation_key: Union[str, UnsetType] = unset,
host: Union[str, UnsetType] = unset,
integration_id: Union[EventPayloadIntegrationId, UnsetType] = unset,
message: Union[str, UnsetType] = unset,
tags: Union[List[str], UnsetType] = unset,
Expand All @@ -97,6 +104,9 @@ def __init__(
:param category: Event category identifying the type of event.
:type category: EventCategory

:param host: Host name to associate with the event. Any tags associated with the host are also applied to this event. Limited to 255 characters.
:type host: str, optional

:param integration_id: Integration ID sourced from integration manifests.
:type integration_id: EventPayloadIntegrationId, optional

Expand All @@ -117,6 +127,8 @@ def __init__(
"""
if aggregation_key is not unset:
kwargs["aggregation_key"] = aggregation_key
if host is not unset:
kwargs["host"] = host
if integration_id is not unset:
kwargs["integration_id"] = integration_id
if message is not unset:
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
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"data":{"attributes":{"aggregation_key":"aggregation_key_123","attributes":{"author":{"name":"example@datadog.com","type":"user"},"change_metadata":{"dd":{"team":"datadog_team","user_email":"datadog@datadog.com","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
body: '{"data":{"attributes":{"aggregation_key":"aggregation_key_123","attributes":{"author":{"name":"example@datadog.com","type":"user"},"change_metadata":{"dd":{"team":"datadog_team","user_email":"datadog@datadog.com","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"}}'
headers:
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
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"data":{"attributes":{"aggregation_key":"aggregation_key_123","attributes":{"author":{"name":"example@datadog.com","type":"user"},"change_metadata":{"dd":{"team":"datadog_team","user_email":"datadog@datadog.com","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
body: '{"data":{"attributes":{"aggregation_key":"aggregation_key_123","attributes":{"author":{"name":"example@datadog.com","type":"user"},"change_metadata":{"dd":{"team":"datadog_team","user_email":"datadog@datadog.com","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"}}'
headers:
Expand All @@ -12,7 +12,7 @@ interactions:
uri: https://event-management-intake.datadoghq.com/api/v2/events
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"}}'
headers:
content-type:
- application/json
Expand Down
4 changes: 2 additions & 2 deletions tests/v2/features/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": "example@datadog.com", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "datadog@datadog.com", "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": "example@datadog.com", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "datadog@datadog.com", "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": "example@datadog.com", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "datadog@datadog.com", "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": "example@datadog.com", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "datadog@datadog.com", "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