Skip to content

Create API spec for v2 get an event #2395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-19 12:11:25.321241",
"spec_repo_commit": "a171e0a8"
"regenerated": "2025-06-20 13:49:04.166454",
"spec_repo_commit": "78730ba3"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-19 12:11:25.337389",
"spec_repo_commit": "a171e0a8"
"regenerated": "2025-06-20 13:49:04.182475",
"spec_repo_commit": "78730ba3"
}
}
}
316 changes: 316 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,74 @@ components:
- id
- base_severity
type: object
AlertEventAttributes:
description: Alert event attributes.
properties:
aggregation_key:
$ref: '#/components/schemas/V2EventAggregationKey'
custom:
description: JSON object of custom attributes.
example: {}
type: object
evt:
$ref: '#/components/schemas/EventSystemAttributes'
links:
description: The links related to the event.
example:
- category: runbook
title: Runbook Link
url: https://app.datadoghq.com/runbook
items:
$ref: '#/components/schemas/AlertEventAttributesLinksItem'
type: array
priority:
$ref: '#/components/schemas/AlertEventAttributesPriority'
service:
$ref: '#/components/schemas/V2EventService'
timestamp:
$ref: '#/components/schemas/V2EventTimestamp'
title:
$ref: '#/components/schemas/V2EventTitle'
type: object
AlertEventAttributesLinksItem:
description: A link.
properties:
category:
$ref: '#/components/schemas/AlertEventAttributesLinksItemCategory'
title:
description: The display text of the link.
type: string
url:
description: The URL of the link.
type: string
type: object
AlertEventAttributesLinksItemCategory:
description: The category of the link.
enum:
- runbook
- documentation
- dashboard
type: string
x-enum-varnames:
- RUNBOOK
- DOCUMENTATION
- DASHBOARD
AlertEventAttributesPriority:
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
AlertEventCustomAttributes:
additionalProperties: false
description: Alert event attributes.
Expand Down Expand Up @@ -7009,6 +7077,112 @@ components:
format: int64
type: integer
type: object
ChangeEventAttributes:
description: Change event attributes.
properties:
aggregation_key:
$ref: '#/components/schemas/V2EventAggregationKey'
author:
$ref: '#/components/schemas/ChangeEventAttributesAuthor'
change_metadata:
description: JSON object of change metadata.
example:
dd:
team: datadog_team
user_email: datadog@datadog.com
user_id: datadog_user_id
user_name: datadog_username
type: object
changed_resource:
$ref: '#/components/schemas/ChangeEventAttributesChangedResource'
evt:
$ref: '#/components/schemas/EventSystemAttributes'
impacted_resources:
description: A list of resources impacted by this change.
example:
- name: service-name
type: service
items:
$ref: '#/components/schemas/ChangeEventAttributesImpactedResourcesItem'
type: array
new_value:
description: The new state of the changed resource.
example:
enabled: true
percentage: 50%
rule:
datacenter: devcycle.us1.prod
type: object
prev_value:
description: The previous state of the changed resource.
example:
enabled: true
percentage: 10%
rule:
datacenter: devcycle.us1.prod
type: object
service:
$ref: '#/components/schemas/V2EventService'
timestamp:
$ref: '#/components/schemas/V2EventTimestamp'
title:
$ref: '#/components/schemas/V2EventTitle'
type: object
ChangeEventAttributesAuthor:
description: The entity that made the change.
properties:
name:
description: The name of the user or system that made the change.
example: example@datadog.com
type: string
type:
$ref: '#/components/schemas/ChangeEventAttributesAuthorType'
type: object
ChangeEventAttributesAuthorType:
description: The type of the author.
enum:
- user
- system
example: user
type: string
x-enum-varnames:
- USER
- SYSTEM
ChangeEventAttributesChangedResource:
description: A uniquely identified resource.
properties:
name:
description: The name of the changed resource.
type: string
type:
$ref: '#/components/schemas/ChangeEventAttributesChangedResourceType'
type: object
ChangeEventAttributesChangedResourceType:
description: The type of the changed resource.
enum:
- feature_flag
- configuration
example: feature_flag
type: string
x-enum-varnames:
- FEATURE_FLAG
- CONFIGURATION
ChangeEventAttributesImpactedResourcesItem:
description: A uniquely identified resource.
properties:
name:
description: The name of the impacted resource.
type: string
type:
$ref: '#/components/schemas/ChangeEventAttributesImpactedResourcesItemType'
type: object
ChangeEventAttributesImpactedResourcesItemType:
description: The type of the impacted resource.
enum:
- service
type: string
x-enum-varnames:
- SERVICE
ChangeEventCustomAttributes:
additionalProperties: false
description: Change event attributes.
Expand Down Expand Up @@ -14925,6 +15099,44 @@ components:
- USER_UPDATE
- RECOMMENDATION
- SNAPSHOT
EventSystemAttributes:
description: JSON object of event system attributes.
properties:
category:
$ref: '#/components/schemas/EventSystemAttributesCategory'
id:
description: Event identifier. This field is deprecated and will be removed
in a future version. Use the `uid` field instead.
type: string
integration_id:
$ref: '#/components/schemas/EventSystemAttributesIntegrationId'
source_id:
description: The source type ID of the event.
format: int64
type: integer
uid:
description: A unique identifier for the event. You can use this identifier
to query or reference the event.
type: string
type: object
EventSystemAttributesCategory:
description: Event category identifying the type of event.
enum:
- change
- alert
example: change
type: string
x-enum-varnames:
- CHANGE
- ALERT
EventSystemAttributesIntegrationId:
description: Integration ID sourced from integration manifests.
enum:
- custom-events
example: custom-events
type: string
x-enum-varnames:
- CUSTOM_EVENTS
EventType:
default: event
description: Type of the event.
Expand Down Expand Up @@ -40580,6 +40792,70 @@ components:
type: string
x-enum-varnames:
- USERS
V2Event:
description: An event object.
properties:
attributes:
$ref: '#/components/schemas/V2EventAttributes'
id:
description: The event's ID.
example: ''
type: string
type:
description: Entity type.
example: event
type: string
type: object
V2EventAggregationKey:
description: Aggregation key of the event.
example: aggregation-key
type: string
V2EventAttributes:
description: Event attributes.
properties:
attributes:
$ref: '#/components/schemas/V2EventAttributesAttributes'
message:
description: Free-formed text associated with the event.
example: The event message
type: string
tags:
description: A list of tags associated with the event.
example:
- env:api_client_test
items:
description: A tag.
type: string
type: array
timestamp:
description: Timestamp when the event occurred.
example: '2017-01-15T01:30:15.010000Z'
type: string
type: object
V2EventAttributesAttributes:
description: JSON object for category-specific attributes.
oneOf:
- $ref: '#/components/schemas/ChangeEventAttributes'
- $ref: '#/components/schemas/AlertEventAttributes'
V2EventResponse:
description: Get an event response.
properties:
data:
$ref: '#/components/schemas/V2Event'
type: object
V2EventService:
description: Service that triggered the event.
example: service-name
type: string
V2EventTimestamp:
description: POSIX timestamp of the event.
example: 175019386627
format: int64
type: integer
V2EventTitle:
description: The title of the event.
example: The event title
type: string
ValidationError:
description: Represents a single validation error, including a human-readable
title and metadata.
Expand Down Expand Up @@ -47374,6 +47650,46 @@ paths:
operator: OR
permissions:
- events_read
/api/v2/events/{event_id}:
get:
description: Get the details of an event by `event_id`.
operationId: GetEvent
parameters:
- description: The UID of the event.
in: path
name: event_id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/V2EventResponse'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- events_read
summary: Get an event
tags:
- Events
x-permission:
operator: OR
permissions:
- events_read
/api/v2/incidents:
get:
description: Get all incidents for the user's organization.
Expand Down
21 changes: 21 additions & 0 deletions examples/v2/events/GetEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Get an event returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.EventsApi(configuration);

const params: v2.EventsApiGetEventRequest = {
eventId: "AZeF-nTCAABzkAgGXzYPtgAA",
};

apiInstance
.getEvent(params)
.then((data: v2.V2EventResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Loading