diff --git a/.apigentools-info b/.apigentools-info index e50355321b1f..05300773dc99 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-08 14:34:57.337651", - "spec_repo_commit": "4b632dba" + "regenerated": "2025-05-09 01:01:40.960108", + "spec_repo_commit": "9f916c56" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-08 14:34:57.354509", - "spec_repo_commit": "4b632dba" + "regenerated": "2025-05-09 01:01:40.975857", + "spec_repo_commit": "9f916c56" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 976fac306b3f..2f7184f5bc8a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2138,6 +2138,89 @@ components: - id - base_severity type: object + AlertEventCustomAttributes: + additionalProperties: false + description: Object representing custom alert event attributes. + properties: + custom: + $ref: '#/components/schemas/AlertEventCustomAttributesCustom' + links: + $ref: '#/components/schemas/AlertEventCustomAttributesLinks' + priority: + $ref: '#/components/schemas/AlertEventCustomAttributesPriority' + status: + $ref: '#/components/schemas/AlertEventCustomAttributesStatus' + type: object + AlertEventCustomAttributesCustom: + additionalProperties: {} + description: Custom attributes. Support up to 100 properties and a maximum nesting + depth of 10 levels. + example: {} + type: object + AlertEventCustomAttributesLinks: + description: The links related to the event. + items: + $ref: '#/components/schemas/AlertEventCustomAttributesLinksItems' + maxItems: 20 + minItems: 1 + type: array + AlertEventCustomAttributesLinksItems: + description: A link. + properties: + category: + $ref: '#/components/schemas/AlertEventCustomAttributesLinksItemsCategory' + title: + description: The title of the link. Limited to 300 characters. + example: Runbook Link + maxLength: 300 + type: string + url: + description: The URL of the link. Limited to 2048 characters. + example: https://app.datadoghq.com/runbook + maxLength: 2048 + type: string + required: + - url + - category + type: object + AlertEventCustomAttributesLinksItemsCategory: + description: The category of the link. + enum: + - runbook + example: runbook + type: string + x-enum-varnames: + - RUNBOOK + AlertEventCustomAttributesPriority: + description: The priority of the alert. + enum: + - '1' + - '2' + - '3' + - '4' + - '5' + example: '1' + type: string + x-enum-varnames: + - PRIORITY_ONE + - PRIORITY_TWO + - PRIORITY_THREE + - PRIORITY_FOUR + - PRIORITY_FIVE + AlertEventCustomAttributesStatus: + description: The status of the alert. + enum: + - info + - warn + - error + - ok + example: warn + type: string + x-enum-varnames: + - INFO + - WARN + - ERROR + - OK Annotation: description: A list of annotations used in the workflow. These are like sticky notes for your workflow! @@ -13904,15 +13987,16 @@ 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 to identify the type of event. For example, `change` + or `alert`. enum: - change + - alert example: change type: string x-enum-varnames: - CHANGE + - ALERT EventCreateRequest: description: Object representing an event creation request. properties: @@ -13920,12 +14004,17 @@ components: $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. @@ -13940,6 +14029,12 @@ components: properties: attributes: $ref: '#/components/schemas/EventCreateResponseAttributes' + id: + description: A numerical ID compatible with the V1 endpoint. This field + is not populated in response from the V2 endpoint. To retrieve this ID, + refer to the event attributes in the Event Explorer. + example: _ + type: string type: description: Event type example: event @@ -13961,8 +14056,10 @@ components: EventCreateResponseAttributesAttributesEvt: description: JSON object of event system attributes. properties: - id: - description: Event id + uid: + description: A unique identifier for the event. You can use this ID to query + or reference the event in the V2 endpoint. + example: ABCDEFGHIJKLMNOPQRSTUVWX type: string type: object EventCreateResponsePayload: @@ -13970,6 +14067,17 @@ components: properties: data: $ref: '#/components/schemas/EventCreateResponse' + links: + $ref: '#/components/schemas/EventCreateResponsePayloadLinks' + type: object + EventCreateResponsePayloadLinks: + description: Links attributes. + properties: + self: + description: The URL of the event. This link is only functional when using + the `app` subdomain. + example: https://app.datadoghq.com/event/event?uid=ABCDEFGHIJKLMNOPQRSTUVWX + type: string type: object EventPayload: description: Event attributes. @@ -13977,12 +14085,15 @@ components: aggregation_key: description: An arbitrary string to use for aggregation when correlating events. Limited to 100 characters. + example: aggregation_key_123 maxLength: 100 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. example: payment_processed feature flag has been enabled @@ -13996,7 +14107,10 @@ components: - env:test items: description: A tag. + maxLength: 200 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) @@ -14022,6 +14136,16 @@ components: event category. oneOf: - $ref: '#/components/schemas/ChangeEventCustomAttributes' + - $ref: '#/components/schemas/AlertEventCustomAttributes' + EventPayloadIntegrationId: + description: Integration IDs sourced from integration manifests. Currently, + only `custom-events` is supported. + 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: @@ -45640,7 +45764,8 @@ paths: - 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) + 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." operationId: CreateEvent @@ -45652,6 +45777,7 @@ paths: value: data: attributes: + aggregation_key: aggregation_key_123 attributes: author: name: datadog@datadog.com @@ -45680,6 +45806,7 @@ paths: rule: datacenter: devcycle.us1.prod category: change + integration_id: custom-events message: payment_processed feature flag has been enabled tags: - env:test @@ -45690,7 +45817,7 @@ paths: description: Event request object required: true responses: - '200': + '202': content: application/json: schema: @@ -45713,6 +45840,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/examples/v2/events/CreateEvent.ts b/examples/v2/events/CreateEvent.ts index b08a4499b3f0..244b0faf1d95 100644 --- a/examples/v2/events/CreateEvent.ts +++ b/examples/v2/events/CreateEvent.ts @@ -11,6 +11,7 @@ const params: v2.EventsApiCreateEventRequest = { body: { data: { attributes: { + aggregationKey: "aggregation_key_123", attributes: { author: { name: "datadog@datadog.com", @@ -42,6 +43,7 @@ const params: v2.EventsApiCreateEventRequest = { }, }, category: "change", + integrationId: "custom-events", message: "payment_processed feature flag has been enabled", tags: ["env:test"], title: "payment_processed feature flag updated", diff --git a/features/v2/events.feature b/features/v2/events.feature index a8c1307ac683..b13848eb061e 100644 --- a/features/v2/events.feature +++ b/features/v2/events.feature @@ -53,16 +53,16 @@ Feature: Events @generated @skip @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": "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", "integration_id": "custom-events", "message": "payment_processed feature flag has been enabled", "tags": ["env: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 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": "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", "integration_id": "custom-events", "message": "payment_processed feature flag has been enabled", "tags": ["env: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 @team:DataDog/event-management Scenario: Search events returns "Bad Request" response diff --git a/packages/datadog-api-client-common/servers.ts b/packages/datadog-api-client-common/servers.ts index 00f033949a1b..9dc3d1d2f36c 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..fe2bdfcd5221 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" @@ -455,7 +455,7 @@ export class EventsApi { /** * This endpoint allows you to post events. * - * ✅ **Only events with the `change` category** are in General Availability. See [Change Tracking](https://docs.datadoghq.com/change_tracking) for more details. + * ✅ **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, please use the V1 endpoint. * @param param The request object diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index ac1d8f3cf04d..698db578fc66 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -738,6 +738,11 @@ export { ActiveBillingDimensionsBody } from "./models/ActiveBillingDimensionsBod export { ActiveBillingDimensionsResponse } from "./models/ActiveBillingDimensionsResponse"; export { ActiveBillingDimensionsType } from "./models/ActiveBillingDimensionsType"; 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"; @@ -1523,8 +1528,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..2dd35ced8a93 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AlertEventCustomAttributes.ts @@ -0,0 +1,68 @@ +/** + * 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"; + +/** + * Object representing custom alert event attributes. + */ +export class AlertEventCustomAttributes { + /** + * Custom attributes. Support up to 100 properties and a maximum nesting depth of 10 levels. + */ + "custom"?: { [key: string]: any }; + /** + * The links related to the event. + */ + "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", + }, + }; + + /** + * @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..ee2a2cb5c31e --- /dev/null +++ b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItems.ts @@ -0,0 +1,71 @@ +/** + * 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 title of the link. Limited to 300 characters. + */ + "title"?: string; + /** + * The URL of the link. Limited to 2048 characters. + */ + "url": 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 = { + category: { + baseName: "category", + type: "AlertEventCustomAttributesLinksItemsCategory", + required: true, + }, + title: { + baseName: "title", + type: "string", + }, + url: { + baseName: "url", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @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..6090e0b4dc17 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesLinksItemsCategory.ts @@ -0,0 +1,16 @@ +/** + * 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 + | UnparsedObject; +export const RUNBOOK = "runbook"; 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..a075963f1a1f --- /dev/null +++ b/packages/datadog-api-client-v2/models/AlertEventCustomAttributesStatus.ts @@ -0,0 +1,22 @@ +/** + * 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 INFO + | typeof WARN + | typeof ERROR + | typeof OK + | UnparsedObject; +export const INFO = "info"; +export const WARN = "warn"; +export const ERROR = "error"; +export const OK = "ok"; diff --git a/packages/datadog-api-client-v2/models/EventCategory.ts b/packages/datadog-api-client-v2/models/EventCategory.ts index 2b1796fd87d6..a2cb7d7fd4c3 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 to identify the type of event. For example, `change` or `alert`. */ -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..dc7264ebd0de 100644 --- a/packages/datadog-api-client-v2/models/EventCreateRequest.ts +++ b/packages/datadog-api-client-v2/models/EventCreateRequest.ts @@ -15,11 +15,11 @@ 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..32a69db7be3c 100644 --- a/packages/datadog-api-client-v2/models/EventCreateRequestPayload.ts +++ b/packages/datadog-api-client-v2/models/EventCreateRequestPayload.ts @@ -14,7 +14,7 @@ export class EventCreateRequestPayload { /** * Object representing an event creation request. */ - "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..ea624f8a450c 100644 --- a/packages/datadog-api-client-v2/models/EventCreateResponse.ts +++ b/packages/datadog-api-client-v2/models/EventCreateResponse.ts @@ -15,6 +15,10 @@ export class EventCreateResponse { * JSON object containing all events attributes and their associated values. */ "attributes"?: EventCreateResponseAttributes; + /** + * A numerical ID compatible with the V1 endpoint. This field is not populated in response from the V2 endpoint. To retrieve this ID, refer to the event attributes in the Event Explorer. + */ + "id"?: string; /** * Event type */ @@ -40,6 +44,10 @@ export class EventCreateResponse { baseName: "attributes", type: "EventCreateResponseAttributes", }, + id: { + baseName: "id", + type: "string", + }, type: { baseName: "type", type: "string", diff --git a/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributesEvt.ts b/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributesEvt.ts index c21556081522..d3a6bd686c8a 100644 --- a/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributesEvt.ts +++ b/packages/datadog-api-client-v2/models/EventCreateResponseAttributesAttributesEvt.ts @@ -11,9 +11,9 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util"; */ export class EventCreateResponseAttributesAttributesEvt { /** - * Event id + * A unique identifier for the event. You can use this ID to query or reference the event in the V2 endpoint. */ - "id"?: string; + "uid"?: string; /** * A container for additional, undeclared properties. @@ -31,8 +31,8 @@ export class EventCreateResponseAttributesAttributesEvt { * @ignore */ static readonly attributeTypeMap: AttributeTypeMap = { - id: { - baseName: "id", + uid: { + baseName: "uid", type: "string", }, additionalProperties: { diff --git a/packages/datadog-api-client-v2/models/EventCreateResponsePayload.ts b/packages/datadog-api-client-v2/models/EventCreateResponsePayload.ts index b0a1da3130c1..56fd4d679ab5 100644 --- a/packages/datadog-api-client-v2/models/EventCreateResponsePayload.ts +++ b/packages/datadog-api-client-v2/models/EventCreateResponsePayload.ts @@ -4,6 +4,7 @@ * Copyright 2020-Present Datadog, Inc. */ import { EventCreateResponse } from "./EventCreateResponse"; +import { EventCreateResponsePayloadLinks } from "./EventCreateResponsePayloadLinks"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; @@ -15,6 +16,10 @@ export class EventCreateResponsePayload { * Object containing an event response. */ "data"?: EventCreateResponse; + /** + * Links attributes. + */ + "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..01376e94cf16 --- /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 attributes. + */ +export class EventCreateResponsePayloadLinks { + /** + * The URL of the event. This link is only functional when using the `app` 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..90a88172ae9a 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"; @@ -21,9 +22,13 @@ export class EventPayload { */ "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 to identify the type of event. For example, `change` or `alert`. */ "category": EventCategory; + /** + * Integration IDs sourced from integration manifests. Currently, only `custom-events` is supported. + */ + "integrationId"?: EventPayloadIntegrationId; /** * The body of the event. Limited to 4000 characters. */ @@ -74,6 +79,10 @@ export class EventPayload { type: "EventCategory", required: true, }, + integrationId: { + baseName: "integration_id", + type: "EventPayloadIntegrationId", + }, message: { baseName: "message", type: "string", diff --git a/packages/datadog-api-client-v2/models/EventPayloadAttributes.ts b/packages/datadog-api-client-v2/models/EventPayloadAttributes.ts index 5bdf3f3dd14f..b563eae38d88 100644 --- a/packages/datadog-api-client-v2/models/EventPayloadAttributes.ts +++ b/packages/datadog-api-client-v2/models/EventPayloadAttributes.ts @@ -3,6 +3,7 @@ * 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"; @@ -13,4 +14,5 @@ import { UnparsedObject } from "../../datadog-api-client-common/util"; 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..6b67cc8b2609 --- /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 IDs sourced from integration manifests. Currently, only `custom-events` is supported. + */ + +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 4abc6558309b..6d0fcd565b32 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -61,6 +61,8 @@ import { ActiveBillingDimensionsAttributes } from "./ActiveBillingDimensionsAttr import { ActiveBillingDimensionsBody } from "./ActiveBillingDimensionsBody"; import { ActiveBillingDimensionsResponse } from "./ActiveBillingDimensionsResponse"; import { Advisory } from "./Advisory"; +import { AlertEventCustomAttributes } from "./AlertEventCustomAttributes"; +import { AlertEventCustomAttributesLinksItems } from "./AlertEventCustomAttributesLinksItems"; import { Annotation } from "./Annotation"; import { AnnotationDisplay } from "./AnnotationDisplay"; import { AnnotationDisplayBounds } from "./AnnotationDisplayBounds"; @@ -623,6 +625,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"; @@ -1922,6 +1925,9 @@ const enumsMap: { [key: string]: any[] } = { ActionConnectionDataType: ["action_connection"], ActionQueryType: ["action"], ActiveBillingDimensionsType: ["billing_dimensions"], + AlertEventCustomAttributesLinksItemsCategory: ["runbook"], + AlertEventCustomAttributesPriority: ["1", "2", "3", "4", "5"], + AlertEventCustomAttributesStatus: ["info", "warn", "error", "ok"], ApmRetentionFilterType: ["apm_retention_filter"], AppBuilderEventName: [ "pageChange", @@ -2221,8 +2227,9 @@ const enumsMap: { [key: string]: any[] } = { EscalationPolicyUpdateRequestDataRelationshipsTeamsDataItemsType: ["teams"], EscalationPolicyUpdateRequestDataType: ["policies"], EscalationPolicyUserType: ["users"], - EventCategory: ["change"], + EventCategory: ["change", "alert"], EventCreateRequestType: ["event"], + EventPayloadIntegrationId: ["custom-events"], EventPriority: ["normal", "low"], EventStatusType: [ "failure", @@ -3218,6 +3225,8 @@ const typeMap: { [index: string]: any } = { ActiveBillingDimensionsBody: ActiveBillingDimensionsBody, ActiveBillingDimensionsResponse: ActiveBillingDimensionsResponse, Advisory: Advisory, + AlertEventCustomAttributes: AlertEventCustomAttributes, + AlertEventCustomAttributesLinksItems: AlertEventCustomAttributesLinksItems, Annotation: Annotation, AnnotationDisplay: AnnotationDisplay, AnnotationDisplayBounds: AnnotationDisplayBounds, @@ -3889,6 +3898,7 @@ const typeMap: { [index: string]: any } = { EventCreateResponseAttributesAttributesEvt: EventCreateResponseAttributesAttributesEvt, EventCreateResponsePayload: EventCreateResponsePayload, + EventCreateResponsePayloadLinks: EventCreateResponsePayloadLinks, EventPayload: EventPayload, EventResponse: EventResponse, EventResponseAttributes: EventResponseAttributes, @@ -5449,7 +5459,10 @@ const oneOfMap: { [index: string]: string[] } = { "ScheduleData", ], EscalationTarget: ["TeamTarget", "UserTarget", "ScheduleTarget"], - EventPayloadAttributes: ["ChangeEventCustomAttributes"], + EventPayloadAttributes: [ + "ChangeEventCustomAttributes", + "AlertEventCustomAttributes", + ], HTTPCredentials: ["HTTPTokenAuth"], HTTPCredentialsUpdate: ["HTTPTokenAuthUpdate"], IncidentAttachmentAttributes: [