Skip to content

Commit 1e6ece1

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit c5fabaf of spec repo
1 parent f175fd0 commit 1e6ece1

15 files changed

+1028
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41880,6 +41880,83 @@ components:
4188041880
type: string
4188141881
x-enum-varnames:
4188241882
- PERMISSIONS
41883+
PostmortemAttachmentRequest:
41884+
properties:
41885+
data:
41886+
$ref: '#/components/schemas/PostmortemAttachmentRequestData'
41887+
required:
41888+
- data
41889+
type: object
41890+
PostmortemAttachmentRequestAttributes:
41891+
description: Postmortem attachment attributes
41892+
properties:
41893+
cells:
41894+
description: The cells of the postmortem
41895+
items:
41896+
$ref: '#/components/schemas/PostmortemCell'
41897+
type: array
41898+
content:
41899+
description: The content of the postmortem
41900+
example: '# Incident Report - IR-123
41901+
41902+
\[...]'
41903+
type: string
41904+
postmortem_template_id:
41905+
description: The ID of the postmortem template
41906+
example: 93645509-874e-45c4-adfa-623bfeaead89-123
41907+
type: string
41908+
title:
41909+
description: The title of the postmortem
41910+
example: Postmortem-IR-123
41911+
type: string
41912+
type: object
41913+
PostmortemAttachmentRequestData:
41914+
description: Postmortem attachment data
41915+
properties:
41916+
attributes:
41917+
$ref: '#/components/schemas/PostmortemAttachmentRequestAttributes'
41918+
type:
41919+
$ref: '#/components/schemas/IncidentAttachmentType'
41920+
required:
41921+
- type
41922+
- attributes
41923+
type: object
41924+
PostmortemCell:
41925+
description: A cell in the postmortem
41926+
properties:
41927+
attributes:
41928+
$ref: '#/components/schemas/PostmortemCellAttributes'
41929+
id:
41930+
description: The unique identifier of the cell
41931+
example: cell-1
41932+
type: string
41933+
type:
41934+
$ref: '#/components/schemas/PostmortemCellType'
41935+
type: object
41936+
PostmortemCellAttributes:
41937+
description: Attributes of a postmortem cell
41938+
properties:
41939+
definition:
41940+
$ref: '#/components/schemas/PostmortemCellDefinition'
41941+
type: object
41942+
PostmortemCellDefinition:
41943+
description: Definition of a postmortem cell
41944+
properties:
41945+
content:
41946+
description: The content of the cell in markdown format
41947+
example: '## Incident Summary
41948+
41949+
This incident was caused by...'
41950+
type: string
41951+
type: object
41952+
PostmortemCellType:
41953+
description: The postmortem cell resource type.
41954+
enum:
41955+
- markdown
41956+
example: markdown
41957+
type: string
41958+
x-enum-varnames:
41959+
- MARKDOWN
4188341960
Powerpack:
4188441961
description: Powerpacks are templated groups of dashboard widgets you can save
4188541962
from an existing dashboard and turn into reusable packs in the widget tray.
@@ -71685,6 +71762,46 @@ paths:
7168571762
- incident_write
7168671763
x-unstable: '**Note**: This endpoint is in Preview.
7168771764

