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
117 changes: 117 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41880,6 +41880,83 @@ components:
type: string
x-enum-varnames:
- PERMISSIONS
PostmortemAttachmentRequest:
properties:
data:
$ref: '#/components/schemas/PostmortemAttachmentRequestData'
required:
- data
type: object
PostmortemAttachmentRequestAttributes:
description: Postmortem attachment attributes
properties:
cells:
description: The cells of the postmortem
items:
$ref: '#/components/schemas/PostmortemCell'
type: array
content:
description: The content of the postmortem
example: '# Incident Report - IR-123

[...]'
type: string
postmortem_template_id:
description: The ID of the postmortem template
example: 93645509-874e-45c4-adfa-623bfeaead89-123
type: string
title:
description: The title of the postmortem
example: Postmortem-IR-123
type: string
type: object
PostmortemAttachmentRequestData:
description: Postmortem attachment data
properties:
attributes:
$ref: '#/components/schemas/PostmortemAttachmentRequestAttributes'
type:
$ref: '#/components/schemas/IncidentAttachmentType'
required:
- type
- attributes
type: object
PostmortemCell:
description: A cell in the postmortem
properties:
attributes:
$ref: '#/components/schemas/PostmortemCellAttributes'
id:
description: The unique identifier of the cell
example: cell-1
type: string
type:
$ref: '#/components/schemas/PostmortemCellType'
type: object
PostmortemCellAttributes:
description: Attributes of a postmortem cell
properties:
definition:
$ref: '#/components/schemas/PostmortemCellDefinition'
type: object
PostmortemCellDefinition:
description: Definition of a postmortem cell
properties:
content:
description: The content of the cell in markdown format
example: '## Incident Summary

This incident was caused by...'
type: string
type: object
PostmortemCellType:
description: The postmortem cell resource type.
enum:
- markdown
example: markdown
type: string
x-enum-varnames:
- MARKDOWN
Powerpack:
description: Powerpacks are templated groups of dashboard widgets you can save
from an existing dashboard and turn into reusable packs in the widget tray.
Expand Down Expand Up @@ -71685,6 +71762,46 @@ paths:
- incident_write
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}/attachments/postmortems:
post:
description: Create a postmortem attachment for an incident.
operationId: CreateIncidentPostmortemAttachment
parameters:
- description: The ID of the incident
in: path
name: incident_id
required: true
schema:
example: 00000000-0000-0000-0000-000000000000
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PostmortemAttachmentRequest'
required: true
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/Attachment'
description: Created
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/JSONAPIErrorResponse'
description: Bad Request
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Create postmortem attachment
tags:
- Incidents
x-unstable: '**Note**: This endpoint is in public beta and it''s subject to
change.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/incidents/{incident_id}/attachments/{attachment_id}:
delete:
Expand Down
64 changes: 64 additions & 0 deletions examples/v2/incidents/CreateIncidentPostmortemAttachment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Create postmortem attachment returns "Created" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.Attachment;
import com.datadog.api.client.v2.model.IncidentAttachmentType;
import com.datadog.api.client.v2.model.PostmortemAttachmentRequest;
import com.datadog.api.client.v2.model.PostmortemAttachmentRequestAttributes;
import com.datadog.api.client.v2.model.PostmortemAttachmentRequestData;
import com.datadog.api.client.v2.model.PostmortemCell;
import com.datadog.api.client.v2.model.PostmortemCellAttributes;
import com.datadog.api.client.v2.model.PostmortemCellDefinition;
import com.datadog.api.client.v2.model.PostmortemCellType;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.createIncidentPostmortemAttachment", true);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);

PostmortemAttachmentRequest body =
new PostmortemAttachmentRequest()
.data(
new PostmortemAttachmentRequestData()
.attributes(
new PostmortemAttachmentRequestAttributes()
.cells(
Collections.singletonList(
new PostmortemCell()
.attributes(
new PostmortemCellAttributes()
.definition(
new PostmortemCellDefinition()
.content(
"""
## Incident Summary
This incident was caused by...
""")))
.id("cell-1")
.type(PostmortemCellType.MARKDOWN)))
.content("""
# Incident Report - IR-123
[...]
""")
.postmortemTemplateId("93645509-874e-45c4-adfa-623bfeaead89-123")
.title("Postmortem-IR-123"))
.type(IncidentAttachmentType.INCIDENT_ATTACHMENTS));

try {
Attachment result =
apiInstance.createIncidentPostmortemAttachment(
"00000000-0000-0000-0000-000000000000", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IncidentsApi#createIncidentPostmortemAttachment");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ public class ApiClient {
put("v2.createIncidentIntegration", false);
put("v2.createIncidentNotificationRule", false);
put("v2.createIncidentNotificationTemplate", false);
put("v2.createIncidentPostmortemAttachment", false);
put("v2.createIncidentTodo", false);
put("v2.createIncidentType", false);
put("v2.deleteIncident", false);
Expand Down
Loading
Loading