From 34c1802ef0b1efd59ce266242df4b6f684ec0ecf Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 5 Feb 2026 15:08:35 +0000 Subject: [PATCH] Regenerate client from commit f50b1f4 of spec repo --- .generator/schemas/v2/openapi.yaml | 264 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 56 ++++ .../CreateIncidentPostmortemTemplate.py | 27 ++ .../DeleteIncidentPostmortemTemplate.py | 14 + .../GetIncidentPostmortemTemplate.py | 16 ++ .../ListIncidentPostmortemTemplates.py | 14 + .../UpdateIncidentPostmortemTemplate.py | 27 ++ src/datadog_api_client/configuration.py | 5 + .../v2/api/incidents_api.py | 194 +++++++++++++ .../postmortem_template_attributes_request.py | 33 +++ ...postmortem_template_attributes_response.py | 46 +++ .../model/postmortem_template_data_request.py | 50 ++++ .../postmortem_template_data_response.py | 58 ++++ .../v2/model/postmortem_template_request.py | 40 +++ .../v2/model/postmortem_template_response.py | 40 +++ .../v2/model/postmortem_template_type.py | 35 +++ .../v2/model/postmortem_templates_response.py | 40 +++ src/datadog_api_client/v2/models/__init__.py | 16 ++ tests/v2/features/incidents.feature | 105 +++++++ tests/v2/features/undo.json | 37 +++ 20 files changed, 1117 insertions(+) create mode 100644 examples/v2/incidents/CreateIncidentPostmortemTemplate.py create mode 100644 examples/v2/incidents/DeleteIncidentPostmortemTemplate.py create mode 100644 examples/v2/incidents/GetIncidentPostmortemTemplate.py create mode 100644 examples/v2/incidents/ListIncidentPostmortemTemplates.py create mode 100644 examples/v2/incidents/UpdateIncidentPostmortemTemplate.py create mode 100644 src/datadog_api_client/v2/model/postmortem_template_attributes_request.py create mode 100644 src/datadog_api_client/v2/model/postmortem_template_attributes_response.py create mode 100644 src/datadog_api_client/v2/model/postmortem_template_data_request.py create mode 100644 src/datadog_api_client/v2/model/postmortem_template_data_response.py create mode 100644 src/datadog_api_client/v2/model/postmortem_template_request.py create mode 100644 src/datadog_api_client/v2/model/postmortem_template_response.py create mode 100644 src/datadog_api_client/v2/model/postmortem_template_type.py create mode 100644 src/datadog_api_client/v2/model/postmortem_templates_response.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 95f5775c6b..0f936d8d3a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -45141,6 +45141,92 @@ components: type: string x-enum-varnames: - MARKDOWN + PostmortemTemplateAttributesRequest: + properties: + name: + description: The name of the template + example: Standard Postmortem Template + type: string + required: + - name + type: object + PostmortemTemplateAttributesResponse: + properties: + createdAt: + description: When the template was created + example: '2026-01-13T17:15:53.208340Z' + format: date-time + type: string + modifiedAt: + description: When the template was last modified + example: '2026-01-13T17:15:53.208340Z' + format: date-time + type: string + name: + description: The name of the template + example: Standard Postmortem Template + type: string + required: + - name + - createdAt + - modifiedAt + type: object + PostmortemTemplateDataRequest: + properties: + attributes: + $ref: '#/components/schemas/PostmortemTemplateAttributesRequest' + type: + $ref: '#/components/schemas/PostmortemTemplateType' + required: + - type + - attributes + type: object + PostmortemTemplateDataResponse: + properties: + attributes: + $ref: '#/components/schemas/PostmortemTemplateAttributesResponse' + id: + description: The ID of the template + example: template-456 + type: string + type: + $ref: '#/components/schemas/PostmortemTemplateType' + required: + - id + - type + - attributes + type: object + PostmortemTemplateRequest: + properties: + data: + $ref: '#/components/schemas/PostmortemTemplateDataRequest' + required: + - data + type: object + PostmortemTemplateResponse: + properties: + data: + $ref: '#/components/schemas/PostmortemTemplateDataResponse' + required: + - data + type: object + PostmortemTemplateType: + description: Postmortem template resource type + enum: + - postmortem_template + example: postmortem_template + type: string + x-enum-varnames: + - POSTMORTEM_TEMPLATE + PostmortemTemplatesResponse: + properties: + data: + items: + $ref: '#/components/schemas/PostmortemTemplateDataResponse' + type: array + required: + - data + type: object Powerpack: description: Powerpacks are templated groups of dashboard widgets you can save from an existing dashboard and turn into reusable packs in the widget tray. @@ -78136,6 +78222,184 @@ paths: - incident_notification_settings_write x-unstable: '**Note**: This endpoint is in Preview. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/config/postmortem-templates: + get: + description: Retrieve a list of all postmortem templates for incidents. + operationId: ListIncidentPostmortemTemplates + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplatesResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List postmortem templates + tags: + - Incidents + 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 new postmortem template for incidents. + operationId: CreateIncidentPostmortemTemplate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create postmortem template + tags: + - Incidents + 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/config/postmortem-templates/{template_id}: + delete: + description: Delete a postmortem template. + operationId: DeleteIncidentPostmortemTemplate + parameters: + - description: The ID of the postmortem template + in: path + name: template_id + required: true + schema: + example: template-456 + type: string + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete postmortem template + tags: + - Incidents + 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: Retrieve details of a specific postmortem template. + operationId: GetIncidentPostmortemTemplate + parameters: + - description: The ID of the postmortem template + in: path + name: template_id + required: true + schema: + example: template-456 + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get postmortem template + tags: + - Incidents + 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 an existing postmortem template. + operationId: UpdateIncidentPostmortemTemplate + parameters: + - description: The ID of the postmortem template + in: path + name: template_id + required: true + schema: + example: template-456 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PostmortemTemplateResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update postmortem template + tags: + - Incidents + 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/config/types: get: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index fe0c2aa3ef..67cc19548b 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -19646,6 +19646,62 @@ datadog\_api\_client.v2.model.postmortem\_cell\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.postmortem\_template\_attributes\_request module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.postmortem_template_attributes_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.postmortem\_template\_attributes\_response module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.postmortem_template_attributes_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.postmortem\_template\_data\_request module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.postmortem_template_data_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.postmortem\_template\_data\_response module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.postmortem_template_data_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.postmortem\_template\_request module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.postmortem_template_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.postmortem\_template\_response module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.postmortem_template_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.postmortem\_template\_type module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.postmortem_template_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.postmortem\_templates\_response module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.postmortem_templates_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.powerpack module ---------------------------------------------- diff --git a/examples/v2/incidents/CreateIncidentPostmortemTemplate.py b/examples/v2/incidents/CreateIncidentPostmortemTemplate.py new file mode 100644 index 0000000000..666fe61834 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentPostmortemTemplate.py @@ -0,0 +1,27 @@ +""" +Create postmortem template returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi +from datadog_api_client.v2.model.postmortem_template_attributes_request import PostmortemTemplateAttributesRequest +from datadog_api_client.v2.model.postmortem_template_data_request import PostmortemTemplateDataRequest +from datadog_api_client.v2.model.postmortem_template_request import PostmortemTemplateRequest +from datadog_api_client.v2.model.postmortem_template_type import PostmortemTemplateType + +body = PostmortemTemplateRequest( + data=PostmortemTemplateDataRequest( + attributes=PostmortemTemplateAttributesRequest( + name="Standard Postmortem Template", + ), + type=PostmortemTemplateType.POSTMORTEM_TEMPLATE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_incident_postmortem_template"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.create_incident_postmortem_template(body=body) + + print(response) diff --git a/examples/v2/incidents/DeleteIncidentPostmortemTemplate.py b/examples/v2/incidents/DeleteIncidentPostmortemTemplate.py new file mode 100644 index 0000000000..81fd232dff --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentPostmortemTemplate.py @@ -0,0 +1,14 @@ +""" +Delete postmortem template returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +configuration = Configuration() +configuration.unstable_operations["delete_incident_postmortem_template"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + api_instance.delete_incident_postmortem_template( + template_id="template-456", + ) diff --git a/examples/v2/incidents/GetIncidentPostmortemTemplate.py b/examples/v2/incidents/GetIncidentPostmortemTemplate.py new file mode 100644 index 0000000000..2586d80563 --- /dev/null +++ b/examples/v2/incidents/GetIncidentPostmortemTemplate.py @@ -0,0 +1,16 @@ +""" +Get postmortem template returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +configuration = Configuration() +configuration.unstable_operations["get_incident_postmortem_template"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.get_incident_postmortem_template( + template_id="template-456", + ) + + print(response) diff --git a/examples/v2/incidents/ListIncidentPostmortemTemplates.py b/examples/v2/incidents/ListIncidentPostmortemTemplates.py new file mode 100644 index 0000000000..485b54eb7e --- /dev/null +++ b/examples/v2/incidents/ListIncidentPostmortemTemplates.py @@ -0,0 +1,14 @@ +""" +List postmortem templates returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +configuration = Configuration() +configuration.unstable_operations["list_incident_postmortem_templates"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.list_incident_postmortem_templates() + + print(response) diff --git a/examples/v2/incidents/UpdateIncidentPostmortemTemplate.py b/examples/v2/incidents/UpdateIncidentPostmortemTemplate.py new file mode 100644 index 0000000000..6d64780893 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentPostmortemTemplate.py @@ -0,0 +1,27 @@ +""" +Update postmortem template returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi +from datadog_api_client.v2.model.postmortem_template_attributes_request import PostmortemTemplateAttributesRequest +from datadog_api_client.v2.model.postmortem_template_data_request import PostmortemTemplateDataRequest +from datadog_api_client.v2.model.postmortem_template_request import PostmortemTemplateRequest +from datadog_api_client.v2.model.postmortem_template_type import PostmortemTemplateType + +body = PostmortemTemplateRequest( + data=PostmortemTemplateDataRequest( + attributes=PostmortemTemplateAttributesRequest( + name="Standard Postmortem Template", + ), + type=PostmortemTemplateType.POSTMORTEM_TEMPLATE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_incident_postmortem_template"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.update_incident_postmortem_template(template_id="template-456", body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index f4ec0cd2a5..f715f758fc 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -314,6 +314,7 @@ def __init__( "v2.create_incident_notification_rule": False, "v2.create_incident_notification_template": False, "v2.create_incident_postmortem_attachment": False, + "v2.create_incident_postmortem_template": False, "v2.create_incident_todo": False, "v2.create_incident_type": False, "v2.delete_global_incident_handle": False, @@ -322,6 +323,7 @@ def __init__( "v2.delete_incident_integration": False, "v2.delete_incident_notification_rule": False, "v2.delete_incident_notification_template": False, + "v2.delete_incident_postmortem_template": False, "v2.delete_incident_todo": False, "v2.delete_incident_type": False, "v2.get_global_incident_settings": False, @@ -329,6 +331,7 @@ def __init__( "v2.get_incident_integration": False, "v2.get_incident_notification_rule": False, "v2.get_incident_notification_template": False, + "v2.get_incident_postmortem_template": False, "v2.get_incident_todo": False, "v2.get_incident_type": False, "v2.list_global_incident_handles": False, @@ -336,6 +339,7 @@ def __init__( "v2.list_incident_integrations": False, "v2.list_incident_notification_rules": False, "v2.list_incident_notification_templates": False, + "v2.list_incident_postmortem_templates": False, "v2.list_incidents": False, "v2.list_incident_todos": False, "v2.list_incident_types": False, @@ -347,6 +351,7 @@ def __init__( "v2.update_incident_integration": False, "v2.update_incident_notification_rule": False, "v2.update_incident_notification_template": False, + "v2.update_incident_postmortem_template": False, "v2.update_incident_todo": False, "v2.update_incident_type": False, "v2.create_jira_issue_template": False, diff --git a/src/datadog_api_client/v2/api/incidents_api.py b/src/datadog_api_client/v2/api/incidents_api.py index ee28dec11e..3e0dadd2c5 100644 --- a/src/datadog_api_client/v2/api/incidents_api.py +++ b/src/datadog_api_client/v2/api/incidents_api.py @@ -37,6 +37,9 @@ from datadog_api_client.v2.model.patch_incident_notification_template_request import ( PatchIncidentNotificationTemplateRequest, ) +from datadog_api_client.v2.model.postmortem_templates_response import PostmortemTemplatesResponse +from datadog_api_client.v2.model.postmortem_template_response import PostmortemTemplateResponse +from datadog_api_client.v2.model.postmortem_template_request import PostmortemTemplateRequest from datadog_api_client.v2.model.incident_type_list_response import IncidentTypeListResponse from datadog_api_client.v2.model.incident_type_response import IncidentTypeResponse from datadog_api_client.v2.model.incident_type_create_request import IncidentTypeCreateRequest @@ -280,6 +283,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_incident_postmortem_template_endpoint = _Endpoint( + settings={ + "response_type": (PostmortemTemplateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/incidents/config/postmortem-templates", + "operation_id": "create_incident_postmortem_template", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (PostmortemTemplateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_incident_todo_endpoint = _Endpoint( settings={ "response_type": (IncidentTodoResponse,), @@ -508,6 +531,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_incident_postmortem_template_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/incidents/config/postmortem-templates/{template_id}", + "operation_id": "delete_incident_postmortem_template", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "template_id": { + "required": True, + "openapi_types": (str,), + "attribute": "template_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._delete_incident_todo_endpoint = _Endpoint( settings={ "response_type": None, @@ -690,6 +736,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_incident_postmortem_template_endpoint = _Endpoint( + settings={ + "response_type": (PostmortemTemplateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/incidents/config/postmortem-templates/{template_id}", + "operation_id": "get_incident_postmortem_template", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "template_id": { + "required": True, + "openapi_types": (str,), + "attribute": "template_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_incident_todo_endpoint = _Endpoint( settings={ "response_type": (IncidentTodoResponse,), @@ -898,6 +967,22 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_incident_postmortem_templates_endpoint = _Endpoint( + settings={ + "response_type": (PostmortemTemplatesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/incidents/config/postmortem-templates", + "operation_id": "list_incident_postmortem_templates", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_incidents_endpoint = _Endpoint( settings={ "response_type": (IncidentsResponse,), @@ -1227,6 +1312,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_incident_postmortem_template_endpoint = _Endpoint( + settings={ + "response_type": (PostmortemTemplateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/incidents/config/postmortem-templates/{template_id}", + "operation_id": "update_incident_postmortem_template", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "template_id": { + "required": True, + "openapi_types": (str,), + "attribute": "template_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (PostmortemTemplateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_incident_todo_endpoint = _Endpoint( settings={ "response_type": (IncidentTodoResponse,), @@ -1461,6 +1572,22 @@ def create_incident_postmortem_attachment( return self._create_incident_postmortem_attachment_endpoint.call_with_http_info(**kwargs) + def create_incident_postmortem_template( + self, + body: PostmortemTemplateRequest, + ) -> PostmortemTemplateResponse: + """Create postmortem template. + + Create a new postmortem template for incidents. + + :type body: PostmortemTemplateRequest + :rtype: PostmortemTemplateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_incident_postmortem_template_endpoint.call_with_http_info(**kwargs) + def create_incident_todo( self, incident_id: str, @@ -1641,6 +1768,23 @@ def delete_incident_notification_template( return self._delete_incident_notification_template_endpoint.call_with_http_info(**kwargs) + def delete_incident_postmortem_template( + self, + template_id: str, + ) -> None: + """Delete postmortem template. + + Delete a postmortem template. + + :param template_id: The ID of the postmortem template + :type template_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["template_id"] = template_id + + return self._delete_incident_postmortem_template_endpoint.call_with_http_info(**kwargs) + def delete_incident_todo( self, incident_id: str, @@ -1786,6 +1930,23 @@ def get_incident_notification_template( return self._get_incident_notification_template_endpoint.call_with_http_info(**kwargs) + def get_incident_postmortem_template( + self, + template_id: str, + ) -> PostmortemTemplateResponse: + """Get postmortem template. + + Retrieve details of a specific postmortem template. + + :param template_id: The ID of the postmortem template + :type template_id: str + :rtype: PostmortemTemplateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["template_id"] = template_id + + return self._get_incident_postmortem_template_endpoint.call_with_http_info(**kwargs) + def get_incident_todo( self, incident_id: str, @@ -1959,6 +2120,18 @@ def list_incident_notification_templates( return self._list_incident_notification_templates_endpoint.call_with_http_info(**kwargs) + def list_incident_postmortem_templates( + self, + ) -> PostmortemTemplatesResponse: + """List postmortem templates. + + Retrieve a list of all postmortem templates for incidents. + + :rtype: PostmortemTemplatesResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_incident_postmortem_templates_endpoint.call_with_http_info(**kwargs) + def list_incidents( self, *, @@ -2351,6 +2524,27 @@ def update_incident_notification_template( return self._update_incident_notification_template_endpoint.call_with_http_info(**kwargs) + def update_incident_postmortem_template( + self, + template_id: str, + body: PostmortemTemplateRequest, + ) -> PostmortemTemplateResponse: + """Update postmortem template. + + Update an existing postmortem template. + + :param template_id: The ID of the postmortem template + :type template_id: str + :type body: PostmortemTemplateRequest + :rtype: PostmortemTemplateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["template_id"] = template_id + + kwargs["body"] = body + + return self._update_incident_postmortem_template_endpoint.call_with_http_info(**kwargs) + def update_incident_todo( self, incident_id: str, diff --git a/src/datadog_api_client/v2/model/postmortem_template_attributes_request.py b/src/datadog_api_client/v2/model/postmortem_template_attributes_request.py new file mode 100644 index 0000000000..68159fb2b3 --- /dev/null +++ b/src/datadog_api_client/v2/model/postmortem_template_attributes_request.py @@ -0,0 +1,33 @@ +# 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 PostmortemTemplateAttributesRequest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + } + + attribute_map = { + "name": "name", + } + + def __init__(self_, name: str, **kwargs): + """ + + + :param name: The name of the template + :type name: str + """ + super().__init__(kwargs) + + self_.name = name diff --git a/src/datadog_api_client/v2/model/postmortem_template_attributes_response.py b/src/datadog_api_client/v2/model/postmortem_template_attributes_response.py new file mode 100644 index 0000000000..51f9687347 --- /dev/null +++ b/src/datadog_api_client/v2/model/postmortem_template_attributes_response.py @@ -0,0 +1,46 @@ +# 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, + datetime, +) + + +class PostmortemTemplateAttributesResponse(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "modified_at": (datetime,), + "name": (str,), + } + + attribute_map = { + "created_at": "createdAt", + "modified_at": "modifiedAt", + "name": "name", + } + + def __init__(self_, created_at: datetime, modified_at: datetime, name: str, **kwargs): + """ + + + :param created_at: When the template was created + :type created_at: datetime + + :param modified_at: When the template was last modified + :type modified_at: datetime + + :param name: The name of the template + :type name: str + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.modified_at = modified_at + self_.name = name diff --git a/src/datadog_api_client/v2/model/postmortem_template_data_request.py b/src/datadog_api_client/v2/model/postmortem_template_data_request.py new file mode 100644 index 0000000000..15e4aecfe1 --- /dev/null +++ b/src/datadog_api_client/v2/model/postmortem_template_data_request.py @@ -0,0 +1,50 @@ +# 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.postmortem_template_attributes_request import PostmortemTemplateAttributesRequest + from datadog_api_client.v2.model.postmortem_template_type import PostmortemTemplateType + + +class PostmortemTemplateDataRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.postmortem_template_attributes_request import ( + PostmortemTemplateAttributesRequest, + ) + from datadog_api_client.v2.model.postmortem_template_type import PostmortemTemplateType + + return { + "attributes": (PostmortemTemplateAttributesRequest,), + "type": (PostmortemTemplateType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: PostmortemTemplateAttributesRequest, type: PostmortemTemplateType, **kwargs): + """ + + + :param attributes: + :type attributes: PostmortemTemplateAttributesRequest + + :param type: Postmortem template resource type + :type type: PostmortemTemplateType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/postmortem_template_data_response.py b/src/datadog_api_client/v2/model/postmortem_template_data_response.py new file mode 100644 index 0000000000..660f4b090d --- /dev/null +++ b/src/datadog_api_client/v2/model/postmortem_template_data_response.py @@ -0,0 +1,58 @@ +# 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.postmortem_template_attributes_response import PostmortemTemplateAttributesResponse + from datadog_api_client.v2.model.postmortem_template_type import PostmortemTemplateType + + +class PostmortemTemplateDataResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.postmortem_template_attributes_response import ( + PostmortemTemplateAttributesResponse, + ) + from datadog_api_client.v2.model.postmortem_template_type import PostmortemTemplateType + + return { + "attributes": (PostmortemTemplateAttributesResponse,), + "id": (str,), + "type": (PostmortemTemplateType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: PostmortemTemplateAttributesResponse, id: str, type: PostmortemTemplateType, **kwargs + ): + """ + + + :param attributes: + :type attributes: PostmortemTemplateAttributesResponse + + :param id: The ID of the template + :type id: str + + :param type: Postmortem template resource type + :type type: PostmortemTemplateType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/postmortem_template_request.py b/src/datadog_api_client/v2/model/postmortem_template_request.py new file mode 100644 index 0000000000..e327511e36 --- /dev/null +++ b/src/datadog_api_client/v2/model/postmortem_template_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.postmortem_template_data_request import PostmortemTemplateDataRequest + + +class PostmortemTemplateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.postmortem_template_data_request import PostmortemTemplateDataRequest + + return { + "data": (PostmortemTemplateDataRequest,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: PostmortemTemplateDataRequest, **kwargs): + """ + + + :param data: + :type data: PostmortemTemplateDataRequest + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/postmortem_template_response.py b/src/datadog_api_client/v2/model/postmortem_template_response.py new file mode 100644 index 0000000000..84dc53e94b --- /dev/null +++ b/src/datadog_api_client/v2/model/postmortem_template_response.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.postmortem_template_data_response import PostmortemTemplateDataResponse + + +class PostmortemTemplateResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.postmortem_template_data_response import PostmortemTemplateDataResponse + + return { + "data": (PostmortemTemplateDataResponse,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: PostmortemTemplateDataResponse, **kwargs): + """ + + + :param data: + :type data: PostmortemTemplateDataResponse + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/postmortem_template_type.py b/src/datadog_api_client/v2/model/postmortem_template_type.py new file mode 100644 index 0000000000..32cc6aadc6 --- /dev/null +++ b/src/datadog_api_client/v2/model/postmortem_template_type.py @@ -0,0 +1,35 @@ +# 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 PostmortemTemplateType(ModelSimple): + """ + Postmortem template resource type + + :param value: If omitted defaults to "postmortem_template". Must be one of ["postmortem_template"]. + :type value: str + """ + + allowed_values = { + "postmortem_template", + } + POSTMORTEM_TEMPLATE: ClassVar["PostmortemTemplateType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PostmortemTemplateType.POSTMORTEM_TEMPLATE = PostmortemTemplateType("postmortem_template") diff --git a/src/datadog_api_client/v2/model/postmortem_templates_response.py b/src/datadog_api_client/v2/model/postmortem_templates_response.py new file mode 100644 index 0000000000..56eb28cc77 --- /dev/null +++ b/src/datadog_api_client/v2/model/postmortem_templates_response.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 List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.postmortem_template_data_response import PostmortemTemplateDataResponse + + +class PostmortemTemplatesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.postmortem_template_data_response import PostmortemTemplateDataResponse + + return { + "data": ([PostmortemTemplateDataResponse],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[PostmortemTemplateDataResponse], **kwargs): + """ + + + :param data: + :type data: [PostmortemTemplateDataResponse] + """ + 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 400d568fb4..78432fd8c4 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -4020,6 +4020,14 @@ 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_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 +from datadog_api_client.v2.model.postmortem_template_data_response import PostmortemTemplateDataResponse +from datadog_api_client.v2.model.postmortem_template_request import PostmortemTemplateRequest +from datadog_api_client.v2.model.postmortem_template_response import PostmortemTemplateResponse +from datadog_api_client.v2.model.postmortem_template_type import PostmortemTemplateType +from datadog_api_client.v2.model.postmortem_templates_response import PostmortemTemplatesResponse from datadog_api_client.v2.model.powerpack import Powerpack from datadog_api_client.v2.model.powerpack_attributes import PowerpackAttributes from datadog_api_client.v2.model.powerpack_data import PowerpackData @@ -8776,6 +8784,14 @@ "PostmortemCellAttributes", "PostmortemCellDefinition", "PostmortemCellType", + "PostmortemTemplateAttributesRequest", + "PostmortemTemplateAttributesResponse", + "PostmortemTemplateDataRequest", + "PostmortemTemplateDataResponse", + "PostmortemTemplateRequest", + "PostmortemTemplateResponse", + "PostmortemTemplateType", + "PostmortemTemplatesResponse", "Powerpack", "PowerpackAttributes", "PowerpackData", diff --git a/tests/v2/features/incidents.feature b/tests/v2/features/incidents.feature index db70635584..a683c2cac1 100644 --- a/tests/v2/features/incidents.feature +++ b/tests/v2/features/incidents.feature @@ -290,6 +290,22 @@ Feature: Incidents When the request is sent Then the response status is 201 Created + @generated @skip @team:DataDog/incident-app + Scenario: Create postmortem template returns "Bad Request" response + Given operation "CreateIncidentPostmortemTemplate" enabled + And new "CreateIncidentPostmortemTemplate" request + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create postmortem template returns "Created" response + Given operation "CreateIncidentPostmortemTemplate" enabled + And new "CreateIncidentPostmortemTemplate" request + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + When the request is sent + Then the response status is 201 Created + @generated @skip @team:Datadog/incident-app Scenario: Delete a notification template returns "Bad Request" response Given operation "DeleteIncidentNotificationTemplate" enabled @@ -537,6 +553,30 @@ Feature: Incidents When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/incident-app + Scenario: Delete postmortem template returns "Bad Request" response + Given operation "DeleteIncidentPostmortemTemplate" enabled + And new "DeleteIncidentPostmortemTemplate" request + And request contains "template_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 template returns "No Content" response + Given operation "DeleteIncidentPostmortemTemplate" enabled + And new "DeleteIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/incident-app + Scenario: Delete postmortem template returns "Not Found" response + Given operation "DeleteIncidentPostmortemTemplate" enabled + And new "DeleteIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Get a list of an incident's integration metadata returns "Bad Request" response Given operation "ListIncidentIntegrations" enabled @@ -811,6 +851,30 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Get postmortem template returns "Bad Request" response + Given operation "GetIncidentPostmortemTemplate" enabled + And new "GetIncidentPostmortemTemplate" request + And request contains "template_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 template returns "Not Found" response + Given operation "GetIncidentPostmortemTemplate" enabled + And new "GetIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Get postmortem template returns "OK" response + Given operation "GetIncidentPostmortemTemplate" enabled + And new "GetIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Get the details of an incident returns "Bad Request" response Given operation "GetIncident" enabled @@ -940,6 +1004,20 @@ Feature: Incidents Then the response status is 200 OK And the response "data" has length 0 + @generated @skip @team:DataDog/incident-app + Scenario: List postmortem templates returns "Bad Request" response + Given operation "ListIncidentPostmortemTemplates" enabled + And new "ListIncidentPostmortemTemplates" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: List postmortem templates returns "OK" response + Given operation "ListIncidentPostmortemTemplates" enabled + And new "ListIncidentPostmortemTemplates" request + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Remove commander from an incident returns "OK" response Given operation "UpdateIncident" enabled @@ -1270,3 +1348,30 @@ Feature: Incidents And the response "data.id" has the same value as "notification_template.data.id" 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 template returns "Bad Request" response + Given operation "UpdateIncidentPostmortemTemplate" enabled + And new "UpdateIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Update postmortem template returns "Not Found" response + Given operation "UpdateIncidentPostmortemTemplate" enabled + And new "UpdateIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Update postmortem template returns "OK" response + Given operation "UpdateIncidentPostmortemTemplate" enabled + And new "UpdateIncidentPostmortemTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Standard Postmortem Template"}, "type": "postmortem_template"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 7e549784ee..c77dfee335 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1761,6 +1761,43 @@ "type": "idempotent" } }, + "ListIncidentPostmortemTemplates": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentPostmortemTemplate": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentPostmortemTemplate", + "parameters": [ + { + "name": "template_id", + "source": "" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentPostmortemTemplate": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "GetIncidentPostmortemTemplate": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "UpdateIncidentPostmortemTemplate": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ListIncidentTypes": { "tag": "Incidents", "undo": {