diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d3505929ef..8a6b2eecc2 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21602,6 +21602,82 @@ components: - type - attributes type: object + IncidentCreatePageAttributes: + description: Attributes for creating a page from an incident. + properties: + description: + description: Description of the page. + example: Page created for incident response + nullable: true + type: string + services: + description: List of services associated with the page. + example: + - web-service + - api-service + items: + type: string + nullable: true + type: array + tags: + description: List of tags for the page. + example: + - urgent + - production + items: + type: string + nullable: true + type: array + target: + $ref: '#/components/schemas/IncidentPageTarget' + title: + description: Title of the page. + example: Incident Response Page + type: string + required: + - title + - target + type: object + IncidentCreatePageFromIncidentData: + description: Data for creating a page from an incident. + properties: + attributes: + $ref: '#/components/schemas/IncidentCreatePageAttributes' + type: + $ref: '#/components/schemas/IncidentPageType' + required: + - type + - attributes + type: object + IncidentCreatePageFromIncidentRequest: + description: Request to create a page from an incident. + properties: + data: + $ref: '#/components/schemas/IncidentCreatePageFromIncidentData' + required: + - data + type: object + IncidentCreatePageResponse: + description: Response from creating a page from an incident. + properties: + data: + $ref: '#/components/schemas/IncidentCreatePageResponseData' + required: + - data + type: object + IncidentCreatePageResponseData: + description: Data from creating a page. + properties: + id: + description: The UUID of the created page. + example: 00000000-0000-0000-0000-000000000000 + type: string + type: + $ref: '#/components/schemas/IncidentPageIdType' + required: + - id + - type + type: object IncidentCreateRelationships: description: The relationships the incident will have with other resources once created. @@ -22586,6 +22662,48 @@ components: - id - type type: object + IncidentPageIdType: + description: Incident page ID type. + enum: + - page_uuid + example: page_uuid + type: string + x-enum-varnames: + - PAGE_UUID + IncidentPageTarget: + description: Target for creating a page from an incident. + properties: + identifier: + description: The identifier of the target (team handle, team UUID, or user + UUID). + example: team-handle + type: string + type: + $ref: '#/components/schemas/IncidentPageTargetType' + required: + - type + - identifier + type: object + IncidentPageTargetType: + description: Type of page target for incident pages. + enum: + - team_handle + - team_uuid + - user_uuid + example: team_handle + type: string + x-enum-varnames: + - TEAM_HANDLE + - TEAM_UUID + - USER_UUID + IncidentPageType: + description: Incident page type. + enum: + - page + example: page + type: string + x-enum-varnames: + - PAGE IncidentPostmortemType: default: incident_postmortems description: Incident postmortem resource type. @@ -50878,6 +50996,7 @@ components: is not required to set downtimes. monitors_read: View monitors. monitors_write: Edit, delete, and resolve individual monitors. + oncall_page: Create and manage on-call pages. org_connections_read: Read cross organization connections. org_connections_write: Create, edit, and delete cross organization connections. org_management: Edit org configurations, including authentication and @@ -59667,6 +59786,54 @@ paths: x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/{incident_id}/page: + post: + description: Create a page from an incident. + operationId: CreatePageFromIncident + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentCreatePageFromIncidentRequest' + description: Page creation request payload. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentCreatePageResponse' + 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 + - oncall_page + summary: Create a page from an incident + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - incident_read + - oncall_page + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents/{incident_id}/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 46aae7ec81..f3a87b941a 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -9027,6 +9027,41 @@ datadog\_api\_client.v2.model.incident\_create\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_create\_page\_attributes module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_create_page_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_create\_page\_from\_incident\_data module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_create_page_from_incident_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_create\_page\_from\_incident\_request module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_create_page_from_incident_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_create\_page\_response module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_create_page_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_create\_page\_response\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_create_page_response_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incident\_create\_relationships module -------------------------------------------------------------------- @@ -9475,6 +9510,34 @@ datadog\_api\_client.v2.model.incident\_notification\_template\_update\_data mod :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_page\_id\_type module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_page_id_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_page\_target module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_page_target + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_page\_target\_type module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_page_target_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_page\_type module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_page_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incident\_postmortem\_type module --------------------------------------------------------------- diff --git a/examples/v2/incidents/CreatePageFromIncident.py b/examples/v2/incidents/CreatePageFromIncident.py new file mode 100644 index 0000000000..e01a50250d --- /dev/null +++ b/examples/v2/incidents/CreatePageFromIncident.py @@ -0,0 +1,42 @@ +""" +Create a page from an incident 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.incident_create_page_attributes import IncidentCreatePageAttributes +from datadog_api_client.v2.model.incident_create_page_from_incident_data import IncidentCreatePageFromIncidentData +from datadog_api_client.v2.model.incident_create_page_from_incident_request import IncidentCreatePageFromIncidentRequest +from datadog_api_client.v2.model.incident_page_target import IncidentPageTarget +from datadog_api_client.v2.model.incident_page_target_type import IncidentPageTargetType +from datadog_api_client.v2.model.incident_page_type import IncidentPageType + +body = IncidentCreatePageFromIncidentRequest( + data=IncidentCreatePageFromIncidentData( + attributes=IncidentCreatePageAttributes( + description="Page created for incident response", + services=[ + "web-service", + "api-service", + ], + tags=[ + "urgent", + "production", + ], + target=IncidentPageTarget( + identifier="team-handle", + type=IncidentPageTargetType.TEAM_HANDLE, + ), + title="Incident Response Page", + ), + type=IncidentPageType.PAGE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_page_from_incident"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.create_page_from_incident(incident_id="incident_id", body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index e96df7dd4f..ffc5f40b4e 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -274,6 +274,7 @@ def __init__( "v2.create_incident_notification_template": False, "v2.create_incident_todo": False, "v2.create_incident_type": False, + "v2.create_page_from_incident": False, "v2.delete_incident": False, "v2.delete_incident_impact": False, "v2.delete_incident_integration": False, diff --git a/src/datadog_api_client/v2/api/incidents_api.py b/src/datadog_api_client/v2/api/incidents_api.py index b5f6b3a657..2129b48b50 100644 --- a/src/datadog_api_client/v2/api/incidents_api.py +++ b/src/datadog_api_client/v2/api/incidents_api.py @@ -49,6 +49,8 @@ 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_create_page_response import IncidentCreatePageResponse +from datadog_api_client.v2.model.incident_create_page_from_incident_request import IncidentCreatePageFromIncidentRequest from datadog_api_client.v2.model.incident_integration_metadata_list_response import ( IncidentIntegrationMetadataListResponse, ) @@ -239,6 +241,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_page_from_incident_endpoint = _Endpoint( + settings={ + "response_type": (IncidentCreatePageResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/{incident_id}/page", + "operation_id": "create_page_from_incident", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "incident_id": { + "required": True, + "openapi_types": (str,), + "attribute": "incident_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (IncidentCreatePageFromIncidentRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_incident_endpoint = _Endpoint( settings={ "response_type": None, @@ -1206,6 +1234,28 @@ def create_incident_type( return self._create_incident_type_endpoint.call_with_http_info(**kwargs) + def create_page_from_incident( + self, + incident_id: str, + body: IncidentCreatePageFromIncidentRequest, + ) -> IncidentCreatePageResponse: + """Create a page from an incident. + + Create a page from an incident. + + :param incident_id: The UUID of the incident. + :type incident_id: str + :param body: Page creation request payload. + :type body: IncidentCreatePageFromIncidentRequest + :rtype: IncidentCreatePageResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["incident_id"] = incident_id + + kwargs["body"] = body + + return self._create_page_from_incident_endpoint.call_with_http_info(**kwargs) + def delete_incident( self, incident_id: str, diff --git a/src/datadog_api_client/v2/model/incident_create_page_attributes.py b/src/datadog_api_client/v2/model/incident_create_page_attributes.py new file mode 100644 index 0000000000..55dba864b2 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_create_page_attributes.py @@ -0,0 +1,78 @@ +# 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, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_page_target import IncidentPageTarget + + +class IncidentCreatePageAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_page_target import IncidentPageTarget + + return { + "description": (str, none_type), + "services": ([str], none_type), + "tags": ([str], none_type), + "target": (IncidentPageTarget,), + "title": (str,), + } + + attribute_map = { + "description": "description", + "services": "services", + "tags": "tags", + "target": "target", + "title": "title", + } + + def __init__( + self_, + target: IncidentPageTarget, + title: str, + description: Union[str, none_type, UnsetType] = unset, + services: Union[List[str], none_type, UnsetType] = unset, + tags: Union[List[str], none_type, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for creating a page from an incident. + + :param description: Description of the page. + :type description: str, none_type, optional + + :param services: List of services associated with the page. + :type services: [str], none_type, optional + + :param tags: List of tags for the page. + :type tags: [str], none_type, optional + + :param target: Target for creating a page from an incident. + :type target: IncidentPageTarget + + :param title: Title of the page. + :type title: str + """ + if description is not unset: + kwargs["description"] = description + if services is not unset: + kwargs["services"] = services + if tags is not unset: + kwargs["tags"] = tags + super().__init__(kwargs) + + self_.target = target + self_.title = title diff --git a/src/datadog_api_client/v2/model/incident_create_page_from_incident_data.py b/src/datadog_api_client/v2/model/incident_create_page_from_incident_data.py new file mode 100644 index 0000000000..4065fcfe80 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_create_page_from_incident_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_create_page_attributes import IncidentCreatePageAttributes + from datadog_api_client.v2.model.incident_page_type import IncidentPageType + + +class IncidentCreatePageFromIncidentData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_create_page_attributes import IncidentCreatePageAttributes + from datadog_api_client.v2.model.incident_page_type import IncidentPageType + + return { + "attributes": (IncidentCreatePageAttributes,), + "type": (IncidentPageType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: IncidentCreatePageAttributes, type: IncidentPageType, **kwargs): + """ + Data for creating a page from an incident. + + :param attributes: Attributes for creating a page from an incident. + :type attributes: IncidentCreatePageAttributes + + :param type: Incident page type. + :type type: IncidentPageType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_create_page_from_incident_request.py b/src/datadog_api_client/v2/model/incident_create_page_from_incident_request.py new file mode 100644 index 0000000000..6b46bc1302 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_create_page_from_incident_request.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_create_page_from_incident_data import IncidentCreatePageFromIncidentData + + +class IncidentCreatePageFromIncidentRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_create_page_from_incident_data import ( + IncidentCreatePageFromIncidentData, + ) + + return { + "data": (IncidentCreatePageFromIncidentData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: IncidentCreatePageFromIncidentData, **kwargs): + """ + Request to create a page from an incident. + + :param data: Data for creating a page from an incident. + :type data: IncidentCreatePageFromIncidentData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/incident_create_page_response.py b/src/datadog_api_client/v2/model/incident_create_page_response.py new file mode 100644 index 0000000000..cf06d521bb --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_create_page_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.incident_create_page_response_data import IncidentCreatePageResponseData + + +class IncidentCreatePageResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_create_page_response_data import IncidentCreatePageResponseData + + return { + "data": (IncidentCreatePageResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: IncidentCreatePageResponseData, **kwargs): + """ + Response from creating a page from an incident. + + :param data: Data from creating a page. + :type data: IncidentCreatePageResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/incident_create_page_response_data.py b/src/datadog_api_client/v2/model/incident_create_page_response_data.py new file mode 100644 index 0000000000..ca6e39e200 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_create_page_response_data.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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_page_id_type import IncidentPageIdType + + +class IncidentCreatePageResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_page_id_type import IncidentPageIdType + + return { + "id": (str,), + "type": (IncidentPageIdType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: str, type: IncidentPageIdType, **kwargs): + """ + Data from creating a page. + + :param id: The UUID of the created page. + :type id: str + + :param type: Incident page ID type. + :type type: IncidentPageIdType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_page_id_type.py b/src/datadog_api_client/v2/model/incident_page_id_type.py new file mode 100644 index 0000000000..283a48a5ab --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_page_id_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 IncidentPageIdType(ModelSimple): + """ + Incident page ID type. + + :param value: If omitted defaults to "page_uuid". Must be one of ["page_uuid"]. + :type value: str + """ + + allowed_values = { + "page_uuid", + } + PAGE_UUID: ClassVar["IncidentPageIdType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +IncidentPageIdType.PAGE_UUID = IncidentPageIdType("page_uuid") diff --git a/src/datadog_api_client/v2/model/incident_page_target.py b/src/datadog_api_client/v2/model/incident_page_target.py new file mode 100644 index 0000000000..c17faf30ca --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_page_target.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 typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_page_target_type import IncidentPageTargetType + + +class IncidentPageTarget(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_page_target_type import IncidentPageTargetType + + return { + "identifier": (str,), + "type": (IncidentPageTargetType,), + } + + attribute_map = { + "identifier": "identifier", + "type": "type", + } + + def __init__(self_, identifier: str, type: IncidentPageTargetType, **kwargs): + """ + Target for creating a page from an incident. + + :param identifier: The identifier of the target (team handle, team UUID, or user UUID). + :type identifier: str + + :param type: Type of page target for incident pages. + :type type: IncidentPageTargetType + """ + super().__init__(kwargs) + + self_.identifier = identifier + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_page_target_type.py b/src/datadog_api_client/v2/model/incident_page_target_type.py new file mode 100644 index 0000000000..c171889a11 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_page_target_type.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 IncidentPageTargetType(ModelSimple): + """ + Type of page target for incident pages. + + :param value: Must be one of ["team_handle", "team_uuid", "user_uuid"]. + :type value: str + """ + + allowed_values = { + "team_handle", + "team_uuid", + "user_uuid", + } + TEAM_HANDLE: ClassVar["IncidentPageTargetType"] + TEAM_UUID: ClassVar["IncidentPageTargetType"] + USER_UUID: ClassVar["IncidentPageTargetType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +IncidentPageTargetType.TEAM_HANDLE = IncidentPageTargetType("team_handle") +IncidentPageTargetType.TEAM_UUID = IncidentPageTargetType("team_uuid") +IncidentPageTargetType.USER_UUID = IncidentPageTargetType("user_uuid") diff --git a/src/datadog_api_client/v2/model/incident_page_type.py b/src/datadog_api_client/v2/model/incident_page_type.py new file mode 100644 index 0000000000..a9ba0d997d --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_page_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 IncidentPageType(ModelSimple): + """ + Incident page type. + + :param value: If omitted defaults to "page". Must be one of ["page"]. + :type value: str + """ + + allowed_values = { + "page", + } + PAGE: ClassVar["IncidentPageType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +IncidentPageType.PAGE = IncidentPageType("page") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 04a8a449c6..137ab18cfe 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1691,6 +1691,11 @@ ) from datadog_api_client.v2.model.incident_create_attributes import IncidentCreateAttributes from datadog_api_client.v2.model.incident_create_data import IncidentCreateData +from datadog_api_client.v2.model.incident_create_page_attributes import IncidentCreatePageAttributes +from datadog_api_client.v2.model.incident_create_page_from_incident_data import IncidentCreatePageFromIncidentData +from datadog_api_client.v2.model.incident_create_page_from_incident_request import IncidentCreatePageFromIncidentRequest +from datadog_api_client.v2.model.incident_create_page_response import IncidentCreatePageResponse +from datadog_api_client.v2.model.incident_create_page_response_data import IncidentCreatePageResponseData from datadog_api_client.v2.model.incident_create_relationships import IncidentCreateRelationships from datadog_api_client.v2.model.incident_create_request import IncidentCreateRequest from datadog_api_client.v2.model.incident_field_attributes import IncidentFieldAttributes @@ -1795,6 +1800,10 @@ from datadog_api_client.v2.model.incident_notification_template_update_data import ( IncidentNotificationTemplateUpdateData, ) +from datadog_api_client.v2.model.incident_page_id_type import IncidentPageIdType +from datadog_api_client.v2.model.incident_page_target import IncidentPageTarget +from datadog_api_client.v2.model.incident_page_target_type import IncidentPageTargetType +from datadog_api_client.v2.model.incident_page_type import IncidentPageType from datadog_api_client.v2.model.incident_postmortem_type import IncidentPostmortemType from datadog_api_client.v2.model.incident_related_object import IncidentRelatedObject from datadog_api_client.v2.model.incident_responders_type import IncidentRespondersType @@ -5694,6 +5703,11 @@ "IncidentAttachmentsResponseIncludedItem", "IncidentCreateAttributes", "IncidentCreateData", + "IncidentCreatePageAttributes", + "IncidentCreatePageFromIncidentData", + "IncidentCreatePageFromIncidentRequest", + "IncidentCreatePageResponse", + "IncidentCreatePageResponseData", "IncidentCreateRelationships", "IncidentCreateRequest", "IncidentFieldAttributes", @@ -5758,6 +5772,10 @@ "IncidentNotificationTemplateType", "IncidentNotificationTemplateUpdateAttributes", "IncidentNotificationTemplateUpdateData", + "IncidentPageIdType", + "IncidentPageTarget", + "IncidentPageTargetType", + "IncidentPageType", "IncidentPostmortemType", "IncidentRelatedObject", "IncidentRespondersType", diff --git a/tests/v2/features/incidents.feature b/tests/v2/features/incidents.feature index 74ae965968..1b6eb3821a 100644 --- a/tests/v2/features/incidents.feature +++ b/tests/v2/features/incidents.feature @@ -21,6 +21,33 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Create a page from an incident returns "Bad Request" response + Given operation "CreatePageFromIncident" enabled + And new "CreatePageFromIncident" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create a page from an incident returns "Not Found" response + Given operation "CreatePageFromIncident" enabled + And new "CreatePageFromIncident" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Create a page from an incident returns "OK" response + Given operation "CreatePageFromIncident" enabled + And new "CreatePageFromIncident" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Create an incident attachment returns "OK" response Given operation "UpdateIncidentAttachments" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 6fcf52fced..985aaa0d7b 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1423,6 +1423,13 @@ "type": "idempotent" } }, + "CreatePageFromIncident": { + "tag": "Incidents", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, "ListIncidentIntegrations": { "tag": "Incidents", "undo": {