71765+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
71766+
/api/v2/incidents/{incident_id}/attachments/postmortems:
71767+
post:
71768+
description: Create a postmortem attachment for an incident.
71769+
operationId: CreateIncidentPostmortemAttachment
71770+
parameters:
71771+
- description: The ID of the incident
71772+
in: path
71773+
name: incident_id
71774+
required: true
71775+
schema:
71776+
example: 00000000-0000-0000-0000-000000000000
71777+
type: string
71778+
requestBody:
71779+
content:
71780+
application/json:
71781+
schema:
71782+
$ref: '#/components/schemas/PostmortemAttachmentRequest'
71783+
required: true
71784+
responses:
71785+
'201':
71786+
content:
71787+
application/json:
71788+
schema:
71789+
$ref: '#/components/schemas/Attachment'
71790+
description: Created
71791+
'400':
71792+
content:
71793+
application/json:
71794+
schema:
71795+
$ref: '#/components/schemas/JSONAPIErrorResponse'
71796+
description: Bad Request
71797+
'429':
71798+
$ref: '#/components/responses/TooManyRequestsResponse'
71799+
summary: Create postmortem attachment
71800+
tags:
71801+
- Incidents
71802+
x-unstable: '**Note**: This endpoint is in public beta and it''s subject to
71803+
change.
71804+
7168871805
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
7168971806
/api/v2/incidents/{incident_id}/attachments/{attachment_id}:
7169071807
delete:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Create postmortem attachment returns "Created" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.create_incident_postmortem_attachment".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
8+
9+
body = DatadogAPIClient::V2::PostmortemAttachmentRequest.new({
10+
data: DatadogAPIClient::V2::PostmortemAttachmentRequestData.new({
11+
attributes: DatadogAPIClient::V2::PostmortemAttachmentRequestAttributes.new({
12+
cells: [
13+
DatadogAPIClient::V2::PostmortemCell.new({
14+
attributes: DatadogAPIClient::V2::PostmortemCellAttributes.new({
15+
definition: DatadogAPIClient::V2::PostmortemCellDefinition.new({
16+
content: '## Incident Summary\nThis incident was caused by...',
17+
}),
18+
}),
19+
id: "cell-1",
20+
type: DatadogAPIClient::V2::PostmortemCellType::MARKDOWN,
21+
}),
22+
],
23+
content: '# Incident Report - IR-123\n\\[...]',
24+
postmortem_template_id: "93645509-874e-45c4-adfa-623bfeaead89-123",
25+
title: "Postmortem-IR-123",
26+
}),
27+
type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS,
28+
}),
29+
})
30+
p api_instance.create_incident_postmortem_attachment("00000000-0000-0000-0000-000000000000", body)

features/scenarios_model_mapping.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,10 @@
21402140
"include" => "String",
21412141
"body" => "CreateAttachmentRequest",
21422142
},
2143+
"v2.CreateIncidentPostmortemAttachment" => {
2144+
"incident_id" => "String",
2145+
"body" => "PostmortemAttachmentRequest",
2146+
},
21432147
"v2.DeleteIncidentAttachment" => {
21442148
"incident_id" => "String",
21452149
"attachment_id" => "Object",

features/v2/incidents.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,24 @@ Feature: Incidents
253253
When the request is sent
254254
Then the response status is 404 Not Found
255255

256+
@generated @skip @team:DataDog/incident-app
257+
Scenario: Create postmortem attachment returns "Bad Request" response
258+
Given operation "CreateIncidentPostmortemAttachment" enabled
259+
And new "CreateIncidentPostmortemAttachment" request
260+
And request contains "incident_id" parameter from "REPLACE.ME"
261+
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"content": "## Incident Summary\nThis incident was caused by..."}}, "id": "cell-1", "type": "markdown"}], "content": "# Incident Report - IR-123\n\\[...]", "postmortem_template_id": "93645509-874e-45c4-adfa-623bfeaead89-123", "title": "Postmortem-IR-123"}, "type": "incident_attachments"}}
262+
When the request is sent
263+
Then the response status is 400 Bad Request
264+
265+
@generated @skip @team:DataDog/incident-app
266+
Scenario: Create postmortem attachment returns "Created" response
267+
Given operation "CreateIncidentPostmortemAttachment" enabled
268+
And new "CreateIncidentPostmortemAttachment" request
269+
And request contains "incident_id" parameter from "REPLACE.ME"
270+
And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"content": "## Incident Summary\nThis incident was caused by..."}}, "id": "cell-1", "type": "markdown"}], "content": "# Incident Report - IR-123\n\\[...]", "postmortem_template_id": "93645509-874e-45c4-adfa-623bfeaead89-123", "title": "Postmortem-IR-123"}, "type": "incident_attachments"}}
271+
When the request is sent
272+
Then the response status is 201 Created
273+
256274
@generated @skip @team:Datadog/incident-app
257275
Scenario: Delete a notification template returns "Bad Request" response
258276
Given operation "DeleteIncidentNotificationTemplate" enabled

