diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5638f0c0df..9a2db4ea42 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1413,6 +1413,15 @@ components: required: false schema: $ref: "#/components/schemas/OrgGroupPolicySortOption" + PostmortemIncludeQueryParameter: + description: "Resources to include in the response. Supported values: `last_modified_by_user`, `postmortem_owner_user`, `postmortem_owner_responder`, `incident`." + explode: false + in: query + name: include + required: false + schema: + example: "postmortem_owner_user" + type: string ProductName: description: Name of the product to be deleted, either `logs` or `rum`. in: path @@ -45930,6 +45939,130 @@ components: - id - type type: object + IncidentPostmortemAttributes: + description: The postmortem's attributes. + properties: + created: + description: Timestamp when the postmortem was created. + example: "2024-01-01T00:00:00+00:00" + format: date-time + type: string + document_id: + description: The identifier of the postmortem document within its host platform. + example: "123" + type: string + document_type: + description: >- + The type of document backing the postmortem (for example, `datadog_notebooks`, `confluence`, or `google_docs`). Can be empty if the document type is unknown. + example: datadog_notebooks + type: string + document_url: + description: The URL of the postmortem document. + example: "https://app.datadoghq.com/notebook/123" + type: string + modified: + description: Timestamp when the postmortem was last modified. + example: "2024-01-01T00:00:00+00:00" + format: date-time + type: string + status: + $ref: "#/components/schemas/PostmortemStatus" + title: + description: The title of the postmortem. + example: "Postmortem for IR-123" + type: string + required: + - title + - document_url + - document_id + - document_type + - status + - created + - modified + type: object + IncidentPostmortemCreateAttributes: + description: The postmortem's attributes for a creation request. + properties: + document_url: + description: The URL of the postmortem document (for example, a Datadog notebook, Confluence page, or Google Doc). + example: "https://app.datadoghq.com/notebook/123" + type: string + title: + description: The title of the postmortem. + example: "Postmortem for IR-123" + type: string + required: + - title + - document_url + type: object + IncidentPostmortemCreateData: + description: The postmortem resource for a creation request. + properties: + attributes: + $ref: "#/components/schemas/IncidentPostmortemCreateAttributes" + type: + $ref: "#/components/schemas/IncidentPostmortemType" + required: + - type + - attributes + type: object + IncidentPostmortemCreateRequest: + description: Request to create a postmortem for an incident. + properties: + data: + $ref: "#/components/schemas/IncidentPostmortemCreateData" + required: + - data + type: object + IncidentPostmortemData: + description: The postmortem resource. + properties: + attributes: + $ref: "#/components/schemas/IncidentPostmortemAttributes" + id: + description: The UUID of the postmortem. + example: "00000000-0000-abcd-1000-000000000000" + type: string + relationships: + $ref: "#/components/schemas/IncidentPostmortemRelationships" + type: + $ref: "#/components/schemas/IncidentPostmortemType" + required: + - id + - type + - attributes + - relationships + type: object + IncidentPostmortemIncluded: + description: An object related to a postmortem that is included in the response. + oneOf: + - $ref: "#/components/schemas/IncidentUserData" + - $ref: "#/components/schemas/IncidentResponseData" + IncidentPostmortemRelationships: + description: The postmortem's relationships. + properties: + incident: + $ref: "#/components/schemas/RelationshipToIncident" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + postmortem_owner_responder: + $ref: "#/components/schemas/RelationshipToIncidentResponder" + postmortem_owner_user: + $ref: "#/components/schemas/NullableRelationshipToUser" + type: object + IncidentPostmortemResponse: + description: Response with a single incident postmortem. + properties: + data: + $ref: "#/components/schemas/IncidentPostmortemData" + included: + description: Related objects included in the response. + items: + $ref: "#/components/schemas/IncidentPostmortemIncluded" + type: array + required: + - data + type: object IncidentPostmortemType: default: incident_postmortems description: Incident postmortem resource type. @@ -45939,6 +46072,36 @@ components: type: string x-enum-varnames: - INCIDENT_POSTMORTEMS + IncidentPostmortemUpdateAttributes: + description: The postmortem's attributes for an update request. + properties: + status: + $ref: "#/components/schemas/PostmortemStatus" + type: object + IncidentPostmortemUpdateData: + description: The postmortem resource for an update request. + properties: + attributes: + $ref: "#/components/schemas/IncidentPostmortemUpdateAttributes" + id: + description: The UUID of the postmortem. + example: "00000000-0000-abcd-1000-000000000000" + type: string + type: + $ref: "#/components/schemas/IncidentPostmortemType" + required: + - id + - type + - attributes + type: object + IncidentPostmortemUpdateRequest: + description: Request to update the postmortem attached to an incident. + properties: + data: + $ref: "#/components/schemas/IncidentPostmortemUpdateData" + required: + - data + type: object IncidentRelatedObject: description: Object related to an incident. enum: @@ -64127,6 +64290,20 @@ components: required: - type type: object + NullableRelationshipToIncidentResponderData: + description: Relationship to impact object. + nullable: true + properties: + id: + description: A unique identifier that represents the responder. + example: "00000000-0000-0000-2345-000000000000" + type: string + type: + $ref: "#/components/schemas/IncidentRespondersType" + required: + - id + - type + type: object NullableRelationshipToUser: description: Relationship to user. nullable: true @@ -75323,6 +75500,18 @@ components: type: string x-enum-varnames: - MARKDOWN + PostmortemStatus: + description: The status of the postmortem. + enum: + - draft + - in_review + - completed + example: draft + type: string + x-enum-varnames: + - DRAFT + - IN_REVIEW + - COMPLETED PostmortemTemplateAttributesRequest: description: Attributes for creating or updating a postmortem template. properties: @@ -78741,6 +78930,15 @@ components: required: - data type: object + RelationshipToIncidentResponder: + description: A relationship reference for a single incident responder. + nullable: true + properties: + data: + $ref: "#/components/schemas/NullableRelationshipToIncidentResponderData" + required: + - data + type: object RelationshipToIncidentResponderData: description: Relationship to impact object. properties: @@ -140824,6 +141022,259 @@ paths: operator: OR permissions: - incident_write + /api/v2/incidents/{incident_id}/postmortem: + delete: + description: Delete the postmortem attached to an incident. + operationId: DeleteIncidentPostmortem + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + responses: + "204": + 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_write + summary: Delete postmortem for an incident + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get the postmortem attached to an incident. + operationId: GetIncidentPostmortem + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + - $ref: "#/components/parameters/PostmortemIncludeQueryParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00+00:00" + document_id: "123" + document_type: datadog_notebooks + document_url: "https://app.datadoghq.com/notebook/123" + modified: "2024-01-01T00:00:00+00:00" + status: draft + title: "Postmortem for IR-123" + id: 00000000-0000-abcd-1000-000000000000 + relationships: + incident: + data: + id: 00000000-0000-0000-1234-000000000000 + type: incidents + last_modified_by_user: + data: + id: 00000000-0000-0000-1234-000000000000 + type: users + type: incident_postmortems + schema: + $ref: "#/components/schemas/IncidentPostmortemResponse" + 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 + summary: Get postmortem for an incident + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: Update the postmortem attached to an incident, for example to change its status. + operationId: UpdateIncidentPostmortem + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + - $ref: "#/components/parameters/PostmortemIncludeQueryParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + status: in_review + id: 00000000-0000-abcd-1000-000000000000 + type: incident_postmortems + schema: + $ref: "#/components/schemas/IncidentPostmortemUpdateRequest" + description: Postmortem update payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00+00:00" + document_id: "123" + document_type: datadog_notebooks + document_url: "https://app.datadoghq.com/notebook/123" + modified: "2024-01-01T00:00:00+00:00" + status: in_review + title: "Postmortem for IR-123" + id: 00000000-0000-abcd-1000-000000000000 + relationships: + incident: + data: + id: 00000000-0000-0000-1234-000000000000 + type: incidents + last_modified_by_user: + data: + id: 00000000-0000-0000-1234-000000000000 + type: users + type: incident_postmortems + schema: + $ref: "#/components/schemas/IncidentPostmortemResponse" + 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_write + summary: Update postmortem for an incident + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: |- + Create a postmortem for an incident by linking a title and document URL + (for example, a Datadog notebook, Confluence page, or Google Doc). + + Only one postmortem is allowed per incident. + operationId: CreateIncidentPostmortem + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + - $ref: "#/components/parameters/PostmortemIncludeQueryParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + document_url: "https://app.datadoghq.com/notebook/123" + title: "Postmortem for IR-123" + type: incident_postmortems + schema: + $ref: "#/components/schemas/IncidentPostmortemCreateRequest" + description: Postmortem creation payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00+00:00" + document_id: "123" + document_type: datadog_notebooks + document_url: "https://app.datadoghq.com/notebook/123" + modified: "2024-01-01T00:00:00+00:00" + status: draft + title: "Postmortem for IR-123" + id: 00000000-0000-abcd-1000-000000000000 + relationships: + incident: + data: + id: 00000000-0000-0000-1234-000000000000 + type: incidents + last_modified_by_user: + data: + id: 00000000-0000-0000-1234-000000000000 + type: users + type: incident_postmortems + schema: + $ref: "#/components/schemas/IncidentPostmortemResponse" + description: CREATED + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "409": + $ref: "#/components/responses/ConflictResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create postmortem for an incident + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + 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. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 2c283062c8..6a1d36068c 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -18589,6 +18589,62 @@ datadog\_api\_client.v2.model.incident\_notification\_template\_update\_data mod :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_postmortem\_attributes module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_postmortem\_create\_attributes module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_create_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_postmortem\_create\_data module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_postmortem\_create\_request module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_postmortem\_data module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_postmortem\_included module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_included + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_postmortem\_relationships module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_postmortem\_response module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incident\_postmortem\_type module --------------------------------------------------------------- @@ -18596,6 +18652,27 @@ datadog\_api\_client.v2.model.incident\_postmortem\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_postmortem\_update\_attributes module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_update_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_postmortem\_update\_data module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_postmortem\_update\_request module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_postmortem_update_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incident\_related\_object module -------------------------------------------------------------- @@ -26688,6 +26765,13 @@ datadog\_api\_client.v2.model.notion\_integration\_update module :members: :show-inheritance: +datadog\_api\_client.v2.model.nullable\_relationship\_to\_incident\_responder\_data module +------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.nullable_relationship_to_incident_responder_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.nullable\_relationship\_to\_user module --------------------------------------------------------------------- @@ -31651,6 +31735,13 @@ datadog\_api\_client.v2.model.postmortem\_cell\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.postmortem\_status module +------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.postmortem_status + :members: + :show-inheritance: + datadog\_api\_client.v2.model.postmortem\_template\_attributes\_request module ------------------------------------------------------------------------------ @@ -32932,6 +33023,13 @@ datadog\_api\_client.v2.model.relationship\_to\_incident\_request module :members: :show-inheritance: +datadog\_api\_client.v2.model.relationship\_to\_incident\_responder module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.relationship_to_incident_responder + :members: + :show-inheritance: + datadog\_api\_client.v2.model.relationship\_to\_incident\_responder\_data module -------------------------------------------------------------------------------- diff --git a/examples/v2/incidents/CreateIncidentPostmortem.py b/examples/v2/incidents/CreateIncidentPostmortem.py new file mode 100644 index 0000000000..75e7261a74 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentPostmortem.py @@ -0,0 +1,32 @@ +""" +Create postmortem for an incident returns "CREATED" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi +from datadog_api_client.v2.model.incident_postmortem_create_attributes import IncidentPostmortemCreateAttributes +from datadog_api_client.v2.model.incident_postmortem_create_data import IncidentPostmortemCreateData +from datadog_api_client.v2.model.incident_postmortem_create_request import IncidentPostmortemCreateRequest +from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType + +# there is a valid "incident" in the system +INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"] + +body = IncidentPostmortemCreateRequest( + data=IncidentPostmortemCreateData( + attributes=IncidentPostmortemCreateAttributes( + document_url="https://app.datadoghq.com/notebook/123", + title="Postmortem for IR-123", + ), + type=IncidentPostmortemType.INCIDENT_POSTMORTEMS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_incident_postmortem"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.create_incident_postmortem(incident_id=INCIDENT_DATA_ID, body=body) + + print(response) diff --git a/examples/v2/incidents/DeleteIncidentPostmortem.py b/examples/v2/incidents/DeleteIncidentPostmortem.py new file mode 100644 index 0000000000..1c8db97153 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentPostmortem.py @@ -0,0 +1,18 @@ +""" +Delete postmortem for an incident returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +# there is a valid "postmortem" in the system +POSTMORTEM_DATA_RELATIONSHIPS_INCIDENT_DATA_ID = environ["POSTMORTEM_DATA_RELATIONSHIPS_INCIDENT_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["delete_incident_postmortem"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + api_instance.delete_incident_postmortem( + incident_id=POSTMORTEM_DATA_RELATIONSHIPS_INCIDENT_DATA_ID, + ) diff --git a/examples/v2/incidents/GetIncidentPostmortem.py b/examples/v2/incidents/GetIncidentPostmortem.py new file mode 100644 index 0000000000..15f52d5574 --- /dev/null +++ b/examples/v2/incidents/GetIncidentPostmortem.py @@ -0,0 +1,20 @@ +""" +Get postmortem for an incident returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +# there is a valid "postmortem" in the system +POSTMORTEM_DATA_RELATIONSHIPS_INCIDENT_DATA_ID = environ["POSTMORTEM_DATA_RELATIONSHIPS_INCIDENT_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["get_incident_postmortem"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.get_incident_postmortem( + incident_id=POSTMORTEM_DATA_RELATIONSHIPS_INCIDENT_DATA_ID, + ) + + print(response) diff --git a/examples/v2/incidents/UpdateIncidentPostmortem.py b/examples/v2/incidents/UpdateIncidentPostmortem.py new file mode 100644 index 0000000000..70ed873e68 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentPostmortem.py @@ -0,0 +1,36 @@ +""" +Update postmortem for an incident returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi +from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType +from datadog_api_client.v2.model.incident_postmortem_update_attributes import IncidentPostmortemUpdateAttributes +from datadog_api_client.v2.model.incident_postmortem_update_data import IncidentPostmortemUpdateData +from datadog_api_client.v2.model.incident_postmortem_update_request import IncidentPostmortemUpdateRequest +from datadog_api_client.v2.model.postmortem_status import PostmortemStatus + +# there is a valid "postmortem" in the system +POSTMORTEM_DATA_ID = environ["POSTMORTEM_DATA_ID"] +POSTMORTEM_DATA_RELATIONSHIPS_INCIDENT_DATA_ID = environ["POSTMORTEM_DATA_RELATIONSHIPS_INCIDENT_DATA_ID"] + +body = IncidentPostmortemUpdateRequest( + data=IncidentPostmortemUpdateData( + attributes=IncidentPostmortemUpdateAttributes( + status=PostmortemStatus.IN_REVIEW, + ), + id=POSTMORTEM_DATA_ID, + type=IncidentPostmortemType.INCIDENT_POSTMORTEMS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_incident_postmortem"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.update_incident_postmortem( + incident_id=POSTMORTEM_DATA_RELATIONSHIPS_INCIDENT_DATA_ID, body=body + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index b743b035d3..57f16d2f60 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -565,6 +565,7 @@ def __init__( "v2.create_incident_integration": False, "v2.create_incident_notification_rule": False, "v2.create_incident_notification_template": False, + "v2.create_incident_postmortem": False, "v2.create_incident_postmortem_attachment": False, "v2.create_incident_postmortem_template": False, "v2.create_incident_todo": False, @@ -576,6 +577,7 @@ def __init__( "v2.delete_incident_integration": False, "v2.delete_incident_notification_rule": False, "v2.delete_incident_notification_template": False, + "v2.delete_incident_postmortem": False, "v2.delete_incident_postmortem_template": False, "v2.delete_incident_todo": False, "v2.delete_incident_type": False, @@ -585,6 +587,7 @@ def __init__( "v2.get_incident_integration": False, "v2.get_incident_notification_rule": False, "v2.get_incident_notification_template": False, + "v2.get_incident_postmortem": False, "v2.get_incident_postmortem_template": False, "v2.get_incident_todo": False, "v2.get_incident_type": False, @@ -608,6 +611,7 @@ def __init__( "v2.update_incident_integration": False, "v2.update_incident_notification_rule": False, "v2.update_incident_notification_template": False, + "v2.update_incident_postmortem": False, "v2.update_incident_postmortem_template": False, "v2.update_incident_todo": False, "v2.update_incident_type": False, diff --git a/src/datadog_api_client/v2/api/incidents_api.py b/src/datadog_api_client/v2/api/incidents_api.py index f4b97f5ad0..ff8f4fac82 100644 --- a/src/datadog_api_client/v2/api/incidents_api.py +++ b/src/datadog_api_client/v2/api/incidents_api.py @@ -64,6 +64,9 @@ from datadog_api_client.v2.model.incident_impact_related_object import IncidentImpactRelatedObject from datadog_api_client.v2.model.incident_impact_response import IncidentImpactResponse from datadog_api_client.v2.model.incident_impact_create_request import IncidentImpactCreateRequest +from datadog_api_client.v2.model.incident_postmortem_response import IncidentPostmortemResponse +from datadog_api_client.v2.model.incident_postmortem_update_request import IncidentPostmortemUpdateRequest +from datadog_api_client.v2.model.incident_postmortem_create_request import IncidentPostmortemCreateRequest from datadog_api_client.v2.model.incident_integration_metadata_list_response import ( IncidentIntegrationMetadataListResponse, ) @@ -264,6 +267,37 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_incident_postmortem_endpoint = _Endpoint( + settings={ + "response_type": (IncidentPostmortemResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/{incident_id}/postmortem", + "operation_id": "create_incident_postmortem", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "incident_id": { + "required": True, + "openapi_types": (str,), + "attribute": "incident_id", + "location": "path", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + "body": { + "required": True, + "openapi_types": (IncidentPostmortemCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_incident_postmortem_attachment_endpoint = _Endpoint( settings={ "response_type": (Attachment,), @@ -563,6 +597,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_incident_postmortem_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/{incident_id}/postmortem", + "operation_id": "delete_incident_postmortem", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "incident_id": { + "required": True, + "openapi_types": (str,), + "attribute": "incident_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._delete_incident_postmortem_template_endpoint = _Endpoint( settings={ "response_type": None, @@ -791,6 +848,34 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_incident_postmortem_endpoint = _Endpoint( + settings={ + "response_type": (IncidentPostmortemResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/{incident_id}/postmortem", + "operation_id": "get_incident_postmortem", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "incident_id": { + "required": True, + "openapi_types": (str,), + "attribute": "incident_id", + "location": "path", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_incident_postmortem_template_endpoint = _Endpoint( settings={ "response_type": (PostmortemTemplateResponse,), @@ -1470,6 +1555,37 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_incident_postmortem_endpoint = _Endpoint( + settings={ + "response_type": (IncidentPostmortemResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/{incident_id}/postmortem", + "operation_id": "update_incident_postmortem", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "incident_id": { + "required": True, + "openapi_types": (str,), + "attribute": "incident_id", + "location": "path", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + "body": { + "required": True, + "openapi_types": (IncidentPostmortemUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_incident_postmortem_template_endpoint = _Endpoint( settings={ "response_type": (PostmortemTemplateResponse,), @@ -1736,6 +1852,38 @@ def create_incident_notification_template( return self._create_incident_notification_template_endpoint.call_with_http_info(**kwargs) + def create_incident_postmortem( + self, + incident_id: str, + body: IncidentPostmortemCreateRequest, + *, + include: Union[str, UnsetType] = unset, + ) -> IncidentPostmortemResponse: + """Create postmortem for an incident. + + Create a postmortem for an incident by linking a title and document URL + (for example, a Datadog notebook, Confluence page, or Google Doc). + + Only one postmortem is allowed per incident. + + :param incident_id: The UUID of the incident. + :type incident_id: str + :param body: Postmortem creation payload. + :type body: IncidentPostmortemCreateRequest + :param include: Resources to include in the response. Supported values: ``last_modified_by_user`` , ``postmortem_owner_user`` , ``postmortem_owner_responder`` , ``incident``. + :type include: str, optional + :rtype: IncidentPostmortemResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["incident_id"] = incident_id + + if include is not unset: + kwargs["include"] = include + + kwargs["body"] = body + + return self._create_incident_postmortem_endpoint.call_with_http_info(**kwargs) + def create_incident_postmortem_attachment( self, incident_id: str, @@ -1981,6 +2129,23 @@ def delete_incident_notification_template( return self._delete_incident_notification_template_endpoint.call_with_http_info(**kwargs) + def delete_incident_postmortem( + self, + incident_id: str, + ) -> None: + """Delete postmortem for an incident. + + Delete the postmortem attached to an incident. + + :param incident_id: The UUID of the incident. + :type incident_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["incident_id"] = incident_id + + return self._delete_incident_postmortem_endpoint.call_with_http_info(**kwargs) + def delete_incident_postmortem_template( self, template_id: str, @@ -2160,6 +2325,30 @@ def get_incident_notification_template( return self._get_incident_notification_template_endpoint.call_with_http_info(**kwargs) + def get_incident_postmortem( + self, + incident_id: str, + *, + include: Union[str, UnsetType] = unset, + ) -> IncidentPostmortemResponse: + """Get postmortem for an incident. + + Get the postmortem attached to an incident. + + :param incident_id: The UUID of the incident. + :type incident_id: str + :param include: Resources to include in the response. Supported values: ``last_modified_by_user`` , ``postmortem_owner_user`` , ``postmortem_owner_responder`` , ``incident``. + :type include: str, optional + :rtype: IncidentPostmortemResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["incident_id"] = incident_id + + if include is not unset: + kwargs["include"] = include + + return self._get_incident_postmortem_endpoint.call_with_http_info(**kwargs) + def get_incident_postmortem_template( self, template_id: str, @@ -2847,6 +3036,35 @@ def update_incident_notification_template( return self._update_incident_notification_template_endpoint.call_with_http_info(**kwargs) + def update_incident_postmortem( + self, + incident_id: str, + body: IncidentPostmortemUpdateRequest, + *, + include: Union[str, UnsetType] = unset, + ) -> IncidentPostmortemResponse: + """Update postmortem for an incident. + + Update the postmortem attached to an incident, for example to change its status. + + :param incident_id: The UUID of the incident. + :type incident_id: str + :param body: Postmortem update payload. + :type body: IncidentPostmortemUpdateRequest + :param include: Resources to include in the response. Supported values: ``last_modified_by_user`` , ``postmortem_owner_user`` , ``postmortem_owner_responder`` , ``incident``. + :type include: str, optional + :rtype: IncidentPostmortemResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["incident_id"] = incident_id + + if include is not unset: + kwargs["include"] = include + + kwargs["body"] = body + + return self._update_incident_postmortem_endpoint.call_with_http_info(**kwargs) + def update_incident_postmortem_template( self, template_id: str, diff --git a/src/datadog_api_client/v2/model/incident_postmortem_attributes.py b/src/datadog_api_client/v2/model/incident_postmortem_attributes.py new file mode 100644 index 0000000000..13a663528c --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_attributes.py @@ -0,0 +1,87 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.postmortem_status import PostmortemStatus + + +class IncidentPostmortemAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.postmortem_status import PostmortemStatus + + return { + "created": (datetime,), + "document_id": (str,), + "document_type": (str,), + "document_url": (str,), + "modified": (datetime,), + "status": (PostmortemStatus,), + "title": (str,), + } + + attribute_map = { + "created": "created", + "document_id": "document_id", + "document_type": "document_type", + "document_url": "document_url", + "modified": "modified", + "status": "status", + "title": "title", + } + + def __init__( + self_, + created: datetime, + document_id: str, + document_type: str, + document_url: str, + modified: datetime, + status: PostmortemStatus, + title: str, + **kwargs, + ): + """ + The postmortem's attributes. + + :param created: Timestamp when the postmortem was created. + :type created: datetime + + :param document_id: The identifier of the postmortem document within its host platform. + :type document_id: str + + :param document_type: The type of document backing the postmortem (for example, ``datadog_notebooks`` , ``confluence`` , or ``google_docs`` ). Can be empty if the document type is unknown. + :type document_type: str + + :param document_url: The URL of the postmortem document. + :type document_url: str + + :param modified: Timestamp when the postmortem was last modified. + :type modified: datetime + + :param status: The status of the postmortem. + :type status: PostmortemStatus + + :param title: The title of the postmortem. + :type title: str + """ + super().__init__(kwargs) + + self_.created = created + self_.document_id = document_id + self_.document_type = document_type + self_.document_url = document_url + self_.modified = modified + self_.status = status + self_.title = title diff --git a/src/datadog_api_client/v2/model/incident_postmortem_create_attributes.py b/src/datadog_api_client/v2/model/incident_postmortem_create_attributes.py new file mode 100644 index 0000000000..d0f9da1421 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_create_attributes.py @@ -0,0 +1,39 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class IncidentPostmortemCreateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "document_url": (str,), + "title": (str,), + } + + attribute_map = { + "document_url": "document_url", + "title": "title", + } + + def __init__(self_, document_url: str, title: str, **kwargs): + """ + The postmortem's attributes for a creation request. + + :param document_url: The URL of the postmortem document (for example, a Datadog notebook, Confluence page, or Google Doc). + :type document_url: str + + :param title: The title of the postmortem. + :type title: str + """ + super().__init__(kwargs) + + self_.document_url = document_url + self_.title = title diff --git a/src/datadog_api_client/v2/model/incident_postmortem_create_data.py b/src/datadog_api_client/v2/model/incident_postmortem_create_data.py new file mode 100644 index 0000000000..22a27c821f --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_create_data.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_postmortem_create_attributes import IncidentPostmortemCreateAttributes + from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType + + +class IncidentPostmortemCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_postmortem_create_attributes import IncidentPostmortemCreateAttributes + from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType + + return { + "attributes": (IncidentPostmortemCreateAttributes,), + "type": (IncidentPostmortemType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: IncidentPostmortemCreateAttributes, type: IncidentPostmortemType, **kwargs): + """ + The postmortem resource for a creation request. + + :param attributes: The postmortem's attributes for a creation request. + :type attributes: IncidentPostmortemCreateAttributes + + :param type: Incident postmortem resource type. + :type type: IncidentPostmortemType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_postmortem_create_request.py b/src/datadog_api_client/v2/model/incident_postmortem_create_request.py new file mode 100644 index 0000000000..d89a32780e --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_create_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_postmortem_create_data import IncidentPostmortemCreateData + + +class IncidentPostmortemCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_postmortem_create_data import IncidentPostmortemCreateData + + return { + "data": (IncidentPostmortemCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: IncidentPostmortemCreateData, **kwargs): + """ + Request to create a postmortem for an incident. + + :param data: The postmortem resource for a creation request. + :type data: IncidentPostmortemCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/incident_postmortem_data.py b/src/datadog_api_client/v2/model/incident_postmortem_data.py new file mode 100644 index 0000000000..69c76c4806 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_data.py @@ -0,0 +1,69 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_postmortem_attributes import IncidentPostmortemAttributes + from datadog_api_client.v2.model.incident_postmortem_relationships import IncidentPostmortemRelationships + from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType + + +class IncidentPostmortemData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_postmortem_attributes import IncidentPostmortemAttributes + from datadog_api_client.v2.model.incident_postmortem_relationships import IncidentPostmortemRelationships + from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType + + return { + "attributes": (IncidentPostmortemAttributes,), + "id": (str,), + "relationships": (IncidentPostmortemRelationships,), + "type": (IncidentPostmortemType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: IncidentPostmortemAttributes, + id: str, + relationships: IncidentPostmortemRelationships, + type: IncidentPostmortemType, + **kwargs, + ): + """ + The postmortem resource. + + :param attributes: The postmortem's attributes. + :type attributes: IncidentPostmortemAttributes + + :param id: The UUID of the postmortem. + :type id: str + + :param relationships: The postmortem's relationships. + :type relationships: IncidentPostmortemRelationships + + :param type: Incident postmortem resource type. + :type type: IncidentPostmortemType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.relationships = relationships + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_postmortem_included.py b/src/datadog_api_client/v2/model/incident_postmortem_included.py new file mode 100644 index 0000000000..4fd1437db7 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_included.py @@ -0,0 +1,49 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class IncidentPostmortemIncluded(ModelComposed): + def __init__(self, **kwargs): + """ + An object related to a postmortem that is included in the response. + + :param attributes: Attributes of user object returned by the API. + :type attributes: IncidentUserAttributes, optional + + :param id: ID of the user. + :type id: str, optional + + :param type: Users resource type. + :type type: UsersType, optional + + :param relationships: The incident's relationships from a response. + :type relationships: IncidentResponseRelationships, optional + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.incident_user_data import IncidentUserData + from datadog_api_client.v2.model.incident_response_data import IncidentResponseData + + return { + "oneOf": [ + IncidentUserData, + IncidentResponseData, + ], + } diff --git a/src/datadog_api_client/v2/model/incident_postmortem_relationships.py b/src/datadog_api_client/v2/model/incident_postmortem_relationships.py new file mode 100644 index 0000000000..afb9e00aa0 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_relationships.py @@ -0,0 +1,77 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.relationship_to_incident import RelationshipToIncident + from datadog_api_client.v2.model.relationship_to_user import RelationshipToUser + from datadog_api_client.v2.model.relationship_to_incident_responder import RelationshipToIncidentResponder + from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser + + +class IncidentPostmortemRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.relationship_to_incident import RelationshipToIncident + from datadog_api_client.v2.model.relationship_to_user import RelationshipToUser + from datadog_api_client.v2.model.relationship_to_incident_responder import RelationshipToIncidentResponder + from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser + + return { + "incident": (RelationshipToIncident,), + "last_modified_by_user": (RelationshipToUser,), + "postmortem_owner_responder": (RelationshipToIncidentResponder,), + "postmortem_owner_user": (NullableRelationshipToUser,), + } + + attribute_map = { + "incident": "incident", + "last_modified_by_user": "last_modified_by_user", + "postmortem_owner_responder": "postmortem_owner_responder", + "postmortem_owner_user": "postmortem_owner_user", + } + + def __init__( + self_, + incident: Union[RelationshipToIncident, UnsetType] = unset, + last_modified_by_user: Union[RelationshipToUser, UnsetType] = unset, + postmortem_owner_responder: Union[RelationshipToIncidentResponder, none_type, UnsetType] = unset, + postmortem_owner_user: Union[NullableRelationshipToUser, none_type, UnsetType] = unset, + **kwargs, + ): + """ + The postmortem's relationships. + + :param incident: Relationship to incident. + :type incident: RelationshipToIncident, optional + + :param last_modified_by_user: Relationship to user. + :type last_modified_by_user: RelationshipToUser, optional + + :param postmortem_owner_responder: A relationship reference for a single incident responder. + :type postmortem_owner_responder: RelationshipToIncidentResponder, none_type, optional + + :param postmortem_owner_user: Relationship to user. + :type postmortem_owner_user: NullableRelationshipToUser, none_type, optional + """ + if incident is not unset: + kwargs["incident"] = incident + if last_modified_by_user is not unset: + kwargs["last_modified_by_user"] = last_modified_by_user + if postmortem_owner_responder is not unset: + kwargs["postmortem_owner_responder"] = postmortem_owner_responder + if postmortem_owner_user is not unset: + kwargs["postmortem_owner_user"] = postmortem_owner_user + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_postmortem_response.py b/src/datadog_api_client/v2/model/incident_postmortem_response.py new file mode 100644 index 0000000000..88c67f228e --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_response.py @@ -0,0 +1,60 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_postmortem_data import IncidentPostmortemData + from datadog_api_client.v2.model.incident_postmortem_included import IncidentPostmortemIncluded + from datadog_api_client.v2.model.incident_user_data import IncidentUserData + from datadog_api_client.v2.model.incident_response_data import IncidentResponseData + + +class IncidentPostmortemResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_postmortem_data import IncidentPostmortemData + from datadog_api_client.v2.model.incident_postmortem_included import IncidentPostmortemIncluded + + return { + "data": (IncidentPostmortemData,), + "included": ([IncidentPostmortemIncluded],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__( + self_, + data: IncidentPostmortemData, + included: Union[ + List[Union[IncidentPostmortemIncluded, IncidentUserData, IncidentResponseData]], UnsetType + ] = unset, + **kwargs, + ): + """ + Response with a single incident postmortem. + + :param data: The postmortem resource. + :type data: IncidentPostmortemData + + :param included: Related objects included in the response. + :type included: [IncidentPostmortemIncluded], optional + """ + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/incident_postmortem_update_attributes.py b/src/datadog_api_client/v2/model/incident_postmortem_update_attributes.py new file mode 100644 index 0000000000..b55b3c68b2 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_update_attributes.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.postmortem_status import PostmortemStatus + + +class IncidentPostmortemUpdateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.postmortem_status import PostmortemStatus + + return { + "status": (PostmortemStatus,), + } + + attribute_map = { + "status": "status", + } + + def __init__(self_, status: Union[PostmortemStatus, UnsetType] = unset, **kwargs): + """ + The postmortem's attributes for an update request. + + :param status: The status of the postmortem. + :type status: PostmortemStatus, optional + """ + if status is not unset: + kwargs["status"] = status + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_postmortem_update_data.py b/src/datadog_api_client/v2/model/incident_postmortem_update_data.py new file mode 100644 index 0000000000..7b7ee47a43 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_update_data.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_postmortem_update_attributes import IncidentPostmortemUpdateAttributes + from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType + + +class IncidentPostmortemUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_postmortem_update_attributes import IncidentPostmortemUpdateAttributes + from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType + + return { + "attributes": (IncidentPostmortemUpdateAttributes,), + "id": (str,), + "type": (IncidentPostmortemType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: IncidentPostmortemUpdateAttributes, id: str, type: IncidentPostmortemType, **kwargs + ): + """ + The postmortem resource for an update request. + + :param attributes: The postmortem's attributes for an update request. + :type attributes: IncidentPostmortemUpdateAttributes + + :param id: The UUID of the postmortem. + :type id: str + + :param type: Incident postmortem resource type. + :type type: IncidentPostmortemType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_postmortem_update_request.py b/src/datadog_api_client/v2/model/incident_postmortem_update_request.py new file mode 100644 index 0000000000..05c2b78d64 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_postmortem_update_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_postmortem_update_data import IncidentPostmortemUpdateData + + +class IncidentPostmortemUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_postmortem_update_data import IncidentPostmortemUpdateData + + return { + "data": (IncidentPostmortemUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: IncidentPostmortemUpdateData, **kwargs): + """ + Request to update the postmortem attached to an incident. + + :param data: The postmortem resource for an update request. + :type data: IncidentPostmortemUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/nullable_relationship_to_incident_responder_data.py b/src/datadog_api_client/v2/model/nullable_relationship_to_incident_responder_data.py new file mode 100644 index 0000000000..96eae30bf8 --- /dev/null +++ b/src/datadog_api_client/v2/model/nullable_relationship_to_incident_responder_data.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_responders_type import IncidentRespondersType + + +class NullableRelationshipToIncidentResponderData(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_responders_type import IncidentRespondersType + + return { + "id": (str,), + "type": (IncidentRespondersType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: str, type: IncidentRespondersType, **kwargs): + """ + Relationship to impact object. + + :param id: A unique identifier that represents the responder. + :type id: str + + :param type: The incident responders type. + :type type: IncidentRespondersType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/postmortem_status.py b/src/datadog_api_client/v2/model/postmortem_status.py new file mode 100644 index 0000000000..343fe37da1 --- /dev/null +++ b/src/datadog_api_client/v2/model/postmortem_status.py @@ -0,0 +1,41 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class PostmortemStatus(ModelSimple): + """ + The status of the postmortem. + + :param value: Must be one of ["draft", "in_review", "completed"]. + :type value: str + """ + + allowed_values = { + "draft", + "in_review", + "completed", + } + DRAFT: ClassVar["PostmortemStatus"] + IN_REVIEW: ClassVar["PostmortemStatus"] + COMPLETED: ClassVar["PostmortemStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PostmortemStatus.DRAFT = PostmortemStatus("draft") +PostmortemStatus.IN_REVIEW = PostmortemStatus("in_review") +PostmortemStatus.COMPLETED = PostmortemStatus("completed") diff --git a/src/datadog_api_client/v2/model/relationship_to_incident_responder.py b/src/datadog_api_client/v2/model/relationship_to_incident_responder.py new file mode 100644 index 0000000000..26ae9ef628 --- /dev/null +++ b/src/datadog_api_client/v2/model/relationship_to_incident_responder.py @@ -0,0 +1,47 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.nullable_relationship_to_incident_responder_data import ( + NullableRelationshipToIncidentResponderData, + ) + + +class RelationshipToIncidentResponder(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.nullable_relationship_to_incident_responder_data import ( + NullableRelationshipToIncidentResponderData, + ) + + return { + "data": (NullableRelationshipToIncidentResponderData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[NullableRelationshipToIncidentResponderData, none_type], **kwargs): + """ + A relationship reference for a single incident responder. + + :param data: Relationship to impact object. + :type data: NullableRelationshipToIncidentResponderData, none_type + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 07daae87cb..bf2809eff6 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3476,7 +3476,18 @@ from datadog_api_client.v2.model.incident_notification_template_update_data import ( IncidentNotificationTemplateUpdateData, ) +from datadog_api_client.v2.model.incident_postmortem_attributes import IncidentPostmortemAttributes +from datadog_api_client.v2.model.incident_postmortem_create_attributes import IncidentPostmortemCreateAttributes +from datadog_api_client.v2.model.incident_postmortem_create_data import IncidentPostmortemCreateData +from datadog_api_client.v2.model.incident_postmortem_create_request import IncidentPostmortemCreateRequest +from datadog_api_client.v2.model.incident_postmortem_data import IncidentPostmortemData +from datadog_api_client.v2.model.incident_postmortem_included import IncidentPostmortemIncluded +from datadog_api_client.v2.model.incident_postmortem_relationships import IncidentPostmortemRelationships +from datadog_api_client.v2.model.incident_postmortem_response import IncidentPostmortemResponse from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType +from datadog_api_client.v2.model.incident_postmortem_update_attributes import IncidentPostmortemUpdateAttributes +from datadog_api_client.v2.model.incident_postmortem_update_data import IncidentPostmortemUpdateData +from datadog_api_client.v2.model.incident_postmortem_update_request import IncidentPostmortemUpdateRequest from datadog_api_client.v2.model.incident_related_object import IncidentRelatedObject from datadog_api_client.v2.model.incident_relationship_data import IncidentRelationshipData from datadog_api_client.v2.model.incident_resource_type import IncidentResourceType @@ -4978,6 +4989,9 @@ from datadog_api_client.v2.model.notion_integration import NotionIntegration from datadog_api_client.v2.model.notion_integration_type import NotionIntegrationType from datadog_api_client.v2.model.notion_integration_update import NotionIntegrationUpdate +from datadog_api_client.v2.model.nullable_relationship_to_incident_responder_data import ( + NullableRelationshipToIncidentResponderData, +) from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser from datadog_api_client.v2.model.nullable_relationship_to_user_data import NullableRelationshipToUserData from datadog_api_client.v2.model.nullable_user_relationship import NullableUserRelationship @@ -6355,6 +6369,7 @@ from datadog_api_client.v2.model.postmortem_cell_attributes import PostmortemCellAttributes from datadog_api_client.v2.model.postmortem_cell_definition import PostmortemCellDefinition from datadog_api_client.v2.model.postmortem_cell_type import PostmortemCellType +from datadog_api_client.v2.model.postmortem_status import PostmortemStatus from datadog_api_client.v2.model.postmortem_template_attributes_request import PostmortemTemplateAttributesRequest from datadog_api_client.v2.model.postmortem_template_attributes_response import PostmortemTemplateAttributesResponse from datadog_api_client.v2.model.postmortem_template_data_request import PostmortemTemplateDataRequest @@ -6636,6 +6651,7 @@ from datadog_api_client.v2.model.relationship_to_incident_postmortem import RelationshipToIncidentPostmortem from datadog_api_client.v2.model.relationship_to_incident_postmortem_data import RelationshipToIncidentPostmortemData from datadog_api_client.v2.model.relationship_to_incident_request import RelationshipToIncidentRequest +from datadog_api_client.v2.model.relationship_to_incident_responder import RelationshipToIncidentResponder from datadog_api_client.v2.model.relationship_to_incident_responder_data import RelationshipToIncidentResponderData from datadog_api_client.v2.model.relationship_to_incident_responders import RelationshipToIncidentResponders from datadog_api_client.v2.model.relationship_to_incident_type import RelationshipToIncidentType @@ -12344,7 +12360,18 @@ "IncidentNotificationTemplateType", "IncidentNotificationTemplateUpdateAttributes", "IncidentNotificationTemplateUpdateData", + "IncidentPostmortemAttributes", + "IncidentPostmortemCreateAttributes", + "IncidentPostmortemCreateData", + "IncidentPostmortemCreateRequest", + "IncidentPostmortemData", + "IncidentPostmortemIncluded", + "IncidentPostmortemRelationships", + "IncidentPostmortemResponse", "IncidentPostmortemType", + "IncidentPostmortemUpdateAttributes", + "IncidentPostmortemUpdateData", + "IncidentPostmortemUpdateRequest", "IncidentRelatedObject", "IncidentRelationshipData", "IncidentResourceType", @@ -13490,6 +13517,7 @@ "NotionIntegration", "NotionIntegrationType", "NotionIntegrationUpdate", + "NullableRelationshipToIncidentResponderData", "NullableRelationshipToUser", "NullableRelationshipToUserData", "NullableUserRelationship", @@ -14201,6 +14229,7 @@ "PostmortemCellAttributes", "PostmortemCellDefinition", "PostmortemCellType", + "PostmortemStatus", "PostmortemTemplateAttributesRequest", "PostmortemTemplateAttributesResponse", "PostmortemTemplateDataRequest", @@ -14436,6 +14465,7 @@ "RelationshipToIncidentPostmortem", "RelationshipToIncidentPostmortemData", "RelationshipToIncidentRequest", + "RelationshipToIncidentResponder", "RelationshipToIncidentResponderData", "RelationshipToIncidentResponders", "RelationshipToIncidentType", diff --git a/tests/v2/cassettes/test_scenarios/test_create_postmortem_for_an_incident_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_postmortem_for_an_incident_returns_created_response.frozen new file mode 100644 index 0000000000..20dff1d9fb --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_postmortem_for_an_incident_returns_created_response.frozen @@ -0,0 +1 @@ +2026-07-09T20:46:31.190Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_postmortem_for_an_incident_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_postmortem_for_an_incident_returns_created_response.yaml new file mode 100644 index 0000000000..c852c66bc5 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_postmortem_for_an_incident_returns_created_response.yaml @@ -0,0 +1,73 @@ +interactions: +- request: + body: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Create_postmortem_for_an_incident_returns_CREATED_response-1783629991"},"type":"incidents"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + string: '{"data":{"type":"incidents","id":"254910ed-d27e-5cb4-9f29-b0d5562e78d1","attributes":{"public_id":364275,"incident_type_uuid":"41d2e10b-4108-4736-92d7-791d00ea0702","title":"Test-Create_postmortem_for_an_incident_returns_CREATED_response-1783629991","resolved":null,"customer_impact_scope":null,"customer_impact_start":null,"customer_impact_end":null,"customer_impacted":false,"notification_handles":null,"last_modified_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2026-07-09T20:46:33.090861+00:00","modified":"2026-07-09T20:46:33.090861+00:00","commander":null,"detected":"2026-07-09T20:46:33.080842+00:00","created_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"created_by_uuid":null,"creation_idempotency_key":null,"customer_impact_duration":0,"time_to_detect":0,"time_to_repair":0,"time_to_internal_response":0,"time_to_resolve":0,"is_test":false,"declared":"2026-07-09T20:46:33.090861+00:00","declared_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"declared_by_uuid":null,"fields":{"teams":{"type":"autocomplete","value":null},"severity":{"type":"dropdown","value":"UNKNOWN"},"state":{"type":"dropdown","value":"active"},"detection_method":{"type":"dropdown","value":"unknown"},"root_cause":{"type":"textbox","value":null},"summary":{"type":"textbox","value":null},"services":{"type":"autocomplete","value":null},"slug":{"type":"textbox","value":"IR-364275"}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"last_modified_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"commander_user":{"data":null},"declared_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"user_defined_fields":{"data":[{"type":"user_defined_field","id":"3cbe9e60-d794-532c-acc0-73641f782813"},{"type":"user_defined_field","id":"33457d2a-570c-5567-b4af-979a2a8f1164"},{"type":"user_defined_field","id":"d003693c-bee9-5420-8d46-859269c20914"},{"type":"user_defined_field","id":"1ddff6f6-cb1f-51a0-9d81-dc18ef52cc9d"},{"type":"user_defined_field","id":"6bc9d32b-c2cd-591e-9b7a-74c886a5ddcf"},{"type":"user_defined_field","id":"95c53547-2ba3-5d8a-9c3b-cf245bc0c629"},{"type":"user_defined_field","id":"39044b03-cee4-555f-b1e0-3eb3aa759a86"},{"type":"user_defined_field","id":"2b9f1063-b915-4c7a-8bbd-fc3940245529"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"document_url":"https://app.datadoghq.com/notebook/123","title":"Postmortem + for IR-123"},"type":"incident_postmortems"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/254910ed-d27e-5cb4-9f29-b0d5562e78d1/postmortem + response: + body: + string: '{"data":{"id":"83e96252-8ed9-4032-aa08-7c99a3229eeb","type":"incident_postmortems","attributes":{"created":"2026-07-09T20:46:33.603296Z","document_id":"","document_type":"","document_url":"https://app.datadoghq.com/notebook/123","modified":"2026-07-09T20:46:33.603296Z","status":"draft","title":"Postmortem + for IR-123"},"relationships":{"incident":{"data":{"id":"254910ed-d27e-5cb4-9f29-b0d5562e78d1","type":"incidents"}},"last_modified_by_user":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"postmortem_owner_responder":{"data":null},"postmortem_owner_user":{"data":null}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/254910ed-d27e-5cb4-9f29-b0d5562e78d1/postmortem + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/254910ed-d27e-5cb4-9f29-b0d5562e78d1 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_postmortem_for_an_incident_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_postmortem_for_an_incident_returns_ok_response.frozen new file mode 100644 index 0000000000..7f1eefa3ee --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_postmortem_for_an_incident_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-07-09T20:46:34.566Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_postmortem_for_an_incident_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_postmortem_for_an_incident_returns_ok_response.yaml new file mode 100644 index 0000000000..577e7b98f1 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_postmortem_for_an_incident_returns_ok_response.yaml @@ -0,0 +1,89 @@ +interactions: +- request: + body: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Delete_postmortem_for_an_incident_returns_OK_response-1783629994"},"type":"incidents"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + string: '{"data":{"type":"incidents","id":"b481c61d-b0b2-5786-b2c2-381d5334d201","attributes":{"public_id":364276,"incident_type_uuid":"41d2e10b-4108-4736-92d7-791d00ea0702","title":"Test-Delete_postmortem_for_an_incident_returns_OK_response-1783629994","resolved":null,"customer_impact_scope":null,"customer_impact_start":null,"customer_impact_end":null,"customer_impacted":false,"notification_handles":null,"last_modified_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2026-07-09T20:46:34.742676+00:00","modified":"2026-07-09T20:46:34.742676+00:00","commander":null,"detected":"2026-07-09T20:46:34.734288+00:00","created_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"created_by_uuid":null,"creation_idempotency_key":null,"customer_impact_duration":0,"time_to_detect":0,"time_to_repair":0,"time_to_internal_response":0,"time_to_resolve":0,"is_test":false,"declared":"2026-07-09T20:46:34.742676+00:00","declared_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"declared_by_uuid":null,"fields":{"teams":{"type":"autocomplete","value":null},"severity":{"type":"dropdown","value":"UNKNOWN"},"state":{"type":"dropdown","value":"active"},"detection_method":{"type":"dropdown","value":"unknown"},"root_cause":{"type":"textbox","value":null},"summary":{"type":"textbox","value":null},"services":{"type":"autocomplete","value":null},"slug":{"type":"textbox","value":"IR-364276"}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"last_modified_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"commander_user":{"data":null},"declared_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"user_defined_fields":{"data":[{"type":"user_defined_field","id":"3cbe9e60-d794-532c-acc0-73641f782813"},{"type":"user_defined_field","id":"33457d2a-570c-5567-b4af-979a2a8f1164"},{"type":"user_defined_field","id":"d003693c-bee9-5420-8d46-859269c20914"},{"type":"user_defined_field","id":"1ddff6f6-cb1f-51a0-9d81-dc18ef52cc9d"},{"type":"user_defined_field","id":"6bc9d32b-c2cd-591e-9b7a-74c886a5ddcf"},{"type":"user_defined_field","id":"95c53547-2ba3-5d8a-9c3b-cf245bc0c629"},{"type":"user_defined_field","id":"39044b03-cee4-555f-b1e0-3eb3aa759a86"},{"type":"user_defined_field","id":"2b9f1063-b915-4c7a-8bbd-fc3940245529"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"document_url":"https://docs.example.com/postmortem-test-delete_postmortem_for_an_incident_returns_ok_response-1783629994","title":"Postmortem + for Test-Delete_postmortem_for_an_incident_returns_OK_response-1783629994"},"type":"incident_postmortems"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/b481c61d-b0b2-5786-b2c2-381d5334d201/postmortem + response: + body: + string: '{"data":{"id":"1f42ee03-8e4c-49ad-8626-875dc3c88862","type":"incident_postmortems","attributes":{"created":"2026-07-09T20:46:35.181043Z","document_id":"","document_type":"","document_url":"https://docs.example.com/postmortem-test-delete_postmortem_for_an_incident_returns_ok_response-1783629994","modified":"2026-07-09T20:46:35.181043Z","status":"draft","title":"Postmortem + for Test-Delete_postmortem_for_an_incident_returns_OK_response-1783629994"},"relationships":{"incident":{"data":{"id":"b481c61d-b0b2-5786-b2c2-381d5334d201","type":"incidents"}},"last_modified_by_user":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"postmortem_owner_responder":{"data":null},"postmortem_owner_user":{"data":null}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/b481c61d-b0b2-5786-b2c2-381d5334d201/postmortem + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/b481c61d-b0b2-5786-b2c2-381d5334d201/postmortem + response: + body: + string: '{"errors":[{"title":"Generic Error","detail":"postmortem not found"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/b481c61d-b0b2-5786-b2c2-381d5334d201 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_postmortem_for_an_incident_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_postmortem_for_an_incident_returns_ok_response.frozen new file mode 100644 index 0000000000..b0c18a7290 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_postmortem_for_an_incident_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-07-09T20:46:36.398Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_postmortem_for_an_incident_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_postmortem_for_an_incident_returns_ok_response.yaml new file mode 100644 index 0000000000..938d1a057a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_postmortem_for_an_incident_returns_ok_response.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Get_postmortem_for_an_incident_returns_OK_response-1783629996"},"type":"incidents"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + string: '{"data":{"type":"incidents","id":"4832db36-b2ec-5f98-917a-3b2fff43a58c","attributes":{"public_id":364277,"incident_type_uuid":"41d2e10b-4108-4736-92d7-791d00ea0702","title":"Test-Get_postmortem_for_an_incident_returns_OK_response-1783629996","resolved":null,"customer_impact_scope":null,"customer_impact_start":null,"customer_impact_end":null,"customer_impacted":false,"notification_handles":null,"last_modified_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2026-07-09T20:46:36.588869+00:00","modified":"2026-07-09T20:46:36.588869+00:00","commander":null,"detected":"2026-07-09T20:46:36.580740+00:00","created_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"created_by_uuid":null,"creation_idempotency_key":null,"customer_impact_duration":0,"time_to_detect":0,"time_to_repair":0,"time_to_internal_response":0,"time_to_resolve":0,"is_test":false,"declared":"2026-07-09T20:46:36.588869+00:00","declared_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"declared_by_uuid":null,"fields":{"teams":{"type":"autocomplete","value":null},"severity":{"type":"dropdown","value":"UNKNOWN"},"state":{"type":"dropdown","value":"active"},"detection_method":{"type":"dropdown","value":"unknown"},"root_cause":{"type":"textbox","value":null},"summary":{"type":"textbox","value":null},"services":{"type":"autocomplete","value":null},"slug":{"type":"textbox","value":"IR-364277"}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"last_modified_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"commander_user":{"data":null},"declared_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"user_defined_fields":{"data":[{"type":"user_defined_field","id":"3cbe9e60-d794-532c-acc0-73641f782813"},{"type":"user_defined_field","id":"33457d2a-570c-5567-b4af-979a2a8f1164"},{"type":"user_defined_field","id":"d003693c-bee9-5420-8d46-859269c20914"},{"type":"user_defined_field","id":"1ddff6f6-cb1f-51a0-9d81-dc18ef52cc9d"},{"type":"user_defined_field","id":"6bc9d32b-c2cd-591e-9b7a-74c886a5ddcf"},{"type":"user_defined_field","id":"95c53547-2ba3-5d8a-9c3b-cf245bc0c629"},{"type":"user_defined_field","id":"39044b03-cee4-555f-b1e0-3eb3aa759a86"},{"type":"user_defined_field","id":"2b9f1063-b915-4c7a-8bbd-fc3940245529"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"document_url":"https://docs.example.com/postmortem-test-get_postmortem_for_an_incident_returns_ok_response-1783629996","title":"Postmortem + for Test-Get_postmortem_for_an_incident_returns_OK_response-1783629996"},"type":"incident_postmortems"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/4832db36-b2ec-5f98-917a-3b2fff43a58c/postmortem + response: + body: + string: '{"data":{"id":"9a2e832e-e9b8-48f2-9251-f189ae5bae54","type":"incident_postmortems","attributes":{"created":"2026-07-09T20:46:37.029493Z","document_id":"","document_type":"","document_url":"https://docs.example.com/postmortem-test-get_postmortem_for_an_incident_returns_ok_response-1783629996","modified":"2026-07-09T20:46:37.029493Z","status":"draft","title":"Postmortem + for Test-Get_postmortem_for_an_incident_returns_OK_response-1783629996"},"relationships":{"incident":{"data":{"id":"4832db36-b2ec-5f98-917a-3b2fff43a58c","type":"incidents"}},"last_modified_by_user":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"postmortem_owner_responder":{"data":null},"postmortem_owner_user":{"data":null}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/incidents/4832db36-b2ec-5f98-917a-3b2fff43a58c/postmortem + response: + body: + string: '{"data":{"id":"9a2e832e-e9b8-48f2-9251-f189ae5bae54","type":"incident_postmortems","attributes":{"created":"2026-07-09T20:46:37.029493Z","document_id":"","document_type":"","document_url":"https://docs.example.com/postmortem-test-get_postmortem_for_an_incident_returns_ok_response-1783629996","modified":"2026-07-09T20:46:37.029493Z","status":"draft","title":"Postmortem + for Test-Get_postmortem_for_an_incident_returns_OK_response-1783629996"},"relationships":{"incident":{"data":{"id":"4832db36-b2ec-5f98-917a-3b2fff43a58c","type":"incidents"}},"last_modified_by_user":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"postmortem_owner_responder":{"data":null},"postmortem_owner_user":{"data":null}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/4832db36-b2ec-5f98-917a-3b2fff43a58c/postmortem + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/4832db36-b2ec-5f98-917a-3b2fff43a58c + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_postmortem_for_an_incident_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_postmortem_for_an_incident_returns_ok_response.frozen new file mode 100644 index 0000000000..de335b344d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_postmortem_for_an_incident_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-07-09T20:46:38.293Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_postmortem_for_an_incident_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_postmortem_for_an_incident_returns_ok_response.yaml new file mode 100644 index 0000000000..352d5323eb --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_postmortem_for_an_incident_returns_ok_response.yaml @@ -0,0 +1,92 @@ +interactions: +- request: + body: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Update_postmortem_for_an_incident_returns_OK_response-1783629998"},"type":"incidents"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + string: '{"data":{"type":"incidents","id":"c22705d8-525c-52bd-89bc-c7b33823c592","attributes":{"public_id":364278,"incident_type_uuid":"41d2e10b-4108-4736-92d7-791d00ea0702","title":"Test-Update_postmortem_for_an_incident_returns_OK_response-1783629998","resolved":null,"customer_impact_scope":null,"customer_impact_start":null,"customer_impact_end":null,"customer_impacted":false,"notification_handles":null,"last_modified_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2026-07-09T20:46:38.508134+00:00","modified":"2026-07-09T20:46:38.508134+00:00","commander":null,"detected":"2026-07-09T20:46:38.500429+00:00","created_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"created_by_uuid":null,"creation_idempotency_key":null,"customer_impact_duration":0,"time_to_detect":0,"time_to_repair":0,"time_to_internal_response":0,"time_to_resolve":0,"is_test":false,"declared":"2026-07-09T20:46:38.508134+00:00","declared_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","name":"CI + Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"declared_by_uuid":null,"fields":{"teams":{"type":"autocomplete","value":null},"severity":{"type":"dropdown","value":"UNKNOWN"},"state":{"type":"dropdown","value":"active"},"detection_method":{"type":"dropdown","value":"unknown"},"root_cause":{"type":"textbox","value":null},"summary":{"type":"textbox","value":null},"services":{"type":"autocomplete","value":null},"slug":{"type":"textbox","value":"IR-364278"}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"last_modified_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"commander_user":{"data":null},"declared_by_user":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"user_defined_fields":{"data":[{"type":"user_defined_field","id":"3cbe9e60-d794-532c-acc0-73641f782813"},{"type":"user_defined_field","id":"33457d2a-570c-5567-b4af-979a2a8f1164"},{"type":"user_defined_field","id":"d003693c-bee9-5420-8d46-859269c20914"},{"type":"user_defined_field","id":"1ddff6f6-cb1f-51a0-9d81-dc18ef52cc9d"},{"type":"user_defined_field","id":"6bc9d32b-c2cd-591e-9b7a-74c886a5ddcf"},{"type":"user_defined_field","id":"95c53547-2ba3-5d8a-9c3b-cf245bc0c629"},{"type":"user_defined_field","id":"39044b03-cee4-555f-b1e0-3eb3aa759a86"},{"type":"user_defined_field","id":"2b9f1063-b915-4c7a-8bbd-fc3940245529"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"document_url":"https://docs.example.com/postmortem-test-update_postmortem_for_an_incident_returns_ok_response-1783629998","title":"Postmortem + for Test-Update_postmortem_for_an_incident_returns_OK_response-1783629998"},"type":"incident_postmortems"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/c22705d8-525c-52bd-89bc-c7b33823c592/postmortem + response: + body: + string: '{"data":{"id":"d37b1ea1-eeae-4fc9-93d0-41e64d9df187","type":"incident_postmortems","attributes":{"created":"2026-07-09T20:46:38.961153Z","document_id":"","document_type":"","document_url":"https://docs.example.com/postmortem-test-update_postmortem_for_an_incident_returns_ok_response-1783629998","modified":"2026-07-09T20:46:38.961153Z","status":"draft","title":"Postmortem + for Test-Update_postmortem_for_an_incident_returns_OK_response-1783629998"},"relationships":{"incident":{"data":{"id":"c22705d8-525c-52bd-89bc-c7b33823c592","type":"incidents"}},"last_modified_by_user":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"postmortem_owner_responder":{"data":null},"postmortem_owner_user":{"data":null}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"status":"in_review"},"id":"d37b1ea1-eeae-4fc9-93d0-41e64d9df187","type":"incident_postmortems"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/incidents/c22705d8-525c-52bd-89bc-c7b33823c592/postmortem + response: + body: + string: '{"data":{"id":"d37b1ea1-eeae-4fc9-93d0-41e64d9df187","type":"incident_postmortems","attributes":{"created":"2026-07-09T20:46:38.961153Z","document_id":"","document_type":"","document_url":"https://docs.example.com/postmortem-test-update_postmortem_for_an_incident_returns_ok_response-1783629998","modified":"2026-07-09T20:46:43.136363Z","status":"in_review","title":"Postmortem + for Test-Update_postmortem_for_an_incident_returns_OK_response-1783629998"},"relationships":{"incident":{"data":{"id":"c22705d8-525c-52bd-89bc-c7b33823c592","type":"incidents"}},"last_modified_by_user":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"postmortem_owner_responder":{"data":null},"postmortem_owner_user":{"data":null}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/c22705d8-525c-52bd-89bc-c7b33823c592/postmortem + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/c22705d8-525c-52bd-89bc-c7b33823c592 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 0f9de6d48a..d4b1c01299 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -602,6 +602,22 @@ "key": "incident_impact", "tag": "Incidents" }, + { + "parameters": [ + { + "name": "incident_id", + "source": "incident.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"incident_postmortems\",\n \"attributes\": {\n \"title\": \"Postmortem for {{ unique }}\",\n \"document_url\": \"https://docs.example.com/postmortem-{{ unique_lower }}\"\n }\n }\n}" + } + ], + "step": "there is a valid \"postmortem\" in the system", + "key": "postmortem", + "tag": "Incidents", + "operationId": "CreateIncidentPostmortem" + }, { "parameters": [ { diff --git a/tests/v2/features/incidents.feature b/tests/v2/features/incidents.feature index 646ec88d87..f06b7f6c83 100644 --- a/tests/v2/features/incidents.feature +++ b/tests/v2/features/incidents.feature @@ -314,6 +314,45 @@ Feature: Incidents When the request is sent Then the response status is 201 Created + @generated @skip @team:DataDog/incident-app + Scenario: Create postmortem for an incident returns "Bad Request" response + Given operation "CreateIncidentPostmortem" enabled + And new "CreateIncidentPostmortem" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"document_url": "https://app.datadoghq.com/notebook/123", "title": "Postmortem for IR-123"}, "type": "incident_postmortems"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/incident-app + Scenario: Create postmortem for an incident returns "CREATED" response + Given operation "CreateIncidentPostmortem" enabled + And there is a valid "incident" in the system + And new "CreateIncidentPostmortem" request + And request contains "incident_id" parameter from "incident.data.id" + And body with value {"data": {"attributes": {"document_url": "https://app.datadoghq.com/notebook/123", "title": "Postmortem for IR-123"}, "type": "incident_postmortems"}} + When the request is sent + Then the response status is 201 CREATED + And the response "data.type" is equal to "incident_postmortems" + And the response "data.relationships.incident.data.id" has the same value as "incident.data.id" + + @generated @skip @team:DataDog/incident-app + Scenario: Create postmortem for an incident returns "Conflict" response + Given operation "CreateIncidentPostmortem" enabled + And new "CreateIncidentPostmortem" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"document_url": "https://app.datadoghq.com/notebook/123", "title": "Postmortem for IR-123"}, "type": "incident_postmortems"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/incident-app + Scenario: Create postmortem for an incident returns "Not Found" response + Given operation "CreateIncidentPostmortem" enabled + And new "CreateIncidentPostmortem" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"document_url": "https://app.datadoghq.com/notebook/123", "title": "Postmortem for IR-123"}, "type": "incident_postmortems"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Create postmortem template returns "Bad Request" response Given operation "CreateIncidentPostmortemTemplate" enabled @@ -601,6 +640,32 @@ Feature: Incidents When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/incident-app + Scenario: Delete postmortem for an incident returns "Bad Request" response + Given operation "DeleteIncidentPostmortem" enabled + And new "DeleteIncidentPostmortem" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Delete postmortem for an incident returns "Not Found" response + Given operation "DeleteIncidentPostmortem" enabled + And new "DeleteIncidentPostmortem" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/incident-app + Scenario: Delete postmortem for an incident returns "OK" response + Given operation "DeleteIncidentPostmortem" enabled + And there is a valid "incident" in the system + And there is a valid "postmortem" in the system + And new "DeleteIncidentPostmortem" request + And request contains "incident_id" parameter from "postmortem.data.relationships.incident.data.id" + When the request is sent + Then the response status is 204 OK + @generated @skip @team:DataDog/incident-app Scenario: Delete postmortem template returns "Bad Request" response Given operation "DeleteIncidentPostmortemTemplate" enabled @@ -929,6 +994,33 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Get postmortem for an incident returns "Bad Request" response + Given operation "GetIncidentPostmortem" enabled + And new "GetIncidentPostmortem" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Get postmortem for an incident returns "Not Found" response + Given operation "GetIncidentPostmortem" enabled + And new "GetIncidentPostmortem" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/incident-app + Scenario: Get postmortem for an incident returns "OK" response + Given operation "GetIncidentPostmortem" enabled + And there is a valid "incident" in the system + And there is a valid "postmortem" in the system + And new "GetIncidentPostmortem" request + And request contains "incident_id" parameter from "postmortem.data.relationships.incident.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.title" has the same value as "postmortem.data.attributes.title" + @generated @skip @team:DataDog/incident-app Scenario: Get postmortem template returns "Bad Request" response Given operation "GetIncidentPostmortemTemplate" enabled @@ -1480,6 +1572,36 @@ Feature: Incidents And the response "data.attributes.name" has the same value as "unique" And the response "data.attributes.category" is equal to "update" + @generated @skip @team:DataDog/incident-app + Scenario: Update postmortem for an incident returns "Bad Request" response + Given operation "UpdateIncidentPostmortem" enabled + And new "UpdateIncidentPostmortem" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"status": "draft"}, "id": "00000000-0000-abcd-1000-000000000000", "type": "incident_postmortems"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Update postmortem for an incident returns "Not Found" response + Given operation "UpdateIncidentPostmortem" enabled + And new "UpdateIncidentPostmortem" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"status": "draft"}, "id": "00000000-0000-abcd-1000-000000000000", "type": "incident_postmortems"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/incident-app + Scenario: Update postmortem for an incident returns "OK" response + Given operation "UpdateIncidentPostmortem" enabled + And there is a valid "incident" in the system + And there is a valid "postmortem" in the system + And new "UpdateIncidentPostmortem" request + And request contains "incident_id" parameter from "postmortem.data.relationships.incident.data.id" + And body with value {"data": {"attributes": {"status": "in_review"}, "id": "{{ postmortem.data.id }}", "type": "incident_postmortems"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.status" is equal to "in_review" + @generated @skip @team:DataDog/incident-app Scenario: Update postmortem template returns "Bad Request" response Given operation "UpdateIncidentPostmortemTemplate" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 1eaba52ee9..d9d1f7b28d 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -3218,6 +3218,37 @@ "type": "idempotent" } }, + "DeleteIncidentPostmortem": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "GetIncidentPostmortem": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "UpdateIncidentPostmortem": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "CreateIncidentPostmortem": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentPostmortem", + "parameters": [ + { + "name": "incident_id", + "source": "data.relationships.incident.data.id" + } + ], + "type": "unsafe" + } + }, "ListIncidentIntegrations": { "tag": "Incidents", "undo": {