diff --git a/.generated-info b/.generated-info index 1aabf0e6bb4e..577cad24547b 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "8001cbb", - "generated": "2025-08-13 20:28:25.331" + "spec_repo_commit": "d394b63", + "generated": "2025-08-14 13:59:05.137" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5ab5923ba83d..0bf5675ba15a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -7649,12 +7649,12 @@ components: description: The type of the changed resource. enum: - feature_flag - - configuration + - metric_configuration example: feature_flag type: string x-enum-varnames: - FEATURE_FLAG - - CONFIGURATION + - METRIC_CONFIGURATION ChangeEventAttributesImpactedResourcesItem: description: A uniquely identified resource. properties: @@ -7780,12 +7780,12 @@ components: description: The type of the resource that was changed. enum: - feature_flag - - configuration + - metric_configuration example: feature_flag type: string x-enum-varnames: - FEATURE_FLAG - - CONFIGURATION + - METRIC_CONFIGURATION ChangeEventCustomAttributesImpactedResourcesItems: additionalProperties: false description: Object representing a uniquely identified resource. diff --git a/examples/v2/events/CreateEvent_1017977945.ts b/examples/v2/events/CreateEvent_1017977945.ts new file mode 100644 index 000000000000..fa5eae85125b --- /dev/null +++ b/examples/v2/events/CreateEvent_1017977945.ts @@ -0,0 +1,63 @@ +/** + * Post an event with metric_configuration resource type returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.EventsApi(configuration); + +const params: v2.EventsApiCreateEventRequest = { + body: { + data: { + attributes: { + aggregationKey: "aggregation_key_123", + attributes: { + author: { + name: "example@datadog.com", + type: "user", + }, + changeMetadata: { + dd: "{'team': 'datadog_team', 'user_email': 'datadog@datadog.com', 'user_id': 'datadog_user_id', 'user_name': 'datadog_username'}", + resource_link: "datadog.com/metric/config_test", + }, + changedResource: { + name: "config_test", + type: "metric_configuration", + }, + impactedResources: [ + { + name: "system.cpu.usage", + type: "service", + }, + ], + newValue: { + aggregation: "avg", + tags: "['env:prod', 'service:web']", + unit: "percent", + }, + prevValue: { + aggregation: "sum", + tags: "['env:prod']", + unit: "percent", + }, + }, + category: "change", + integrationId: "custom-events", + message: "metric configuration has been updated", + tags: ["env:api_client_test"], + title: "metric configuration updated", + }, + type: "event", + }, + }, +}; + +apiInstance + .createEvent(params) + .then((data: v2.EventCreateResponsePayload) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/v2/events.feature b/features/v2/events.feature index 61d824ce1084..f89a1d53789a 100644 --- a/features/v2/events.feature +++ b/features/v2/events.feature @@ -87,6 +87,15 @@ Feature: Events And the response "data.type" is equal to "event" And the response "data.attributes.attributes.evt" has field "uid" + @skip-validation @team:DataDog/event-management + Scenario: Post an event with metric_configuration resource type 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/metric/config_test"}, "changed_resource": {"name": "config_test", "type": "metric_configuration"}, "impacted_resources": [{"name": "system.cpu.usage", "type": "service"}], "new_value": {"aggregation": "avg", "tags": ["env:prod", "service:web"], "unit": "percent"}, "prev_value": {"aggregation": "sum", "tags": ["env:prod"], "unit": "percent"}}, "category": "change", "integration_id": "custom-events", "message": "metric configuration has been updated", "tags": ["env:api_client_test"], "title": "metric configuration updated"}, "type": "event"}} + When the request is sent + Then the response status is 202 OK + And the response "data.type" is equal to "event" + And the response "data.attributes.attributes.evt" has field "uid" + @team:DataDog/event-management Scenario: Search events returns "Bad Request" response Given new "SearchEvents" request diff --git a/packages/datadog-api-client-v2/models/ChangeEventAttributesChangedResourceType.ts b/packages/datadog-api-client-v2/models/ChangeEventAttributesChangedResourceType.ts index e1dcadd5b616..032035b5e6d6 100644 --- a/packages/datadog-api-client-v2/models/ChangeEventAttributesChangedResourceType.ts +++ b/packages/datadog-api-client-v2/models/ChangeEventAttributesChangedResourceType.ts @@ -12,7 +12,7 @@ import { UnparsedObject } from "../../datadog-api-client-common/util"; export type ChangeEventAttributesChangedResourceType = | typeof FEATURE_FLAG - | typeof CONFIGURATION + | typeof METRIC_CONFIGURATION | UnparsedObject; export const FEATURE_FLAG = "feature_flag"; -export const CONFIGURATION = "configuration"; +export const METRIC_CONFIGURATION = "metric_configuration"; diff --git a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResourceType.ts b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResourceType.ts index 6153187149af..6ec657da4e49 100644 --- a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResourceType.ts +++ b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResourceType.ts @@ -12,7 +12,7 @@ import { UnparsedObject } from "../../datadog-api-client-common/util"; export type ChangeEventCustomAttributesChangedResourceType = | typeof FEATURE_FLAG - | typeof CONFIGURATION + | typeof METRIC_CONFIGURATION | UnparsedObject; export const FEATURE_FLAG = "feature_flag"; -export const CONFIGURATION = "configuration"; +export const METRIC_CONFIGURATION = "metric_configuration"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index 65e221db36e3..a2b1c780590a 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -2358,7 +2358,10 @@ const enumsMap: { [key: string]: any[] } = { CaseStatus: ["OPEN", "IN_PROGRESS", "CLOSED"], CaseType: ["STANDARD"], ChangeEventAttributesAuthorType: ["user", "system", "api", "automation"], - ChangeEventAttributesChangedResourceType: ["feature_flag", "configuration"], + ChangeEventAttributesChangedResourceType: [ + "feature_flag", + "metric_configuration", + ], ChangeEventAttributesImpactedResourcesItemType: ["service"], ChangeEventCustomAttributesAuthorType: [ "user", @@ -2368,7 +2371,7 @@ const enumsMap: { [key: string]: any[] } = { ], ChangeEventCustomAttributesChangedResourceType: [ "feature_flag", - "configuration", + "metric_configuration", ], ChangeEventCustomAttributesImpactedResourcesItemsType: ["service"], CircleCIAPIKeyType: ["CircleCIAPIKey"],