From aa9750a231dcda8d5e78e05173a5eaaa5aa8db2a Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 16 Jun 2025 21:07:37 +0000 Subject: [PATCH] Regenerate client from commit e610193 of spec repo --- .generator/schemas/v2/openapi.yaml | 273 +++++++++++++++--- .../frozen.json | 1 + .../recording.har | 67 +++++ .../frozen.json | 1 + .../recording.har | 67 +++++ features/v2/events.feature | 12 +- features/v2/undo.json | 2 +- services/events/src/v2/EventsApi.ts | 44 ++- services/events/src/v2/index.ts | 7 + .../v2/models/AlertEventCustomAttributes.ts | 63 ++++ .../AlertEventCustomAttributesLinksItems.ts | 54 ++++ ...EventCustomAttributesLinksItemsCategory.ts | 13 + .../AlertEventCustomAttributesPriority.ts | 17 ++ .../AlertEventCustomAttributesStatus.ts | 13 + .../v2/models/ChangeEventCustomAttributes.ts | 24 +- .../ChangeEventCustomAttributesAuthor.ts | 14 +- ...ngeEventCustomAttributesChangedResource.ts | 16 +- ...ventCustomAttributesChangedResourceType.ts | 2 +- ...tCustomAttributesImpactedResourcesItems.ts | 16 +- ...tomAttributesImpactedResourcesItemsType.ts | 2 +- .../events/src/v2/models/EventCategory.ts | 5 +- .../src/v2/models/EventCreateRequest.ts | 8 +- .../v2/models/EventCreateRequestPayload.ts | 5 +- .../src/v2/models/EventCreateResponse.ts | 6 +- .../models/EventCreateResponseAttributes.ts | 4 +- ...EventCreateResponseAttributesAttributes.ts | 2 +- ...ntCreateResponseAttributesAttributesEvt.ts | 10 +- .../v2/models/EventCreateResponsePayload.ts | 13 +- .../models/EventCreateResponsePayloadLinks.ts | 44 +++ services/events/src/v2/models/EventPayload.ts | 31 +- .../src/v2/models/EventPayloadAttributes.ts | 4 +- .../v2/models/EventPayloadIntegrationId.ts | 7 + services/events/src/v2/models/TypingInfo.ts | 21 +- 33 files changed, 722 insertions(+), 146 deletions(-) create mode 100644 cassettes/v2/Events_3416228/Post-an-event-returns-Bad-request-response_947004866/frozen.json create mode 100644 cassettes/v2/Events_3416228/Post-an-event-returns-Bad-request-response_947004866/recording.har create mode 100644 cassettes/v2/Events_3416228/Post-an-event-returns-OK-response_1209415328/frozen.json create mode 100644 cassettes/v2/Events_3416228/Post-an-event-returns-OK-response_1209415328/recording.har create mode 100644 services/events/src/v2/models/AlertEventCustomAttributes.ts create mode 100644 services/events/src/v2/models/AlertEventCustomAttributesLinksItems.ts create mode 100644 services/events/src/v2/models/AlertEventCustomAttributesLinksItemsCategory.ts create mode 100644 services/events/src/v2/models/AlertEventCustomAttributesPriority.ts create mode 100644 services/events/src/v2/models/AlertEventCustomAttributesStatus.ts create mode 100644 services/events/src/v2/models/EventCreateResponsePayloadLinks.ts create mode 100644 services/events/src/v2/models/EventPayloadIntegrationId.ts diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4b5531c6026..c14444797cf 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2239,6 +2239,97 @@ components: - id - base_severity type: object + AlertEventCustomAttributes: + additionalProperties: false + description: Alert event attributes. + properties: + custom: + $ref: '#/components/schemas/AlertEventCustomAttributesCustom' + links: + $ref: '#/components/schemas/AlertEventCustomAttributesLinks' + priority: + $ref: '#/components/schemas/AlertEventCustomAttributesPriority' + status: + $ref: '#/components/schemas/AlertEventCustomAttributesStatus' + required: + - status + type: object + AlertEventCustomAttributesCustom: + additionalProperties: {} + description: Free form JSON object for arbitrary data. Supports up to 100 properties + per object and a maximum nesting depth of 10 levels. + example: {} + type: object + AlertEventCustomAttributesLinks: + description: The links related to the event. Maximum of 20 links allowed. + items: + $ref: '#/components/schemas/AlertEventCustomAttributesLinksItems' + maxItems: 20 + minItems: 1 + type: array + AlertEventCustomAttributesLinksItems: + additionalProperties: false + description: A link. + properties: + category: + $ref: '#/components/schemas/AlertEventCustomAttributesLinksItemsCategory' + title: + description: The display text of the link. Limited to 300 characters. + example: Runbook Link + maxLength: 300 + minLength: 1 + type: string + url: + description: The URL of the link. Limited to 2048 characters. + example: https://app.datadoghq.com/runbook + maxLength: 2048 + minLength: 1 + type: string + required: + - url + - category + type: object + AlertEventCustomAttributesLinksItemsCategory: + description: The category of the link. + enum: + - runbook + - documentation + - dashboard + example: runbook + type: string + x-enum-varnames: + - RUNBOOK + - DOCUMENTATION + - DASHBOARD + AlertEventCustomAttributesPriority: + default: '5' + description: The priority of the alert. + enum: + - '1' + - '2' + - '3' + - '4' + - '5' + example: '5' + type: string + x-enum-varnames: + - PRIORITY_ONE + - PRIORITY_TWO + - PRIORITY_THREE + - PRIORITY_FOUR + - PRIORITY_FIVE + AlertEventCustomAttributesStatus: + description: The status of the alert. + enum: + - warn + - error + - ok + example: warn + type: string + x-enum-varnames: + - WARN + - ERROR + - OK Annotation: description: A list of annotations used in the workflow. These are like sticky notes for your workflow! @@ -6967,14 +7058,16 @@ components: type: integer type: object ChangeEventCustomAttributes: - description: Object representing custom change event attributes. + additionalProperties: false + description: Change event attributes. properties: author: $ref: '#/components/schemas/ChangeEventCustomAttributesAuthor' change_metadata: additionalProperties: {} - description: Free form object with information related to the `change` event. - Can be arbitrarily nested and contain any valid JSON. + description: Free form JSON object with information related to the `change` + event. Supports up to 100 properties per object and a maximum nesting + depth of 10 levels. example: dd: team: datadog_team @@ -6990,16 +7083,18 @@ components: to provide an impacted resource to display the change event at the right location. Only resources of type `service` - are supported.' + are supported. Maximum of 100 impacted resources allowed.' example: - name: payments_api type: service items: $ref: '#/components/schemas/ChangeEventCustomAttributesImpactedResourcesItems' + maxItems: 100 type: array new_value: additionalProperties: {} - description: Free form object to track new value of the changed resource. + description: Free form JSON object representing new state of the changed + resource. example: enabled: true percentage: 50% @@ -7008,7 +7103,8 @@ components: type: object prev_value: additionalProperties: {} - description: Free form object to track previous value of the changed resource. + description: Free form JSON object representing the previous state of the + changed resource. example: enabled: true percentage: 10% @@ -7019,13 +7115,16 @@ components: - changed_resource type: object ChangeEventCustomAttributesAuthor: - description: Object representing the entity which made the change. Optional - field but if provided should include `type` and `name`. + additionalProperties: false + description: The entity that made the change. Optional, if provided it must + include `type` and `name`. properties: name: - description: Author's name. Limited to 128 characters. - example: datadog@datadog.com + description: The name of the user or system that made the change. Limited + to 128 characters. + example: example@datadog.com maxLength: 128 + minLength: 1 type: string type: $ref: '#/components/schemas/ChangeEventCustomAttributesAuthorType' @@ -7044,11 +7143,14 @@ components: - USER - SYSTEM ChangeEventCustomAttributesChangedResource: - description: Object representing a uniquely identified resource. + additionalProperties: false + description: A uniquely identified resource. properties: name: - description: Resource's name. + description: The name of the resource that was changed. Limited to 128 characters. example: fallback_payments_test + maxLength: 128 + minLength: 1 type: string type: $ref: '#/components/schemas/ChangeEventCustomAttributesChangedResourceType' @@ -7057,7 +7159,7 @@ components: - name type: object ChangeEventCustomAttributesChangedResourceType: - description: Resource's type. + description: The type of the resource that was changed. enum: - feature_flag - configuration @@ -7067,12 +7169,14 @@ components: - FEATURE_FLAG - CONFIGURATION ChangeEventCustomAttributesImpactedResourcesItems: - description: Object representing a uniquely identified resource. Only the resource - type `service` is supported. + additionalProperties: false + description: Object representing a uniquely identified resource. properties: name: - description: Resource's name. + description: The name of the impacted resource. Limited to 128 characters. example: payments_api + maxLength: 128 + minLength: 1 type: string type: $ref: '#/components/schemas/ChangeEventCustomAttributesImpactedResourcesItemsType' @@ -7081,7 +7185,7 @@ components: - name type: object ChangeEventCustomAttributesImpactedResourcesItemsType: - description: Resource's type. + description: The type of the impacted resource. enum: - service example: service @@ -14646,28 +14750,33 @@ components: type: string type: object EventCategory: - description: Event category to identify the type of event. Only the value `change` - is supported. Support for other categories are coming. please reach out to - datadog support if you're interested. + description: Event category identifying the type of event. enum: - change + - alert example: change type: string x-enum-varnames: - CHANGE + - ALERT EventCreateRequest: - description: Object representing an event creation request. + description: An event creation request. properties: attributes: $ref: '#/components/schemas/EventPayload' type: $ref: '#/components/schemas/EventCreateRequestType' + required: + - type + - attributes type: object EventCreateRequestPayload: description: Payload for creating an event. properties: data: $ref: '#/components/schemas/EventCreateRequest' + required: + - data type: object EventCreateRequestType: description: Entity type. @@ -14678,24 +14787,23 @@ components: x-enum-varnames: - EVENT EventCreateResponse: - description: Object containing an event response. + description: Event response. properties: attributes: $ref: '#/components/schemas/EventCreateResponseAttributes' type: - description: Event type + description: Entity type. example: event type: string type: object EventCreateResponseAttributes: - description: JSON object containing all events attributes and their associated - values. + description: JSON object containing event attributes and other associated attributes. properties: attributes: $ref: '#/components/schemas/EventCreateResponseAttributesAttributes' type: object EventCreateResponseAttributesAttributes: - description: JSON object of attributes from your events. + description: JSON object of event attributes. properties: evt: $ref: '#/components/schemas/EventCreateResponseAttributesAttributesEvt' @@ -14704,41 +14812,70 @@ components: description: JSON object of event system attributes. properties: id: - description: Event id + deprecated: true + description: Event identifier. This field is deprecated and will be removed + in a future version. Use the `uid` field instead. + type: string + uid: + description: A unique identifier for the event. You can use this identifier + to query or reference the event. type: string type: object EventCreateResponsePayload: - description: Response containing information about created event. + description: Create Event response. properties: data: $ref: '#/components/schemas/EventCreateResponse' + links: + $ref: '#/components/schemas/EventCreateResponsePayloadLinks' + type: object + EventCreateResponsePayloadLinks: + description: Links to the event. + properties: + self: + description: The URL of the event. This link is only functional when using + the default subdomain. + type: string type: object EventPayload: + additionalProperties: false description: Event attributes. properties: aggregation_key: - description: An arbitrary string to use for aggregation when correlating - events. Limited to 100 characters. + description: A string used for aggregation when [correlating](https://docs.datadoghq.com/service_management/events/correlation/) + events. If you specify a key, events are deduplicated to alerts based + on this key. Limited to 100 characters. + example: aggregation_key_123 maxLength: 100 + minLength: 1 type: string attributes: $ref: '#/components/schemas/EventPayloadAttributes' category: $ref: '#/components/schemas/EventCategory' + integration_id: + $ref: '#/components/schemas/EventPayloadIntegrationId' message: - description: The body of the event. Limited to 4000 characters. + description: Free formed text associated with the event. Suggest using `data.attributes.attributes.custom` + for well-structured attributes. Limited to 4000 characters. example: payment_processed feature flag has been enabled maxLength: 4000 + minLength: 1 type: string tags: - description: 'A list of tags to apply to the event. + description: 'A list of tags associated with the event. Maximum of 100 tags + allowed. Refer to [Tags docs](https://docs.datadoghq.com/getting_started/tagging/).' example: - - env:test + - env:api_client_test items: description: A tag. + maxLength: 200 + minLength: 1 type: string + maxItems: 100 + minItems: 1 type: array timestamp: description: 'Timestamp when the event occurred. Must follow [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) @@ -14750,9 +14887,10 @@ components: 18 hours.' type: string title: - description: The event title. Limited to 500 characters. + description: The title of the event. Limited to 500 characters. example: payment_processed feature flag updated maxLength: 500 + minLength: 1 type: string required: - title @@ -14760,10 +14898,19 @@ components: - attributes type: object EventPayloadAttributes: - description: JSON object for custom attributes. Schema are different per each - event category. + description: JSON object for category specific attributes. Schema is different + per event category. oneOf: - $ref: '#/components/schemas/ChangeEventCustomAttributes' + - $ref: '#/components/schemas/AlertEventCustomAttributes' + EventPayloadIntegrationId: + description: Integration ID sourced from integration manifests. + enum: + - custom-events + example: custom-events + type: string + x-enum-varnames: + - CUSTOM_EVENTS EventPriority: description: The priority of the event's monitor. For example, `normal` or `low`. enum: @@ -47894,10 +48041,15 @@ paths: x-undo: type: safe post: - description: "This endpoint allows you to post events.\n\n\u2705 **Only events - with the `change` category** are in General Availability. See [Change Tracking](https://docs.datadoghq.com/change_tracking) + description: "This endpoint allows you to publish events.\n\n\u2705 **Only events + with the `change` or `alert` category** are in General Availability. For change + events, see [Change Tracking](https://docs.datadoghq.com/change_tracking) for more details.\n\n\u274C For use cases involving other event categories, - please use the V1 endpoint." + use the V1 endpoint or reach out to [support](https://www.datadoghq.com/support/).\n\n\u274C + Notifications are not yet supported for events sent to this endpoint. Use + the V1 endpoint for notification functionality.\n\n\u274C This endpoint is + not available for the Government (US1-FED) site. Contact your account representative + for more information." operationId: CreateEvent requestBody: content: @@ -47907,9 +48059,10 @@ paths: value: data: attributes: + aggregation_key: aggregation_key_123 attributes: author: - name: datadog@datadog.com + name: example@datadog.com type: user change_metadata: dd: @@ -47935,9 +48088,11 @@ paths: rule: datacenter: devcycle.us1.prod category: change + integration_id: custom-events message: payment_processed feature flag has been enabled tags: - - env:test + - env:api_client_test + timestamp: '2020-01-01T01:30:15.010000Z' title: payment_processed feature flag updated type: event schema: @@ -47945,7 +48100,7 @@ paths: description: Event request object required: true responses: - '200': + '202': content: application/json: schema: @@ -47968,13 +48123,45 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] + servers: + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: The regional site for customers. + enum: + - datadoghq.com + - us3.datadoghq.com + - us5.datadoghq.com + - ap1.datadoghq.com + - datadoghq.eu + - ddog-gov.com + subdomain: + default: event-management-intake + description: The subdomain where the API is deployed. + - url: '{protocol}://{name}' + variables: + name: + default: event-management-intake.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: event-management-intake + description: The subdomain where the API is deployed. summary: Post an event tags: - Events x-codegen-request-body-name: body x-menu-order: 2 x-undo: - type: unsafe + type: safe x-merge-override: get: false post: false diff --git a/cassettes/v2/Events_3416228/Post-an-event-returns-Bad-request-response_947004866/frozen.json b/cassettes/v2/Events_3416228/Post-an-event-returns-Bad-request-response_947004866/frozen.json new file mode 100644 index 00000000000..0c178a65d42 --- /dev/null +++ b/cassettes/v2/Events_3416228/Post-an-event-returns-Bad-request-response_947004866/frozen.json @@ -0,0 +1 @@ +"2025-06-10T15:38:58.529Z" diff --git a/cassettes/v2/Events_3416228/Post-an-event-returns-Bad-request-response_947004866/recording.har b/cassettes/v2/Events_3416228/Post-an-event-returns-Bad-request-response_947004866/recording.har new file mode 100644 index 00000000000..05bf0de115c --- /dev/null +++ b/cassettes/v2/Events_3416228/Post-an-event-returns-Bad-request-response_947004866/recording.har @@ -0,0 +1,67 @@ +{ + "log": { + "_recordingName": "Events/Post an event returns \"Bad request\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "b35f8f8450dc70b83d7661b05817ff7e", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 867, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 592, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"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\"}}" + }, + "queryString": [], + "url": "https://event-management-intake.datadoghq.com/api/v2/events" + }, + "response": { + "bodySize": 163, + "content": { + "mimeType": "application/json", + "size": 163, + "text": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"JSON validation failed at $.data.attributes.category: value must be one of: [\\\"alert\\\", \\\"change\\\"].\"}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 323, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 400, + "statusText": "Bad Request" + }, + "startedDateTime": "2025-06-10T15:38:58.757Z", + "time": 189 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/Events_3416228/Post-an-event-returns-OK-response_1209415328/frozen.json b/cassettes/v2/Events_3416228/Post-an-event-returns-OK-response_1209415328/frozen.json new file mode 100644 index 00000000000..c504f55c1e8 --- /dev/null +++ b/cassettes/v2/Events_3416228/Post-an-event-returns-OK-response_1209415328/frozen.json @@ -0,0 +1 @@ +"2025-06-10T15:38:58.954Z" diff --git a/cassettes/v2/Events_3416228/Post-an-event-returns-OK-response_1209415328/recording.har b/cassettes/v2/Events_3416228/Post-an-event-returns-OK-response_1209415328/recording.har new file mode 100644 index 00000000000..62149e977bf --- /dev/null +++ b/cassettes/v2/Events_3416228/Post-an-event-returns-OK-response_1209415328/recording.har @@ -0,0 +1,67 @@ +{ + "log": { + "_recordingName": "Events/Post an event returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "12f2ce8ce9b919c06a471c2b7d261fb3", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 866, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 592, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"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\"}}" + }, + "queryString": [], + "url": "https://event-management-intake.datadoghq.com/api/v2/events" + }, + "response": { + "bodySize": 191, + "content": { + "mimeType": "application/json", + "size": 191, + "text": "{\"data\":{\"attributes\":{\"attributes\":{\"evt\":{\"uid\":\"AZdafqaTAACKG_iMQ82pmAAA\"}}},\"id\":\"_\",\"type\":\"event\"},\"links\":{\"self\":\"https://app.datadoghq.com/event/event?uid=AZdafqaTAACKG_iMQ82pmAAA\"}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 323, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 202, + "statusText": "Accepted" + }, + "startedDateTime": "2025-06-10T15:38:58.956Z", + "time": 212 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/features/v2/events.feature b/features/v2/events.feature index a8c1307ac68..0a69d195201 100644 --- a/features/v2/events.feature +++ b/features/v2/events.feature @@ -50,19 +50,21 @@ Feature: Events Then the response status is 200 OK And the response "data" has length 0 - @generated @skip @team:DataDog/event-management + @team:DataDog/event-management Scenario: Post an event returns "Bad request" response Given new "CreateEvent" request - And body with value {"data": {"attributes": {"attributes": {"author": {"name": "datadog@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", "message": "payment_processed feature flag has been enabled", "tags": ["env: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", "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 - @generated @skip @team:DataDog/event-management + @skip-validation @team:DataDog/event-management Scenario: Post an event returns "OK" response Given new "CreateEvent" request - And body with value {"data": {"attributes": {"attributes": {"author": {"name": "datadog@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", "message": "payment_processed feature flag has been enabled", "tags": ["env: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", "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 200 OK + 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 diff --git a/features/v2/undo.json b/features/v2/undo.json index 2d33b5cd716..d54e5403226 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -934,7 +934,7 @@ "CreateEvent": { "tag": "Events", "undo": { - "type": "unsafe" + "type": "safe" } }, "SearchEvents": { diff --git a/services/events/src/v2/EventsApi.ts b/services/events/src/v2/EventsApi.ts index 94343080855..80cca00283a 100644 --- a/services/events/src/v2/EventsApi.ts +++ b/services/events/src/v2/EventsApi.ts @@ -236,7 +236,7 @@ export class EventsApiResponseProcessor { response: ResponseContext, ): Promise { const contentType = normalizeMediaType(response.headers["content-type"]); - if (response.httpStatusCode === 200) { + if (response.httpStatusCode === 202) { const body: EventCreateResponsePayload = deserialize( parse(await response.body.text(), contentType), TypingInfo, @@ -476,7 +476,37 @@ export class EventsApi { private responseProcessor: EventsApiResponseProcessor; private configuration: Configuration; - static operationServers: { [key: string]: BaseServerConfiguration[] } = {}; + static operationServers: { [key: string]: BaseServerConfiguration[] } = { + "EventsApi.v2.createEvent": [ + new ServerConfiguration<{ + site: + | "datadoghq.com" + | "us3.datadoghq.com" + | "us5.datadoghq.com" + | "ap1.datadoghq.com" + | "datadoghq.eu" + | "ddog-gov.com"; + subdomain: string; + }>("https://{subdomain}.{site}", { + site: "datadoghq.com", + subdomain: "event-management-intake", + }), + new ServerConfiguration<{ + name: string; + protocol: string; + }>("{protocol}://{name}", { + name: "event-management-intake.datadoghq.com", + protocol: "https", + }), + new ServerConfiguration<{ + site: string; + subdomain: string; + }>("https://{subdomain}.{site}", { + site: "datadoghq.com", + subdomain: "event-management-intake", + }), + ], + }; public constructor( configuration?: Configuration, @@ -491,11 +521,15 @@ export class EventsApi { } /** - * This endpoint allows you to post events. + * This endpoint allows you to publish events. + * + * ✅ **Only events with the `change` or `alert` category** are in General Availability. For change events, see [Change Tracking](https://docs.datadoghq.com/change_tracking) for more details. + * + * ❌ For use cases involving other event categories, use the V1 endpoint or reach out to [support](https://www.datadoghq.com/support/). * - * ✅ **Only events with the `change` category** are in General Availability. See [Change Tracking](https://docs.datadoghq.com/change_tracking) for more details. + * ❌ Notifications are not yet supported for events sent to this endpoint. Use the V1 endpoint for notification functionality. * - * ❌ For use cases involving other event categories, please use the V1 endpoint. + * ❌ This endpoint is not available for the Government (US1-FED) site. Contact your account representative for more information. * @param param The request object */ public createEvent( diff --git a/services/events/src/v2/index.ts b/services/events/src/v2/index.ts index 3e07aa8739c..bfa9d0b761b 100644 --- a/services/events/src/v2/index.ts +++ b/services/events/src/v2/index.ts @@ -5,6 +5,11 @@ export { EventsApi, } from "./EventsApi"; +export { AlertEventCustomAttributes } from "./models/AlertEventCustomAttributes"; +export { AlertEventCustomAttributesLinksItems } from "./models/AlertEventCustomAttributesLinksItems"; +export { AlertEventCustomAttributesLinksItemsCategory } from "./models/AlertEventCustomAttributesLinksItemsCategory"; +export { AlertEventCustomAttributesPriority } from "./models/AlertEventCustomAttributesPriority"; +export { AlertEventCustomAttributesStatus } from "./models/AlertEventCustomAttributesStatus"; export { APIErrorResponse } from "./models/APIErrorResponse"; export { ChangeEventCustomAttributes } from "./models/ChangeEventCustomAttributes"; export { ChangeEventCustomAttributesAuthor } from "./models/ChangeEventCustomAttributesAuthor"; @@ -24,8 +29,10 @@ export { EventCreateResponseAttributes } from "./models/EventCreateResponseAttri export { EventCreateResponseAttributesAttributes } from "./models/EventCreateResponseAttributesAttributes"; export { EventCreateResponseAttributesAttributesEvt } from "./models/EventCreateResponseAttributesAttributesEvt"; export { EventCreateResponsePayload } from "./models/EventCreateResponsePayload"; +export { EventCreateResponsePayloadLinks } from "./models/EventCreateResponsePayloadLinks"; export { EventPayload } from "./models/EventPayload"; export { EventPayloadAttributes } from "./models/EventPayloadAttributes"; +export { EventPayloadIntegrationId } from "./models/EventPayloadIntegrationId"; export { EventPriority } from "./models/EventPriority"; export { EventResponse } from "./models/EventResponse"; export { EventResponseAttributes } from "./models/EventResponseAttributes"; diff --git a/services/events/src/v2/models/AlertEventCustomAttributes.ts b/services/events/src/v2/models/AlertEventCustomAttributes.ts new file mode 100644 index 00000000000..1563df68c8f --- /dev/null +++ b/services/events/src/v2/models/AlertEventCustomAttributes.ts @@ -0,0 +1,63 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { AlertEventCustomAttributesLinksItems } from "./AlertEventCustomAttributesLinksItems"; +import { AlertEventCustomAttributesPriority } from "./AlertEventCustomAttributesPriority"; +import { AlertEventCustomAttributesStatus } from "./AlertEventCustomAttributesStatus"; + +/** + * Alert event attributes. + */ +export class AlertEventCustomAttributes { + /** + * Free form JSON object for arbitrary data. Supports up to 100 properties per object and a maximum nesting depth of 10 levels. + */ + "custom"?: { [key: string]: any }; + /** + * The links related to the event. Maximum of 20 links allowed. + */ + "links"?: Array; + /** + * The priority of the alert. + */ + "priority"?: AlertEventCustomAttributesPriority; + /** + * The status of the alert. + */ + "status": AlertEventCustomAttributesStatus; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + custom: { + baseName: "custom", + type: "{ [key: string]: any; }", + }, + links: { + baseName: "links", + type: "Array", + }, + priority: { + baseName: "priority", + type: "AlertEventCustomAttributesPriority", + }, + status: { + baseName: "status", + type: "AlertEventCustomAttributesStatus", + required: true, + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AlertEventCustomAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/events/src/v2/models/AlertEventCustomAttributesLinksItems.ts b/services/events/src/v2/models/AlertEventCustomAttributesLinksItems.ts new file mode 100644 index 00000000000..88f53b80a26 --- /dev/null +++ b/services/events/src/v2/models/AlertEventCustomAttributesLinksItems.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { AlertEventCustomAttributesLinksItemsCategory } from "./AlertEventCustomAttributesLinksItemsCategory"; + +/** + * A link. + */ +export class AlertEventCustomAttributesLinksItems { + /** + * The category of the link. + */ + "category": AlertEventCustomAttributesLinksItemsCategory; + /** + * The display text of the link. Limited to 300 characters. + */ + "title"?: string; + /** + * The URL of the link. Limited to 2048 characters. + */ + "url": string; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + category: { + baseName: "category", + type: "AlertEventCustomAttributesLinksItemsCategory", + required: true, + }, + title: { + baseName: "title", + type: "string", + }, + url: { + baseName: "url", + type: "string", + required: true, + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AlertEventCustomAttributesLinksItems.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/events/src/v2/models/AlertEventCustomAttributesLinksItemsCategory.ts b/services/events/src/v2/models/AlertEventCustomAttributesLinksItemsCategory.ts new file mode 100644 index 00000000000..8e474060981 --- /dev/null +++ b/services/events/src/v2/models/AlertEventCustomAttributesLinksItemsCategory.ts @@ -0,0 +1,13 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The category of the link. + */ +export type AlertEventCustomAttributesLinksItemsCategory = + | typeof RUNBOOK + | typeof DOCUMENTATION + | typeof DASHBOARD + | UnparsedObject; +export const RUNBOOK = "runbook"; +export const DOCUMENTATION = "documentation"; +export const DASHBOARD = "dashboard"; diff --git a/services/events/src/v2/models/AlertEventCustomAttributesPriority.ts b/services/events/src/v2/models/AlertEventCustomAttributesPriority.ts new file mode 100644 index 00000000000..4834a72e11a --- /dev/null +++ b/services/events/src/v2/models/AlertEventCustomAttributesPriority.ts @@ -0,0 +1,17 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The priority of the alert. + */ +export type AlertEventCustomAttributesPriority = + | typeof PRIORITY_ONE + | typeof PRIORITY_TWO + | typeof PRIORITY_THREE + | typeof PRIORITY_FOUR + | typeof PRIORITY_FIVE + | UnparsedObject; +export const PRIORITY_ONE = "1"; +export const PRIORITY_TWO = "2"; +export const PRIORITY_THREE = "3"; +export const PRIORITY_FOUR = "4"; +export const PRIORITY_FIVE = "5"; diff --git a/services/events/src/v2/models/AlertEventCustomAttributesStatus.ts b/services/events/src/v2/models/AlertEventCustomAttributesStatus.ts new file mode 100644 index 00000000000..c9d37501861 --- /dev/null +++ b/services/events/src/v2/models/AlertEventCustomAttributesStatus.ts @@ -0,0 +1,13 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The status of the alert. + */ +export type AlertEventCustomAttributesStatus = + | typeof WARN + | typeof ERROR + | typeof OK + | UnparsedObject; +export const WARN = "warn"; +export const ERROR = "error"; +export const OK = "ok"; diff --git a/services/events/src/v2/models/ChangeEventCustomAttributes.ts b/services/events/src/v2/models/ChangeEventCustomAttributes.ts index 5f9ad0932af..27357fa1ccb 100644 --- a/services/events/src/v2/models/ChangeEventCustomAttributes.ts +++ b/services/events/src/v2/models/ChangeEventCustomAttributes.ts @@ -5,40 +5,34 @@ import { ChangeEventCustomAttributesChangedResource } from "./ChangeEventCustomA import { ChangeEventCustomAttributesImpactedResourcesItems } from "./ChangeEventCustomAttributesImpactedResourcesItems"; /** - * Object representing custom change event attributes. + * Change event attributes. */ export class ChangeEventCustomAttributes { /** - * Object representing the entity which made the change. Optional field but if provided should include `type` and `name`. + * The entity that made the change. Optional, if provided it must include `type` and `name`. */ "author"?: ChangeEventCustomAttributesAuthor; /** - * Free form object with information related to the `change` event. Can be arbitrarily nested and contain any valid JSON. + * Free form JSON object with information related to the `change` event. Supports up to 100 properties per object and a maximum nesting depth of 10 levels. */ "changeMetadata"?: { [key: string]: any }; /** - * Object representing a uniquely identified resource. + * A uniquely identified resource. */ "changedResource": ChangeEventCustomAttributesChangedResource; /** * A list of resources impacted by this change. It is recommended to provide an impacted resource to display - * the change event at the right location. Only resources of type `service` are supported. + * the change event at the right location. Only resources of type `service` are supported. Maximum of 100 impacted resources allowed. */ "impactedResources"?: Array; /** - * Free form object to track new value of the changed resource. + * Free form JSON object representing new state of the changed resource. */ "newValue"?: { [key: string]: any }; /** - * Free form object to track previous value of the changed resource. + * Free form JSON object representing the previous state of the changed resource. */ "prevValue"?: { [key: string]: any }; - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - "additionalProperties"?: { [key: string]: any }; /** * @ignore */ @@ -73,10 +67,6 @@ export class ChangeEventCustomAttributes { baseName: "prev_value", type: "{ [key: string]: any; }", }, - additionalProperties: { - baseName: "additionalProperties", - type: "{ [key: string]: any; }", - }, }; /** diff --git a/services/events/src/v2/models/ChangeEventCustomAttributesAuthor.ts b/services/events/src/v2/models/ChangeEventCustomAttributesAuthor.ts index 426547d7539..79ea053755a 100644 --- a/services/events/src/v2/models/ChangeEventCustomAttributesAuthor.ts +++ b/services/events/src/v2/models/ChangeEventCustomAttributesAuthor.ts @@ -3,23 +3,17 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; import { ChangeEventCustomAttributesAuthorType } from "./ChangeEventCustomAttributesAuthorType"; /** - * Object representing the entity which made the change. Optional field but if provided should include `type` and `name`. + * The entity that made the change. Optional, if provided it must include `type` and `name`. */ export class ChangeEventCustomAttributesAuthor { /** - * Author's name. Limited to 128 characters. + * The name of the user or system that made the change. Limited to 128 characters. */ "name": string; /** * Author's type. */ "type": ChangeEventCustomAttributesAuthorType; - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - "additionalProperties"?: { [key: string]: any }; /** * @ignore */ @@ -39,10 +33,6 @@ export class ChangeEventCustomAttributesAuthor { type: "ChangeEventCustomAttributesAuthorType", required: true, }, - additionalProperties: { - baseName: "additionalProperties", - type: "{ [key: string]: any; }", - }, }; /** diff --git a/services/events/src/v2/models/ChangeEventCustomAttributesChangedResource.ts b/services/events/src/v2/models/ChangeEventCustomAttributesChangedResource.ts index f9299040ffc..79a3adce2e6 100644 --- a/services/events/src/v2/models/ChangeEventCustomAttributesChangedResource.ts +++ b/services/events/src/v2/models/ChangeEventCustomAttributesChangedResource.ts @@ -3,23 +3,17 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; import { ChangeEventCustomAttributesChangedResourceType } from "./ChangeEventCustomAttributesChangedResourceType"; /** - * Object representing a uniquely identified resource. + * A uniquely identified resource. */ export class ChangeEventCustomAttributesChangedResource { /** - * Resource's name. + * The name of the resource that was changed. Limited to 128 characters. */ "name": string; /** - * Resource's type. + * The type of the resource that was changed. */ "type": ChangeEventCustomAttributesChangedResourceType; - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - "additionalProperties"?: { [key: string]: any }; /** * @ignore */ @@ -39,10 +33,6 @@ export class ChangeEventCustomAttributesChangedResource { type: "ChangeEventCustomAttributesChangedResourceType", required: true, }, - additionalProperties: { - baseName: "additionalProperties", - type: "{ [key: string]: any; }", - }, }; /** diff --git a/services/events/src/v2/models/ChangeEventCustomAttributesChangedResourceType.ts b/services/events/src/v2/models/ChangeEventCustomAttributesChangedResourceType.ts index db3f46c5fc9..ce207a086e6 100644 --- a/services/events/src/v2/models/ChangeEventCustomAttributesChangedResourceType.ts +++ b/services/events/src/v2/models/ChangeEventCustomAttributesChangedResourceType.ts @@ -1,7 +1,7 @@ import { UnparsedObject } from "@datadog/datadog-api-client"; /** - * Resource's type. + * The type of the resource that was changed. */ export type ChangeEventCustomAttributesChangedResourceType = | typeof FEATURE_FLAG diff --git a/services/events/src/v2/models/ChangeEventCustomAttributesImpactedResourcesItems.ts b/services/events/src/v2/models/ChangeEventCustomAttributesImpactedResourcesItems.ts index 2d7f852ccff..4b4f154f32b 100644 --- a/services/events/src/v2/models/ChangeEventCustomAttributesImpactedResourcesItems.ts +++ b/services/events/src/v2/models/ChangeEventCustomAttributesImpactedResourcesItems.ts @@ -3,23 +3,17 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; import { ChangeEventCustomAttributesImpactedResourcesItemsType } from "./ChangeEventCustomAttributesImpactedResourcesItemsType"; /** - * Object representing a uniquely identified resource. Only the resource type `service` is supported. + * Object representing a uniquely identified resource. */ export class ChangeEventCustomAttributesImpactedResourcesItems { /** - * Resource's name. + * The name of the impacted resource. Limited to 128 characters. */ "name": string; /** - * Resource's type. + * The type of the impacted resource. */ "type": ChangeEventCustomAttributesImpactedResourcesItemsType; - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - "additionalProperties"?: { [key: string]: any }; /** * @ignore */ @@ -39,10 +33,6 @@ export class ChangeEventCustomAttributesImpactedResourcesItems { type: "ChangeEventCustomAttributesImpactedResourcesItemsType", required: true, }, - additionalProperties: { - baseName: "additionalProperties", - type: "{ [key: string]: any; }", - }, }; /** diff --git a/services/events/src/v2/models/ChangeEventCustomAttributesImpactedResourcesItemsType.ts b/services/events/src/v2/models/ChangeEventCustomAttributesImpactedResourcesItemsType.ts index a4fed9d7bc0..43e041ff153 100644 --- a/services/events/src/v2/models/ChangeEventCustomAttributesImpactedResourcesItemsType.ts +++ b/services/events/src/v2/models/ChangeEventCustomAttributesImpactedResourcesItemsType.ts @@ -1,7 +1,7 @@ import { UnparsedObject } from "@datadog/datadog-api-client"; /** - * Resource's type. + * The type of the impacted resource. */ export type ChangeEventCustomAttributesImpactedResourcesItemsType = | typeof SERVICE diff --git a/services/events/src/v2/models/EventCategory.ts b/services/events/src/v2/models/EventCategory.ts index 5454f889c09..54e30aaec66 100644 --- a/services/events/src/v2/models/EventCategory.ts +++ b/services/events/src/v2/models/EventCategory.ts @@ -1,7 +1,8 @@ import { UnparsedObject } from "@datadog/datadog-api-client"; /** - * Event category to identify the type of event. Only the value `change` is supported. Support for other categories are coming. please reach out to datadog support if you're interested. + * Event category identifying the type of event. */ -export type EventCategory = typeof CHANGE | UnparsedObject; +export type EventCategory = typeof CHANGE | typeof ALERT | UnparsedObject; export const CHANGE = "change"; +export const ALERT = "alert"; diff --git a/services/events/src/v2/models/EventCreateRequest.ts b/services/events/src/v2/models/EventCreateRequest.ts index 2ebfb2dc098..324075ff0a0 100644 --- a/services/events/src/v2/models/EventCreateRequest.ts +++ b/services/events/src/v2/models/EventCreateRequest.ts @@ -4,17 +4,17 @@ import { EventCreateRequestType } from "./EventCreateRequestType"; import { EventPayload } from "./EventPayload"; /** - * Object representing an event creation request. + * An event creation request. */ export class EventCreateRequest { /** * Event attributes. */ - "attributes"?: EventPayload; + "attributes": EventPayload; /** * Entity type. */ - "type"?: EventCreateRequestType; + "type": EventCreateRequestType; /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -33,10 +33,12 @@ export class EventCreateRequest { attributes: { baseName: "attributes", type: "EventPayload", + required: true, }, type: { baseName: "type", type: "EventCreateRequestType", + required: true, }, additionalProperties: { baseName: "additionalProperties", diff --git a/services/events/src/v2/models/EventCreateRequestPayload.ts b/services/events/src/v2/models/EventCreateRequestPayload.ts index 4f45f9466fc..6c9991f8134 100644 --- a/services/events/src/v2/models/EventCreateRequestPayload.ts +++ b/services/events/src/v2/models/EventCreateRequestPayload.ts @@ -7,9 +7,9 @@ import { EventCreateRequest } from "./EventCreateRequest"; */ export class EventCreateRequestPayload { /** - * Object representing an event creation request. + * An event creation request. */ - "data"?: EventCreateRequest; + "data": EventCreateRequest; /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -28,6 +28,7 @@ export class EventCreateRequestPayload { data: { baseName: "data", type: "EventCreateRequest", + required: true, }, additionalProperties: { baseName: "additionalProperties", diff --git a/services/events/src/v2/models/EventCreateResponse.ts b/services/events/src/v2/models/EventCreateResponse.ts index 63f695b76e9..20bf0a33c40 100644 --- a/services/events/src/v2/models/EventCreateResponse.ts +++ b/services/events/src/v2/models/EventCreateResponse.ts @@ -3,15 +3,15 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; import { EventCreateResponseAttributes } from "./EventCreateResponseAttributes"; /** - * Object containing an event response. + * Event response. */ export class EventCreateResponse { /** - * JSON object containing all events attributes and their associated values. + * JSON object containing event attributes and other associated attributes. */ "attributes"?: EventCreateResponseAttributes; /** - * Event type + * Entity type. */ "type"?: string; /** diff --git a/services/events/src/v2/models/EventCreateResponseAttributes.ts b/services/events/src/v2/models/EventCreateResponseAttributes.ts index 43bc34e13e9..9733b3ef3e0 100644 --- a/services/events/src/v2/models/EventCreateResponseAttributes.ts +++ b/services/events/src/v2/models/EventCreateResponseAttributes.ts @@ -3,11 +3,11 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; import { EventCreateResponseAttributesAttributes } from "./EventCreateResponseAttributesAttributes"; /** - * JSON object containing all events attributes and their associated values. + * JSON object containing event attributes and other associated attributes. */ export class EventCreateResponseAttributes { /** - * JSON object of attributes from your events. + * JSON object of event attributes. */ "attributes"?: EventCreateResponseAttributesAttributes; /** diff --git a/services/events/src/v2/models/EventCreateResponseAttributesAttributes.ts b/services/events/src/v2/models/EventCreateResponseAttributesAttributes.ts index cdb0b41c82f..cbadc38b5fb 100644 --- a/services/events/src/v2/models/EventCreateResponseAttributesAttributes.ts +++ b/services/events/src/v2/models/EventCreateResponseAttributesAttributes.ts @@ -3,7 +3,7 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; import { EventCreateResponseAttributesAttributesEvt } from "./EventCreateResponseAttributesAttributesEvt"; /** - * JSON object of attributes from your events. + * JSON object of event attributes. */ export class EventCreateResponseAttributesAttributes { /** diff --git a/services/events/src/v2/models/EventCreateResponseAttributesAttributesEvt.ts b/services/events/src/v2/models/EventCreateResponseAttributesAttributesEvt.ts index dad37139611..f76fc27c1e7 100644 --- a/services/events/src/v2/models/EventCreateResponseAttributesAttributesEvt.ts +++ b/services/events/src/v2/models/EventCreateResponseAttributesAttributesEvt.ts @@ -5,9 +5,13 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; */ export class EventCreateResponseAttributesAttributesEvt { /** - * Event id + * Event identifier. This field is deprecated and will be removed in a future version. Use the `uid` field instead. */ "id"?: string; + /** + * A unique identifier for the event. You can use this identifier to query or reference the event. + */ + "uid"?: string; /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -27,6 +31,10 @@ export class EventCreateResponseAttributesAttributesEvt { baseName: "id", type: "string", }, + uid: { + baseName: "uid", + type: "string", + }, additionalProperties: { baseName: "additionalProperties", type: "{ [key: string]: any; }", diff --git a/services/events/src/v2/models/EventCreateResponsePayload.ts b/services/events/src/v2/models/EventCreateResponsePayload.ts index b8037b454b0..85b299059f5 100644 --- a/services/events/src/v2/models/EventCreateResponsePayload.ts +++ b/services/events/src/v2/models/EventCreateResponsePayload.ts @@ -1,15 +1,20 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; import { EventCreateResponse } from "./EventCreateResponse"; +import { EventCreateResponsePayloadLinks } from "./EventCreateResponsePayloadLinks"; /** - * Response containing information about created event. + * Create Event response. */ export class EventCreateResponsePayload { /** - * Object containing an event response. + * Event response. */ "data"?: EventCreateResponse; + /** + * Links to the event. + */ + "links"?: EventCreateResponsePayloadLinks; /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -29,6 +34,10 @@ export class EventCreateResponsePayload { baseName: "data", type: "EventCreateResponse", }, + links: { + baseName: "links", + type: "EventCreateResponsePayloadLinks", + }, additionalProperties: { baseName: "additionalProperties", type: "{ [key: string]: any; }", diff --git a/services/events/src/v2/models/EventCreateResponsePayloadLinks.ts b/services/events/src/v2/models/EventCreateResponsePayloadLinks.ts new file mode 100644 index 00000000000..0f9fc37911f --- /dev/null +++ b/services/events/src/v2/models/EventCreateResponsePayloadLinks.ts @@ -0,0 +1,44 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Links to the event. + */ +export class EventCreateResponsePayloadLinks { + /** + * The URL of the event. This link is only functional when using the default subdomain. + */ + "self"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + self: { + baseName: "self", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return EventCreateResponsePayloadLinks.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/events/src/v2/models/EventPayload.ts b/services/events/src/v2/models/EventPayload.ts index 0e26e373d7d..ca0bf2c2cf5 100644 --- a/services/events/src/v2/models/EventPayload.ts +++ b/services/events/src/v2/models/EventPayload.ts @@ -2,29 +2,34 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; import { EventCategory } from "./EventCategory"; import { EventPayloadAttributes } from "./EventPayloadAttributes"; +import { EventPayloadIntegrationId } from "./EventPayloadIntegrationId"; /** * Event attributes. */ export class EventPayload { /** - * An arbitrary string to use for aggregation when correlating events. Limited to 100 characters. + * A string used for aggregation when [correlating](https://docs.datadoghq.com/service_management/events/correlation/) events. If you specify a key, events are deduplicated to alerts based on this key. Limited to 100 characters. */ "aggregationKey"?: string; /** - * JSON object for custom attributes. Schema are different per each event category. + * JSON object for category specific attributes. Schema is different per event category. */ "attributes": EventPayloadAttributes; /** - * Event category to identify the type of event. Only the value `change` is supported. Support for other categories are coming. please reach out to datadog support if you're interested. + * Event category identifying the type of event. */ "category": EventCategory; /** - * The body of the event. Limited to 4000 characters. + * Integration ID sourced from integration manifests. + */ + "integrationId"?: EventPayloadIntegrationId; + /** + * Free formed text associated with the event. Suggest using `data.attributes.attributes.custom` for well-structured attributes. Limited to 4000 characters. */ "message"?: string; /** - * A list of tags to apply to the event. + * A list of tags associated with the event. Maximum of 100 tags allowed. * Refer to [Tags docs](https://docs.datadoghq.com/getting_started/tagging/). */ "tags"?: Array; @@ -35,15 +40,9 @@ export class EventPayload { */ "timestamp"?: string; /** - * The event title. Limited to 500 characters. + * The title of the event. Limited to 500 characters. */ "title": string; - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - "additionalProperties"?: { [key: string]: any }; /** * @ignore */ @@ -67,6 +66,10 @@ export class EventPayload { type: "EventCategory", required: true, }, + integrationId: { + baseName: "integration_id", + type: "EventPayloadIntegrationId", + }, message: { baseName: "message", type: "string", @@ -84,10 +87,6 @@ export class EventPayload { type: "string", required: true, }, - additionalProperties: { - baseName: "additionalProperties", - type: "{ [key: string]: any; }", - }, }; /** diff --git a/services/events/src/v2/models/EventPayloadAttributes.ts b/services/events/src/v2/models/EventPayloadAttributes.ts index de846b0790a..a6ba65ca3e3 100644 --- a/services/events/src/v2/models/EventPayloadAttributes.ts +++ b/services/events/src/v2/models/EventPayloadAttributes.ts @@ -1,10 +1,12 @@ import { UnparsedObject } from "@datadog/datadog-api-client"; +import { AlertEventCustomAttributes } from "./AlertEventCustomAttributes"; import { ChangeEventCustomAttributes } from "./ChangeEventCustomAttributes"; /** - * JSON object for custom attributes. Schema are different per each event category. + * JSON object for category specific attributes. Schema is different per event category. */ export type EventPayloadAttributes = | ChangeEventCustomAttributes + | AlertEventCustomAttributes | UnparsedObject; diff --git a/services/events/src/v2/models/EventPayloadIntegrationId.ts b/services/events/src/v2/models/EventPayloadIntegrationId.ts new file mode 100644 index 00000000000..1eb82e87a6c --- /dev/null +++ b/services/events/src/v2/models/EventPayloadIntegrationId.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Integration ID sourced from integration manifests. + */ +export type EventPayloadIntegrationId = typeof CUSTOM_EVENTS | UnparsedObject; +export const CUSTOM_EVENTS = "custom-events"; diff --git a/services/events/src/v2/models/TypingInfo.ts b/services/events/src/v2/models/TypingInfo.ts index c04da907a79..1cfb4aeff36 100644 --- a/services/events/src/v2/models/TypingInfo.ts +++ b/services/events/src/v2/models/TypingInfo.ts @@ -1,6 +1,8 @@ import { ModelTypingInfo } from "@datadog/datadog-api-client"; import { APIErrorResponse } from "./APIErrorResponse"; +import { AlertEventCustomAttributes } from "./AlertEventCustomAttributes"; +import { AlertEventCustomAttributesLinksItems } from "./AlertEventCustomAttributesLinksItems"; import { ChangeEventCustomAttributes } from "./ChangeEventCustomAttributes"; import { ChangeEventCustomAttributesAuthor } from "./ChangeEventCustomAttributesAuthor"; import { ChangeEventCustomAttributesChangedResource } from "./ChangeEventCustomAttributesChangedResource"; @@ -14,6 +16,7 @@ import { EventCreateResponseAttributes } from "./EventCreateResponseAttributes"; import { EventCreateResponseAttributesAttributes } from "./EventCreateResponseAttributesAttributes"; import { EventCreateResponseAttributesAttributesEvt } from "./EventCreateResponseAttributesAttributesEvt"; import { EventCreateResponsePayload } from "./EventCreateResponsePayload"; +import { EventCreateResponsePayloadLinks } from "./EventCreateResponsePayloadLinks"; import { EventPayload } from "./EventPayload"; import { EventResponse } from "./EventResponse"; import { EventResponseAttributes } from "./EventResponseAttributes"; @@ -33,14 +36,22 @@ import { MonitorType } from "./MonitorType"; export const TypingInfo: ModelTypingInfo = { enumsMap: { + AlertEventCustomAttributesLinksItemsCategory: [ + "runbook", + "documentation", + "dashboard", + ], + AlertEventCustomAttributesPriority: ["1", "2", "3", "4", "5"], + AlertEventCustomAttributesStatus: ["warn", "error", "ok"], ChangeEventCustomAttributesAuthorType: ["user", "system"], ChangeEventCustomAttributesChangedResourceType: [ "feature_flag", "configuration", ], ChangeEventCustomAttributesImpactedResourcesItemsType: ["service"], - EventCategory: ["change"], + EventCategory: ["change", "alert"], EventCreateRequestType: ["event"], + EventPayloadIntegrationId: ["custom-events"], EventPriority: ["normal", "low"], EventStatusType: [ "failure", @@ -56,10 +67,15 @@ export const TypingInfo: ModelTypingInfo = { EventsSort: ["timestamp", "-timestamp"], }, oneOfMap: { - EventPayloadAttributes: ["ChangeEventCustomAttributes"], + EventPayloadAttributes: [ + "ChangeEventCustomAttributes", + "AlertEventCustomAttributes", + ], }, typeMap: { APIErrorResponse: APIErrorResponse, + AlertEventCustomAttributes: AlertEventCustomAttributes, + AlertEventCustomAttributesLinksItems: AlertEventCustomAttributesLinksItems, ChangeEventCustomAttributes: ChangeEventCustomAttributes, ChangeEventCustomAttributesAuthor: ChangeEventCustomAttributesAuthor, ChangeEventCustomAttributesChangedResource: @@ -77,6 +93,7 @@ export const TypingInfo: ModelTypingInfo = { EventCreateResponseAttributesAttributesEvt: EventCreateResponseAttributesAttributesEvt, EventCreateResponsePayload: EventCreateResponsePayload, + EventCreateResponsePayloadLinks: EventCreateResponsePayloadLinks, EventPayload: EventPayload, EventResponse: EventResponse, EventResponseAttributes: EventResponseAttributes,