features/v2/undo.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,14 @@
17341734
"type": "unsafe"
17351735
}
17361736
},
1737+
"CreateIncidentPostmortemAttachment": {
1738+
"tag": "Incidents",
1739+
"undo": {
1740+
"operationId": "TODO",
1741+
"parameters": [],
1742+
"type": "unsafe"
1743+
}
1744+
},
17371745
"DeleteIncidentAttachment": {
17381746
"tag": "Incidents",
17391747
"undo": {

lib/datadog_api_client/configuration.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ def initialize
253253
"v2.create_incident_integration": false,
254254
"v2.create_incident_notification_rule": false,
255255
"v2.create_incident_notification_template": false,
256+
"v2.create_incident_postmortem_attachment": false,
256257
"v2.create_incident_todo": false,
257258
"v2.create_incident_type": false,
258259
"v2.delete_incident": false,

lib/datadog_api_client/inflector.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3561,6 +3561,13 @@ def overrides
35613561
"v2.permission_attributes" => "PermissionAttributes",
35623562
"v2.permissions_response" => "PermissionsResponse",
35633563
"v2.permissions_type" => "PermissionsType",
3564+
"v2.postmortem_attachment_request" => "PostmortemAttachmentRequest",
3565+
"v2.postmortem_attachment_request_attributes" => "PostmortemAttachmentRequestAttributes",
3566+
"v2.postmortem_attachment_request_data" => "PostmortemAttachmentRequestData",
3567+
"v2.postmortem_cell" => "PostmortemCell",
3568+
"v2.postmortem_cell_attributes" => "PostmortemCellAttributes",
3569+
"v2.postmortem_cell_definition" => "PostmortemCellDefinition",
3570+
"v2.postmortem_cell_type" => "PostmortemCellType",
35643571
"v2.powerpack" => "Powerpack",
35653572
"v2.powerpack_attributes" => "PowerpackAttributes",
35663573
"v2.powerpack_data" => "PowerpackData",

lib/datadog_api_client/v2/api/incidents_api.rb

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,84 @@ def create_incident_notification_template_with_http_info(body, opts = {})
474474
return data, status_code, headers
475475
end
476476

477+
# Create postmortem attachment.
478+
#
479+
# @see #create_incident_postmortem_attachment_with_http_info
480+
def create_incident_postmortem_attachment(incident_id, body, opts = {})
481+
data, _status_code, _headers = create_incident_postmortem_attachment_with_http_info(incident_id, body, opts)
482+
data
483+
end
484+
485+
# Create postmortem attachment.
486+
#
487+
# Create a postmortem attachment for an incident.
488+
#
489+
# @param incident_id [String] The ID of the incident
490+
# @param body [PostmortemAttachmentRequest]
491+
# @param opts [Hash] the optional parameters
492+
# @return [Array<(Attachment, Integer, Hash)>] Attachment data, response status code and response headers
493+
def create_incident_postmortem_attachment_with_http_info(incident_id, body, opts = {})
494+
unstable_enabled = @api_client.config.unstable_operations["v2.create_incident_postmortem_attachment".to_sym]
495+
if unstable_enabled
496+
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_incident_postmortem_attachment")
497+
else
498+
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_incident_postmortem_attachment"))
499+
end
500+
501+
if @api_client.config.debugging
502+
@api_client.config.logger.debug 'Calling API: IncidentsAPI.create_incident_postmortem_attachment ...'
503+
end
504+
# verify the required parameter 'incident_id' is set
505+
if @api_client.config.client_side_validation && incident_id.nil?
506+
fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.create_incident_postmortem_attachment"
507+
end
508+
# verify the required parameter 'body' is set
509+
if @api_client.config.client_side_validation && body.nil?
510+
fail ArgumentError, "Missing the required parameter 'body' when calling IncidentsAPI.create_incident_postmortem_attachment"
511+
end
512+
# resource path
513+
local_var_path = '/api/v2/incidents/{incident_id}/attachments/postmortems'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/'))
514+
515+
# query parameters
516+
query_params = opts[:query_params] || {}
517+
518+
# header parameters
519+
header_params = opts[:header_params] || {}
520+
# HTTP header 'Accept' (if needed)
521+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
522+
# HTTP header 'Content-Type'
523+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
524+
525+
# form parameters
526+
form_params = opts[:form_params] || {}
527+
528+
# http body (model)
529+
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
530+
531+
# return_type
532+
return_type = opts[:debug_return_type] || 'Attachment'
533+
534+
# auth_names
535+
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
536+
537+
new_options = opts.merge(
538+
:operation => :create_incident_postmortem_attachment,
539+
:header_params => header_params,
540+
:query_params => query_params,
541+
:form_params => form_params,
542+
:body => post_body,
543+
:auth_names => auth_names,
544+
:return_type => return_type,
545+
:api_version => "V2"
546+
)
547+
548+
data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
549+
if @api_client.config.debugging
550+
@api_client.config.logger.debug "API called: IncidentsAPI#create_incident_postmortem_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
551+
end
552+
return data, status_code, headers
553+
end
554+
477555
# Create an incident todo.
478556
#
479557
# @see #create_incident_todo_with_http_info

0 commit comments

Comments
 (0)