From 1eda3a4d617b533f62ea6f4c5f99cf83fb67c8da Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 18 Jun 2025 14:55:31 +0000 Subject: [PATCH] Regenerate client from commit 5f7cad1f of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 276 +++++++++++++++--- .../frozen.json | 1 + .../recording.har | 67 +++++ .../frozen.json | 1 + .../recording.har | 67 +++++ examples/v2/events/CreateEvent.ts | 6 +- features/v2/events.feature | 12 +- features/v2/undo.json | 2 +- packages/datadog-api-client-common/servers.ts | 29 ++ .../datadog-api-client-v2/apis/EventsApi.ts | 14 +- packages/datadog-api-client-v2/index.ts | 7 + .../models/AlertEventCustomAttributes.ts | 69 +++++ .../AlertEventCustomAttributesLinksItems.ts | 60 ++++ ...EventCustomAttributesLinksItemsCategory.ts | 20 ++ .../AlertEventCustomAttributesPriority.ts | 24 ++ .../AlertEventCustomAttributesStatus.ts | 20 ++ .../models/ChangeEventCustomAttributes.ts | 25 +- .../ChangeEventCustomAttributesAuthor.ts | 15 +- ...ngeEventCustomAttributesChangedResource.ts | 17 +- ...ventCustomAttributesChangedResourceType.ts | 2 +- ...tCustomAttributesImpactedResourcesItems.ts | 17 +- ...tomAttributesImpactedResourcesItemsType.ts | 2 +- .../models/EventCategory.ts | 5 +- .../models/EventCreateRequest.ts | 8 +- .../models/EventCreateRequestPayload.ts | 5 +- .../models/EventCreateResponse.ts | 6 +- .../models/EventCreateResponseAttributes.ts | 4 +- ...EventCreateResponseAttributesAttributes.ts | 2 +- ...ntCreateResponseAttributesAttributesEvt.ts | 10 +- .../models/EventCreateResponsePayload.ts | 13 +- .../models/EventCreateResponsePayloadLinks.ts | 52 ++++ .../models/EventPayload.ts | 32 +- .../models/EventPayloadAttributes.ts | 4 +- .../models/EventPayloadIntegrationId.ts | 14 + .../models/ObjectSerializer.ts | 21 +- 36 files changed, 779 insertions(+), 158 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 packages/datadog-api-client-v2/models/AlertEventCustomAttributes.ts create mode 100644 packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItems.ts create mode 100644 packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItemsCategory.ts create mode 100644 packages/datadog-api-client-v2/models/AlertEventCustomAttributesPriority.ts create mode 100644 packages/datadog-api-client-v2/models/AlertEventCustomAttributesStatus.ts create mode 100644 packages/datadog-api-client-v2/models/EventCreateResponsePayloadLinks.ts create mode 100644 packages/datadog-api-client-v2/models/EventPayloadIntegrationId.ts diff --git a/.apigentools-info b/.apigentools-info index 988b5d4ca066..10b16f5ca6b5 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-18 13:32:44.049529", - "spec_repo_commit": "5e49afe1" + "regenerated": "2025-06-18 14:53:48.398215", + "spec_repo_commit": "5f7cad1f" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-18 13:32:44.068519", - "spec_repo_commit": "5e49afe1" + "regenerated": "2025-06-18 14:53:48.414477", + "spec_repo_commit": "5f7cad1f" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c24700d9c643..cdbca1909d4f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2227,6 +2227,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! @@ -6919,14 +7010,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 @@ -6941,17 +7034,19 @@ components: description: '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 correct location. Only resources of type `service` + 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 the new state of the changed + resource. example: enabled: true percentage: 50% @@ -6960,7 +7055,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% @@ -6971,13 +7067,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' @@ -6996,11 +7095,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' @@ -7009,7 +7111,7 @@ components: - name type: object ChangeEventCustomAttributesChangedResourceType: - description: Resource's type. + description: The type of the resource that was changed. enum: - feature_flag - configuration @@ -7019,12 +7121,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' @@ -7033,7 +7137,7 @@ components: - name type: object ChangeEventCustomAttributesImpactedResourcesItemsType: - description: Resource's type. + description: The type of the impacted resource. enum: - service example: service @@ -14587,28 +14691,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 object. 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. @@ -14619,24 +14728,23 @@ components: x-enum-varnames: - EVENT EventCreateResponse: - description: Object containing an event response. + description: Event object. 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: Event attributes. properties: attributes: $ref: '#/components/schemas/EventCreateResponseAttributesAttributes' type: object EventCreateResponseAttributesAttributes: - description: JSON object of attributes from your events. + description: JSON object for category-specific attributes. properties: evt: $ref: '#/components/schemas/EventCreateResponseAttributesAttributesEvt' @@ -14645,41 +14753,71 @@ 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: Event creation 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. It's suggested + to use `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) @@ -14691,9 +14829,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 @@ -14701,10 +14840,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: @@ -47063,10 +47211,15 @@ paths: permissions: - events_read 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: @@ -47076,9 +47229,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: @@ -47104,17 +47258,19 @@ 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: $ref: '#/components/schemas/EventCreateRequestPayload' - description: Event request object + description: Event creation request payload. required: true responses: - '200': + '202': content: application/json: schema: @@ -47137,6 +47293,38 @@ 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 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 000000000000..0c178a65d427 --- /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 000000000000..05bf0de115c1 --- /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 000000000000..c504f55c1e89 --- /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 000000000000..62149e977bfc --- /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/examples/v2/events/CreateEvent.ts b/examples/v2/events/CreateEvent.ts index b08a4499b3f0..6f6c8a0a6319 100644 --- a/examples/v2/events/CreateEvent.ts +++ b/examples/v2/events/CreateEvent.ts @@ -11,9 +11,10 @@ const params: v2.EventsApiCreateEventRequest = { body: { data: { attributes: { + aggregationKey: "aggregation_key_123", attributes: { author: { - name: "datadog@datadog.com", + name: "example@datadog.com", type: "user", }, changeMetadata: { @@ -42,8 +43,9 @@ const params: v2.EventsApiCreateEventRequest = { }, }, category: "change", + integrationId: "custom-events", message: "payment_processed feature flag has been enabled", - tags: ["env:test"], + tags: ["env:api_client_test"], title: "payment_processed feature flag updated", }, type: "event", diff --git a/features/v2/events.feature b/features/v2/events.feature index a8c1307ac683..0a69d195201a 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 e81cb7b7ce12..3cc857a7365b 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/packages/datadog-api-client-common/servers.ts b/packages/datadog-api-client-common/servers.ts index 4dc46469001f..d9b9d8c878c0 100644 --- a/packages/datadog-api-client-common/servers.ts +++ b/packages/datadog-api-client-common/servers.ts @@ -153,6 +153,35 @@ export const operationServers: { subdomain: "http-intake.logs", }), ], + "v2.EventsApi.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", + }), + ], "v2.LogsApi.submitLog": [ new ServerConfiguration<{ site: diff --git a/packages/datadog-api-client-v2/apis/EventsApi.ts b/packages/datadog-api-client-v2/apis/EventsApi.ts index 02f640340e58..5b1361470bb9 100644 --- a/packages/datadog-api-client-v2/apis/EventsApi.ts +++ b/packages/datadog-api-client-v2/apis/EventsApi.ts @@ -194,7 +194,7 @@ export class EventsApiResponseProcessor { const contentType = ObjectSerializer.normalizeMediaType( response.headers["content-type"] ); - if (response.httpStatusCode === 200) { + if (response.httpStatusCode === 202) { const body: EventCreateResponsePayload = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "EventCreateResponsePayload" @@ -389,7 +389,7 @@ export class EventsApiResponseProcessor { export interface EventsApiCreateEventRequest { /** - * Event request object + * Event creation request payload. * @type EventCreateRequestPayload */ body: EventCreateRequestPayload; @@ -453,11 +453,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/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index a1d43b24caed..ffe4554d3d9d 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -768,6 +768,11 @@ export { ActiveBillingDimensionsResponse } from "./models/ActiveBillingDimension export { ActiveBillingDimensionsType } from "./models/ActiveBillingDimensionsType"; export { AddMemberTeamRequest } from "./models/AddMemberTeamRequest"; export { Advisory } from "./models/Advisory"; +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 { Annotation } from "./models/Annotation"; export { AnnotationDisplay } from "./models/AnnotationDisplay"; export { AnnotationDisplayBounds } from "./models/AnnotationDisplayBounds"; @@ -1587,8 +1592,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/packages/datadog-api-client-v2/models/AlertEventCustomAttributes.ts b/packages/datadog-api-client-v2/models/AlertEventCustomAttributes.ts new file mode 100644 index 000000000000..7d7173bb38d5 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AlertEventCustomAttributes.ts @@ -0,0 +1,69 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AlertEventCustomAttributesLinksItems } from "./AlertEventCustomAttributesLinksItems"; +import { AlertEventCustomAttributesPriority } from "./AlertEventCustomAttributesPriority"; +import { AlertEventCustomAttributesStatus } from "./AlertEventCustomAttributesStatus"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * 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/packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItems.ts b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItems.ts new file mode 100644 index 000000000000..6f5329642713 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItems.ts @@ -0,0 +1,60 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AlertEventCustomAttributesLinksItemsCategory } from "./AlertEventCustomAttributesLinksItemsCategory"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * 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/packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItemsCategory.ts b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItemsCategory.ts new file mode 100644 index 000000000000..3238bd693247 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItemsCategory.ts @@ -0,0 +1,20 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * 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/packages/datadog-api-client-v2/models/AlertEventCustomAttributesPriority.ts b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesPriority.ts new file mode 100644 index 000000000000..1ff27794cfab --- /dev/null +++ b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesPriority.ts @@ -0,0 +1,24 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * 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/packages/datadog-api-client-v2/models/AlertEventCustomAttributesStatus.ts b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesStatus.ts new file mode 100644 index 000000000000..bcde908b0a8a --- /dev/null +++ b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesStatus.ts @@ -0,0 +1,20 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * 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/packages/datadog-api-client-v2/models/ChangeEventCustomAttributes.ts b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributes.ts index f418a22ef4b5..df6b190ced90 100644 --- a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributes.ts +++ b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributes.ts @@ -10,42 +10,35 @@ import { ChangeEventCustomAttributesImpactedResourcesItems } from "./ChangeEvent import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * 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 correct 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 the 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 */ @@ -80,10 +73,6 @@ export class ChangeEventCustomAttributes { baseName: "prev_value", type: "{ [key: string]: any; }", }, - additionalProperties: { - baseName: "additionalProperties", - type: "any", - }, }; /** diff --git a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesAuthor.ts b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesAuthor.ts index 41b38ab3853d..b84065219583 100644 --- a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesAuthor.ts +++ b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesAuthor.ts @@ -8,11 +8,11 @@ import { ChangeEventCustomAttributesAuthorType } from "./ChangeEventCustomAttrib import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * 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; /** @@ -20,13 +20,6 @@ export class ChangeEventCustomAttributesAuthor { */ "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 */ @@ -46,10 +39,6 @@ export class ChangeEventCustomAttributesAuthor { type: "ChangeEventCustomAttributesAuthorType", required: true, }, - additionalProperties: { - baseName: "additionalProperties", - type: "any", - }, }; /** diff --git a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResource.ts b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResource.ts index ee698837a8fd..aeb49ac4c63f 100644 --- a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResource.ts +++ b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResource.ts @@ -8,25 +8,18 @@ import { ChangeEventCustomAttributesChangedResourceType } from "./ChangeEventCus import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * 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 */ @@ -46,10 +39,6 @@ export class ChangeEventCustomAttributesChangedResource { type: "ChangeEventCustomAttributesChangedResourceType", required: true, }, - additionalProperties: { - baseName: "additionalProperties", - type: "any", - }, }; /** diff --git a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResourceType.ts b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResourceType.ts index 79ca0b383ada..6153187149af 100644 --- a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResourceType.ts +++ b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesChangedResourceType.ts @@ -7,7 +7,7 @@ import { UnparsedObject } from "../../datadog-api-client-common/util"; /** - * Resource's type. + * The type of the resource that was changed. */ export type ChangeEventCustomAttributesChangedResourceType = diff --git a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesImpactedResourcesItems.ts b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesImpactedResourcesItems.ts index 1677006e8d93..6c70629da0b5 100644 --- a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesImpactedResourcesItems.ts +++ b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesImpactedResourcesItems.ts @@ -8,25 +8,18 @@ import { ChangeEventCustomAttributesImpactedResourcesItemsType } from "./ChangeE import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * 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 */ @@ -46,10 +39,6 @@ export class ChangeEventCustomAttributesImpactedResourcesItems { type: "ChangeEventCustomAttributesImpactedResourcesItemsType", required: true, }, - additionalProperties: { - baseName: "additionalProperties", - type: "any", - }, }; /** diff --git a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesImpactedResourcesItemsType.ts b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesImpactedResourcesItemsType.ts index 8c944085516a..0a24d8a6864c 100644 --- a/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesImpactedResourcesItemsType.ts +++ b/packages/datadog-api-client-v2/models/ChangeEventCustomAttributesImpactedResourcesItemsType.ts @@ -7,7 +7,7 @@ import { UnparsedObject } from "../../datadog-api-client-common/util"; /** - * Resource's type. + * The type of the impacted resource. */ export type ChangeEventCustomAttributesImpactedResourcesItemsType = diff --git a/packages/datadog-api-client-v2/models/EventCategory.ts b/packages/datadog-api-client-v2/models/EventCategory.ts index 2b1796fd87d6..496f92ed6560 100644 --- a/packages/datadog-api-client-v2/models/EventCategory.ts +++ b/packages/datadog-api-client-v2/models/EventCategory.ts @@ -7,8 +7,9 @@ import { UnparsedObject } from "../../datadog-api-client-common/util"; /** - * 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/packages/datadog-api-client-v2/models/EventCreateRequest.ts b/packages/datadog-api-client-v2/models/EventCreateRequest.ts index 45945e5315ae..06aa1e0784a6 100644 --- a/packages/datadog-api-client-v2/models/EventCreateRequest.ts +++ b/packages/datadog-api-client-v2/models/EventCreateRequest.ts @@ -9,17 +9,17 @@ import { EventPayload } from "./EventPayload"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * Object representing an event creation request. + * An event object. */ export class EventCreateRequest { /** * Event attributes. */ - "attributes"?: EventPayload; + "attributes": EventPayload; /** * Entity type. */ - "type"?: EventCreateRequestType; + "type": EventCreateRequestType; /** * A container for additional, undeclared properties. @@ -40,10 +40,12 @@ export class EventCreateRequest { attributes: { baseName: "attributes", type: "EventPayload", + required: true, }, type: { baseName: "type", type: "EventCreateRequestType", + required: true, }, additionalProperties: { baseName: "additionalProperties", diff --git a/packages/datadog-api-client-v2/models/EventCreateRequestPayload.ts b/packages/datadog-api-client-v2/models/EventCreateRequestPayload.ts index 74d64c448c88..38eae797a502 100644 --- a/packages/datadog-api-client-v2/models/EventCreateRequestPayload.ts +++ b/packages/datadog-api-client-v2/models/EventCreateRequestPayload.ts @@ -12,9 +12,9 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; */ export class EventCreateRequestPayload { /** - * Object representing an event creation request. + * An event object. */ - "data"?: EventCreateRequest; + "data": EventCreateRequest; /** * A container for additional, undeclared properties. @@ -35,6 +35,7 @@ export class EventCreateRequestPayload { data: { baseName: "data", type: "EventCreateRequest", + required: true, }, additionalProperties: { baseName: "additionalProperties", diff --git a/packages/datadog-api-client-v2/models/EventCreateResponse.ts b/packages/datadog-api-client-v2/models/EventCreateResponse.ts index dbbb3269c241..4c08c8ed9c34 100644 --- a/packages/datadog-api-client-v2/models/EventCreateResponse.ts +++ b/packages/datadog-api-client-v2/models/EventCreateResponse.ts @@ -8,15 +8,15 @@ import { EventCreateResponseAttributes } from "./EventCreateResponseAttributes"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * Object containing an event response. + * Event object. */ export class EventCreateResponse { /** - * JSON object containing all events attributes and their associated values. + * Event attributes. */ "attributes"?: EventCreateResponseAttributes; /** - * Event type + * Entity type. */ "type"?: string; diff --git a/packages/datadog-api-client-v2/models/EventCreateResponseAttributes.ts b/packages/datadog-api-client-v2/models/EventCreateResponseAttributes.ts index 006f666f9ddb..21daeee76c1b 100644 --- a/packages/datadog-api-client-v2/models/EventCreateResponseAttributes.ts +++ b/packages/datadog-api-client-v2/models/EventCreateResponseAttributes.ts @@ -8,11 +8,11 @@ import { EventCreateResponseAttributesAttributes } from "./EventCreateResponseAt import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * JSON object containing all events attributes and their associated values. + * Event attributes. */ export class EventCreateResponseAttributes { /** - * JSON object of attributes from your events. + * JSON object for category-specific attributes. */ "attributes"?: EventCreateResponseAttributesAttributes; diff --git a/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributes.ts b/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributes.ts index 28c79493e773..f9ff792bd67b 100644 --- a/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributes.ts +++ b/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributes.ts @@ -8,7 +8,7 @@ import { EventCreateResponseAttributesAttributesEvt } from "./EventCreateRespons import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * JSON object of attributes from your events. + * JSON object for category-specific attributes. */ export class EventCreateResponseAttributesAttributes { /** diff --git a/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributesEvt.ts b/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributesEvt.ts index c21556081522..05ba642b6bd4 100644 --- a/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributesEvt.ts +++ b/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributesEvt.ts @@ -11,9 +11,13 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; */ 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. @@ -35,6 +39,10 @@ export class EventCreateResponseAttributesAttributesEvt { baseName: "id", type: "string", }, + uid: { + baseName: "uid", + type: "string", + }, additionalProperties: { baseName: "additionalProperties", type: "any", diff --git a/packages/datadog-api-client-v2/models/EventCreateResponsePayload.ts b/packages/datadog-api-client-v2/models/EventCreateResponsePayload.ts index b0a1da3130c1..dfbaadc743e8 100644 --- a/packages/datadog-api-client-v2/models/EventCreateResponsePayload.ts +++ b/packages/datadog-api-client-v2/models/EventCreateResponsePayload.ts @@ -4,17 +4,22 @@ * Copyright 2020-Present Datadog, Inc. */ import { EventCreateResponse } from "./EventCreateResponse"; +import { EventCreateResponsePayloadLinks } from "./EventCreateResponsePayloadLinks"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * Response containing information about created event. + * Event creation response. */ export class EventCreateResponsePayload { /** - * Object containing an event response. + * Event object. */ "data"?: EventCreateResponse; + /** + * Links to the event. + */ + "links"?: EventCreateResponsePayloadLinks; /** * A container for additional, undeclared properties. @@ -36,6 +41,10 @@ export class EventCreateResponsePayload { baseName: "data", type: "EventCreateResponse", }, + links: { + baseName: "links", + type: "EventCreateResponsePayloadLinks", + }, additionalProperties: { baseName: "additionalProperties", type: "any", diff --git a/packages/datadog-api-client-v2/models/EventCreateResponsePayloadLinks.ts b/packages/datadog-api-client-v2/models/EventCreateResponsePayloadLinks.ts new file mode 100644 index 000000000000..e1081da3eb8b --- /dev/null +++ b/packages/datadog-api-client-v2/models/EventCreateResponsePayloadLinks.ts @@ -0,0 +1,52 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * 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: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return EventCreateResponsePayloadLinks.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/EventPayload.ts b/packages/datadog-api-client-v2/models/EventPayload.ts index ce55fadebb51..e69f6b1aeb52 100644 --- a/packages/datadog-api-client-v2/models/EventPayload.ts +++ b/packages/datadog-api-client-v2/models/EventPayload.ts @@ -5,6 +5,7 @@ */ import { EventCategory } from "./EventCategory"; import { EventPayloadAttributes } from "./EventPayloadAttributes"; +import { EventPayloadIntegrationId } from "./EventPayloadIntegrationId"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; @@ -13,23 +14,27 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; */ 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. It's suggested to use `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; @@ -40,17 +45,10 @@ 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 */ @@ -74,6 +72,10 @@ export class EventPayload { type: "EventCategory", required: true, }, + integrationId: { + baseName: "integration_id", + type: "EventPayloadIntegrationId", + }, message: { baseName: "message", type: "string", @@ -91,10 +93,6 @@ export class EventPayload { type: "string", required: true, }, - additionalProperties: { - baseName: "additionalProperties", - type: "any", - }, }; /** diff --git a/packages/datadog-api-client-v2/models/EventPayloadAttributes.ts b/packages/datadog-api-client-v2/models/EventPayloadAttributes.ts index 5bdf3f3dd14f..cbb4f8d8ad1a 100644 --- a/packages/datadog-api-client-v2/models/EventPayloadAttributes.ts +++ b/packages/datadog-api-client-v2/models/EventPayloadAttributes.ts @@ -3,14 +3,16 @@ * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2020-Present Datadog, Inc. */ +import { AlertEventCustomAttributes } from "./AlertEventCustomAttributes"; import { ChangeEventCustomAttributes } from "./ChangeEventCustomAttributes"; import { UnparsedObject } from "../../datadog-api-client-common/util"; /** - * 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/packages/datadog-api-client-v2/models/EventPayloadIntegrationId.ts b/packages/datadog-api-client-v2/models/EventPayloadIntegrationId.ts new file mode 100644 index 000000000000..1992d4c01c52 --- /dev/null +++ b/packages/datadog-api-client-v2/models/EventPayloadIntegrationId.ts @@ -0,0 +1,14 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Integration ID sourced from integration manifests. + */ + +export type EventPayloadIntegrationId = typeof CUSTOM_EVENTS | UnparsedObject; +export const CUSTOM_EVENTS = "custom-events"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index 882f2a7599da..9a3d249ba8ad 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -62,6 +62,8 @@ import { ActiveBillingDimensionsBody } from "./ActiveBillingDimensionsBody"; import { ActiveBillingDimensionsResponse } from "./ActiveBillingDimensionsResponse"; import { AddMemberTeamRequest } from "./AddMemberTeamRequest"; import { Advisory } from "./Advisory"; +import { AlertEventCustomAttributes } from "./AlertEventCustomAttributes"; +import { AlertEventCustomAttributesLinksItems } from "./AlertEventCustomAttributesLinksItems"; import { Annotation } from "./Annotation"; import { AnnotationDisplay } from "./AnnotationDisplay"; import { AnnotationDisplayBounds } from "./AnnotationDisplayBounds"; @@ -653,6 +655,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"; @@ -1974,6 +1977,13 @@ const enumsMap: { [key: string]: any[] } = { ActionConnectionDataType: ["action_connection"], ActionQueryType: ["action"], ActiveBillingDimensionsType: ["billing_dimensions"], + AlertEventCustomAttributesLinksItemsCategory: [ + "runbook", + "documentation", + "dashboard", + ], + AlertEventCustomAttributesPriority: ["1", "2", "3", "4", "5"], + AlertEventCustomAttributesStatus: ["warn", "error", "ok"], ApmRetentionFilterType: ["apm_retention_filter"], AppBuilderEventName: [ "pageChange", @@ -2278,8 +2288,9 @@ const enumsMap: { [key: string]: any[] } = { EscalationPolicyUserType: ["users"], EscalationRelationshipsRespondersDataItemsType: ["users"], EscalationType: ["escalation_policy_steps"], - EventCategory: ["change"], + EventCategory: ["change", "alert"], EventCreateRequestType: ["event"], + EventPayloadIntegrationId: ["custom-events"], EventPriority: ["normal", "low"], EventStatusType: [ "failure", @@ -3234,6 +3245,8 @@ const typeMap: { [index: string]: any } = { ActiveBillingDimensionsResponse: ActiveBillingDimensionsResponse, AddMemberTeamRequest: AddMemberTeamRequest, Advisory: Advisory, + AlertEventCustomAttributes: AlertEventCustomAttributes, + AlertEventCustomAttributesLinksItems: AlertEventCustomAttributesLinksItems, Annotation: Annotation, AnnotationDisplay: AnnotationDisplay, AnnotationDisplayBounds: AnnotationDisplayBounds, @@ -3941,6 +3954,7 @@ const typeMap: { [index: string]: any } = { EventCreateResponseAttributesAttributesEvt: EventCreateResponseAttributesAttributesEvt, EventCreateResponsePayload: EventCreateResponsePayload, + EventCreateResponsePayloadLinks: EventCreateResponsePayloadLinks, EventPayload: EventPayload, EventResponse: EventResponse, EventResponseAttributes: EventResponseAttributes, @@ -5520,7 +5534,10 @@ const oneOfMap: { [index: string]: string[] } = { "ScheduleData", ], EscalationTarget: ["TeamTarget", "UserTarget", "ScheduleTarget"], - EventPayloadAttributes: ["ChangeEventCustomAttributes"], + EventPayloadAttributes: [ + "ChangeEventCustomAttributes", + "AlertEventCustomAttributes", + ], HTTPCredentials: ["HTTPTokenAuth"], HTTPCredentialsUpdate: ["HTTPTokenAuthUpdate"], IncidentAttachmentAttributes: [