Skip to content

Commit

Permalink
Add examples of different types of notification handles (#2161)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Sep 13, 2024
1 parent ced8485 commit 80ee18b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
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": "2024-09-13 13:31:54.562583",
"spec_repo_commit": "bee8c3e1"
"regenerated": "2024-09-13 20:35:30.960636",
"spec_repo_commit": "6093038f"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-13 13:31:54.580011",
"spec_repo_commit": "bee8c3e1"
"regenerated": "2024-09-13 20:35:30.978308",
"spec_repo_commit": "6093038f"
}
}
}
24 changes: 23 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10442,6 +10442,13 @@ components:
notification_handles:
description: Notification handles that will be notified of the incident
at creation.
example:
- display_name: Jane Doe
handle: '@[email protected]'
- display_name: Slack Channel
handle: '@slack-channel'
- display_name: Incident Workflow
handle: '@workflow-from-incident'
items:
$ref: '#/components/schemas/IncidentNotificationHandle'
type: array
Expand Down Expand Up @@ -10728,7 +10735,8 @@ components:
example: Jane Doe
type: string
handle:
description: The email address used for the notification.
description: The handle used for the notification. This includes an email
address, Slack channel, or workflow.
example: '@[email protected]'
type: string
type: object
Expand Down Expand Up @@ -10841,6 +10849,13 @@ components:
notification_handles:
description: Notification handles that will be notified of the incident
during update.
example:
- display_name: Jane Doe
handle: '@[email protected]'
- display_name: Slack Channel
handle: '@slack-channel'
- display_name: Incident Workflow
handle: '@workflow-from-incident'
items:
$ref: '#/components/schemas/IncidentNotificationHandle'
nullable: true
Expand Down Expand Up @@ -11808,6 +11823,13 @@ components:
notification_handles:
description: Notification handles that will be notified of the incident
during update.
example:
- display_name: Jane Doe
handle: '@[email protected]'
- display_name: Slack Channel
handle: '@slack-channel'
- display_name: Incident Workflow
handle: '@workflow-from-incident'
items:
$ref: '#/components/schemas/IncidentNotificationHandle'
type: array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self_, display_name: Union[str, UnsetType] = unset, handle: Union[s
:param display_name: The name of the notified handle.
:type display_name: str, optional
:param handle: The email address used for the notification.
:param handle: The handle used for the notification. This includes an email address, Slack channel, or workflow.
:type handle: str, optional
"""
if display_name is not unset:
Expand Down
8 changes: 4 additions & 4 deletions tests/v2/features/incidents.feature
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Feature: Incidents
Scenario: Create an incident returns "Bad Request" response
Given operation "CreateIncident" enabled
And new "CreateIncident" request
And body with value {"data": {"attributes": {"customer_impact_scope": "Example customer impact scope", "customer_impacted": false, "fields": {"severity": {"type": "dropdown", "value": "SEV-5"}}, "initial_cells": [{"cell_type": "markdown", "content": {"content": "An example timeline cell message."}, "important": false}], "notification_handles": [{"display_name": "Jane Doe", "handle": "@test.user@test.com"}], "title": "A test incident title"}, "relationships": {"commander_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "users"}}}, "type": "incidents"}}
And body with value {"data": {"attributes": {"customer_impact_scope": "Example customer impact scope", "customer_impacted": false, "fields": {"severity": {"type": "dropdown", "value": "SEV-5"}}, "initial_cells": [{"cell_type": "markdown", "content": {"content": "An example timeline cell message."}, "important": false}], "notification_handles": [{"display_name": "Jane Doe", "handle": "@user@email.com"}, {"display_name": "Slack Channel", "handle": "@slack-channel"}, {"display_name": "Incident Workflow", "handle": "@workflow-from-incident"}], "title": "A test incident title"}, "relationships": {"commander_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "users"}}}, "type": "incidents"}}
When the request is sent
Then the response status is 400 Bad Request

Expand All @@ -89,7 +89,7 @@ Feature: Incidents
Scenario: Create an incident returns "Not Found" response
Given operation "CreateIncident" enabled
And new "CreateIncident" request
And body with value {"data": {"attributes": {"customer_impact_scope": "Example customer impact scope", "customer_impacted": false, "fields": {"severity": {"type": "dropdown", "value": "SEV-5"}}, "initial_cells": [{"cell_type": "markdown", "content": {"content": "An example timeline cell message."}, "important": false}], "notification_handles": [{"display_name": "Jane Doe", "handle": "@test.user@test.com"}], "title": "A test incident title"}, "relationships": {"commander_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "users"}}}, "type": "incidents"}}
And body with value {"data": {"attributes": {"customer_impact_scope": "Example customer impact scope", "customer_impacted": false, "fields": {"severity": {"type": "dropdown", "value": "SEV-5"}}, "initial_cells": [{"cell_type": "markdown", "content": {"content": "An example timeline cell message."}, "important": false}], "notification_handles": [{"display_name": "Jane Doe", "handle": "@user@email.com"}, {"display_name": "Slack Channel", "handle": "@slack-channel"}, {"display_name": "Incident Workflow", "handle": "@workflow-from-incident"}], "title": "A test incident title"}, "relationships": {"commander_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "users"}}}, "type": "incidents"}}
When the request is sent
Then the response status is 404 Not Found

Expand Down Expand Up @@ -530,7 +530,7 @@ Feature: Incidents
Given operation "UpdateIncident" enabled
And new "UpdateIncident" request
And request contains "incident_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"customer_impact_end": null, "customer_impact_scope": "Example customer impact scope", "customer_impact_start": null, "customer_impacted": false, "detected": null, "fields": {"severity": {"type": "dropdown", "value": "SEV-5"}}, "notification_handles": [{"display_name": "Jane Doe", "handle": "@test.user@test.com"}], "title": "A test incident title"}, "id": "00000000-0000-0000-4567-000000000000", "relationships": {"commander_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "users"}}, "integrations": {"data": [{"id": "00000000-abcd-0005-0000-000000000000", "type": "incident_integrations"}, {"id": "00000000-abcd-0006-0000-000000000000", "type": "incident_integrations"}]}, "postmortem": {"data": {"id": "00000000-0000-abcd-3000-000000000000", "type": "incident_postmortems"}}}, "type": "incidents"}}
And body with value {"data": {"attributes": {"customer_impact_end": null, "customer_impact_scope": "Example customer impact scope", "customer_impact_start": null, "customer_impacted": false, "detected": null, "fields": {"severity": {"type": "dropdown", "value": "SEV-5"}}, "notification_handles": [{"display_name": "Jane Doe", "handle": "@user@email.com"}, {"display_name": "Slack Channel", "handle": "@slack-channel"}, {"display_name": "Incident Workflow", "handle": "@workflow-from-incident"}], "title": "A test incident title"}, "id": "00000000-0000-0000-4567-000000000000", "relationships": {"commander_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "users"}}, "integrations": {"data": [{"id": "00000000-abcd-0005-0000-000000000000", "type": "incident_integrations"}, {"id": "00000000-abcd-0006-0000-000000000000", "type": "incident_integrations"}]}, "postmortem": {"data": {"id": "00000000-0000-abcd-3000-000000000000", "type": "incident_postmortems"}}}, "type": "incidents"}}
When the request is sent
Then the response status is 400 Bad Request

Expand All @@ -539,7 +539,7 @@ Feature: Incidents
Given operation "UpdateIncident" enabled
And new "UpdateIncident" request
And request contains "incident_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"customer_impact_end": null, "customer_impact_scope": "Example customer impact scope", "customer_impact_start": null, "customer_impacted": false, "detected": null, "fields": {"severity": {"type": "dropdown", "value": "SEV-5"}}, "notification_handles": [{"display_name": "Jane Doe", "handle": "@test.user@test.com"}], "title": "A test incident title"}, "id": "00000000-0000-0000-4567-000000000000", "relationships": {"commander_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "users"}}, "integrations": {"data": [{"id": "00000000-abcd-0005-0000-000000000000", "type": "incident_integrations"}, {"id": "00000000-abcd-0006-0000-000000000000", "type": "incident_integrations"}]}, "postmortem": {"data": {"id": "00000000-0000-abcd-3000-000000000000", "type": "incident_postmortems"}}}, "type": "incidents"}}
And body with value {"data": {"attributes": {"customer_impact_end": null, "customer_impact_scope": "Example customer impact scope", "customer_impact_start": null, "customer_impacted": false, "detected": null, "fields": {"severity": {"type": "dropdown", "value": "SEV-5"}}, "notification_handles": [{"display_name": "Jane Doe", "handle": "@user@email.com"}, {"display_name": "Slack Channel", "handle": "@slack-channel"}, {"display_name": "Incident Workflow", "handle": "@workflow-from-incident"}], "title": "A test incident title"}, "id": "00000000-0000-0000-4567-000000000000", "relationships": {"commander_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "users"}}, "integrations": {"data": [{"id": "00000000-abcd-0005-0000-000000000000", "type": "incident_integrations"}, {"id": "00000000-abcd-0006-0000-000000000000", "type": "incident_integrations"}]}, "postmortem": {"data": {"id": "00000000-0000-abcd-3000-000000000000", "type": "incident_postmortems"}}}, "type": "incidents"}}
When the request is sent
Then the response status is 404 Not Found

Expand Down

0 comments on commit 80ee18b

Please sign in to comment.