Skip to content
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
167 changes: 167 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21602,6 +21602,82 @@ components:
- type
- attributes
type: object
IncidentCreatePageAttributes:
description: Attributes for creating a page from an incident.
properties:
description:
description: Description of the page.
example: Page created for incident response
nullable: true
type: string
services:
description: List of services associated with the page.
example:
- web-service
- api-service
items:
type: string
nullable: true
type: array
tags:
description: List of tags for the page.
example:
- urgent
- production
items:
type: string
nullable: true
type: array
target:
$ref: '#/components/schemas/IncidentPageTarget'
title:
description: Title of the page.
example: Incident Response Page
type: string
required:
- title
- target
type: object
IncidentCreatePageFromIncidentData:
description: Data for creating a page from an incident.
properties:
attributes:
$ref: '#/components/schemas/IncidentCreatePageAttributes'
type:
$ref: '#/components/schemas/IncidentPageType'
required:
- type
- attributes
type: object
IncidentCreatePageFromIncidentRequest:
description: Request to create a page from an incident.
properties:
data:
$ref: '#/components/schemas/IncidentCreatePageFromIncidentData'
required:
- data
type: object
IncidentCreatePageResponse:
description: Response from creating a page from an incident.
properties:
data:
$ref: '#/components/schemas/IncidentCreatePageResponseData'
required:
- data
type: object
IncidentCreatePageResponseData:
description: Data from creating a page.
properties:
id:
description: The UUID of the created page.
example: 00000000-0000-0000-0000-000000000000
type: string
type:
$ref: '#/components/schemas/IncidentPageIdType'
required:
- id
- type
type: object
IncidentCreateRelationships:
description: The relationships the incident will have with other resources once
created.
Expand Down Expand Up @@ -22586,6 +22662,48 @@ components:
- id
- type
type: object
IncidentPageIdType:
description: Incident page ID type.
enum:
- page_uuid
example: page_uuid
type: string
x-enum-varnames:
- PAGE_UUID
IncidentPageTarget:
description: Target for creating a page from an incident.
properties:
identifier:
description: The identifier of the target (team handle, team UUID, or user
UUID).
example: team-handle
type: string
type:
$ref: '#/components/schemas/IncidentPageTargetType'
required:
- type
- identifier
type: object
IncidentPageTargetType:
description: Type of page target for incident pages.
enum:
- team_handle
- team_uuid
- user_uuid
example: team_handle
type: string
x-enum-varnames:
- TEAM_HANDLE
- TEAM_UUID
- USER_UUID
IncidentPageType:
description: Incident page type.
enum:
- page
example: page
type: string
x-enum-varnames:
- PAGE
IncidentPostmortemType:
default: incident_postmortems
description: Incident postmortem resource type.
Expand Down Expand Up @@ -50878,6 +50996,7 @@ components:
is not required to set downtimes.
monitors_read: View monitors.
monitors_write: Edit, delete, and resolve individual monitors.
oncall_page: Create and manage on-call pages.
org_connections_read: Read cross organization connections.
org_connections_write: Create, edit, and delete cross organization connections.
org_management: Edit org configurations, including authentication and
Expand Down Expand Up @@ -59667,6 +59786,54 @@ paths:
x-unstable: '**Note**: This endpoint is in Preview.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/incidents/{incident_id}/page:
post:
description: Create a page from an incident.
operationId: CreatePageFromIncident
parameters:
- $ref: '#/components/parameters/IncidentIDPathParameter'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/IncidentCreatePageFromIncidentRequest'
description: Page creation request payload.
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/IncidentCreatePageResponse'
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:
- incident_read
- oncall_page
summary: Create a page from an incident
tags:
- Incidents
x-codegen-request-body-name: body
x-permission:
operator: AND
permissions:
- incident_read
- oncall_page
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/incidents/{incident_id}/relationships/integrations:
get:
description: Get all integration metadata for an incident.
Expand Down
37 changes: 37 additions & 0 deletions examples/v2/incidents/CreatePageFromIncident.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Create a page from an incident returns "OK" response
*/

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

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.createPageFromIncident"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

const params: v2.IncidentsApiCreatePageFromIncidentRequest = {
body: {
data: {
attributes: {
description: "Page created for incident response",
services: ["web-service", "api-service"],
tags: ["urgent", "production"],
target: {
identifier: "team-handle",
type: "team_handle",
},
title: "Incident Response Page",
},
type: "page",
},
},
incidentId: "incident_id",
};

apiInstance
.createPageFromIncident(params)
.then((data: v2.IncidentCreatePageResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
11 changes: 11 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5530,6 +5530,17 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
},
"operationResponseType": "{}",
},
"v2.CreatePageFromIncident": {
"incidentId": {
"type": "string",
"format": "",
},
"body": {
"type": "IncidentCreatePageFromIncidentRequest",
"format": "",
},
"operationResponseType": "IncidentCreatePageResponse",
},
"v2.ListIncidentIntegrations": {
"incidentId": {
"type": "string",
Expand Down
27 changes: 27 additions & 0 deletions features/v2/incidents.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,33 @@ Feature: Incidents
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/incident-app
Scenario: Create a page from an incident returns "Bad Request" response
Given operation "CreatePageFromIncident" enabled
And new "CreatePageFromIncident" request
And request contains "incident_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/incident-app
Scenario: Create a page from an incident returns "Not Found" response
Given operation "CreatePageFromIncident" enabled
And new "CreatePageFromIncident" request
And request contains "incident_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/incident-app
Scenario: Create a page from an incident returns "OK" response
Given operation "CreatePageFromIncident" enabled
And new "CreatePageFromIncident" request
And request contains "incident_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}}
When the request is sent
Then the response status is 200 OK

@team:DataDog/incident-app
Scenario: Create an incident attachment returns "OK" response
Given operation "UpdateIncidentAttachments" enabled
Expand Down
7 changes: 7 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,13 @@
"type": "idempotent"
}
},
"CreatePageFromIncident": {
"tag": "Incidents",
"undo": {
"parameters": [],
"type": "unsafe"
}
},
"ListIncidentIntegrations": {
"tag": "Incidents",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client-common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export function createConfiguration(
"v2.createIncidentNotificationTemplate": false,
"v2.createIncidentTodo": false,
"v2.createIncidentType": false,
"v2.createPageFromIncident": false,
"v2.deleteIncident": false,
"v2.deleteIncidentImpact": false,
"v2.deleteIncidentIntegration": false,
Expand Down
Loading