diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 42b12a3fb0..4ed0b35204 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -467,6 +467,23 @@ components: required: true schema: type: string + IncidentImpactIDPathParameter: + description: The UUID of the incident impact. + in: path + name: impact_id + required: true + schema: + type: string + IncidentImpactIncludeQueryParameter: + description: Specifies which related resources should be included in the response. + explode: false + in: query + name: include + required: false + schema: + items: + $ref: '#/components/schemas/IncidentImpactRelatedObject' + type: array IncidentIncludeQueryParameter: description: Specifies which types of related objects should be included in the response. @@ -20120,6 +20137,177 @@ components: - TEXTARRAY - METRICTAG - AUTOCOMPLETE + IncidentImpactAttributes: + description: The incident impact's attributes. + properties: + created: + description: Timestamp when the impact was created. + example: '2025-08-29T13:17:00Z' + format: date-time + readOnly: true + type: string + description: + description: Description of the impact. + example: Service was unavailable for external users + type: string + end_at: + description: Timestamp when the impact ended. + example: '2025-08-29T13:17:00Z' + format: date-time + nullable: true + type: string + fields: + $ref: '#/components/schemas/IncidentImpactFieldsObject' + impact_type: + description: The type of impact. + example: customer + type: string + modified: + description: Timestamp when the impact was last modified. + example: '2025-08-29T13:17:00Z' + format: date-time + readOnly: true + type: string + start_at: + description: Timestamp representing when the impact started. + example: '2025-08-28T13:17:00Z' + format: date-time + type: string + required: + - description + - start_at + type: object + IncidentImpactCreateAttributes: + description: The incident impact's attributes for a create request. + properties: + description: + description: Description of the impact. + example: Service was unavailable for external users + type: string + end_at: + description: Timestamp when the impact ended. + example: '2025-08-29T13:17:00Z' + format: date-time + nullable: true + type: string + fields: + $ref: '#/components/schemas/IncidentImpactFieldsObject' + start_at: + description: Timestamp when the impact started. + example: '2025-08-28T13:17:00Z' + format: date-time + type: string + required: + - description + - start_at + type: object + IncidentImpactCreateData: + description: Incident impact data for a create request. + properties: + attributes: + $ref: '#/components/schemas/IncidentImpactCreateAttributes' + type: + $ref: '#/components/schemas/IncidentImpactType' + required: + - type + - attributes + type: object + IncidentImpactCreateRequest: + description: Create request for an incident impact. + properties: + data: + $ref: '#/components/schemas/IncidentImpactCreateData' + required: + - data + type: object + IncidentImpactFieldsObject: + additionalProperties: {} + description: An object mapping impact field names to field values. + example: + customers_impacted: all + products_impacted: + - shopping + - marketing + nullable: true + type: object + IncidentImpactRelatedObject: + description: A reference to a resource related to an incident impact. + enum: + - incident + - created_by_user + - last_modified_by_user + type: string + x-enum-varnames: + - INCIDENT + - CREATED_BY_USER + - LAST_MODIFIED_BY_USER + IncidentImpactRelationships: + description: The incident impact's resource relationships. + properties: + created_by_user: + $ref: '#/components/schemas/RelationshipToUser' + incident: + $ref: '#/components/schemas/RelationshipToIncident' + last_modified_by_user: + $ref: '#/components/schemas/RelationshipToUser' + type: object + IncidentImpactResponse: + description: Response with an incident impact. + properties: + data: + $ref: '#/components/schemas/IncidentImpactResponseData' + included: + description: Included related resources that the user requested. + items: + $ref: '#/components/schemas/IncidentUserData' + readOnly: true + type: array + required: + - data + type: object + IncidentImpactResponseData: + description: Incident impact data from a response. + properties: + attributes: + $ref: '#/components/schemas/IncidentImpactAttributes' + id: + description: The incident impact's ID. + example: 00000000-0000-0000-1234-000000000000 + type: string + relationships: + $ref: '#/components/schemas/IncidentImpactRelationships' + type: + $ref: '#/components/schemas/IncidentImpactType' + required: + - id + - type + type: object + IncidentImpactType: + default: incident_impacts + description: Incident impact resource type. + enum: + - incident_impacts + example: incident_impacts + type: string + x-enum-varnames: + - INCIDENT_IMPACTS + IncidentImpactsResponse: + description: Response with a list of incident impacts. + properties: + data: + description: An array of incident impacts. + items: + $ref: '#/components/schemas/IncidentImpactResponseData' + type: array + included: + description: Included related resources that the user requested. + items: + $ref: '#/components/schemas/IncidentUserData' + readOnly: true + type: array + required: + - data + type: object IncidentImpactsType: description: The incident impacts type. enum: @@ -20897,6 +21085,7 @@ components: - data type: object IncidentResponseAttributes: + additionalProperties: {} description: The incident's attributes from a response. properties: archived: @@ -20941,6 +21130,17 @@ components: description: A flag indicating whether the incident caused customer impact. example: false type: boolean + declared: + description: Timestamp when the incident was declared. + format: date-time + readOnly: true + type: string + declared_by: + $ref: '#/components/schemas/IncidentNonDatadogCreator' + declared_by_uuid: + description: UUID of the user who declared the incident. + nullable: true + type: string detected: description: Timestamp when the incident was detected. format: date-time @@ -21096,6 +21296,8 @@ components: $ref: '#/components/schemas/NullableRelationshipToUser' created_by_user: $ref: '#/components/schemas/RelationshipToUser' + declared_by_user: + $ref: '#/components/schemas/RelationshipToUser' impacts: $ref: '#/components/schemas/RelationshipToIncidentImpacts' integrations: @@ -35408,6 +35610,14 @@ components: description: Relationship type. type: string type: object + RelationshipToIncident: + description: Relationship to incident. + properties: + data: + $ref: '#/components/schemas/RelationshipToIncidentData' + required: + - data + type: object RelationshipToIncidentAttachment: description: A relationship reference for attachments. properties: @@ -35432,6 +35642,19 @@ components: - id - type type: object + RelationshipToIncidentData: + description: Relationship to incident object. + properties: + id: + description: A unique identifier that represents the incident. + example: 00000000-0000-0000-1234-000000000000 + type: string + type: + $ref: '#/components/schemas/IncidentType' + required: + - id + - type + type: object RelationshipToIncidentImpactData: description: Relationship to impact object. properties: @@ -56351,6 +56574,124 @@ paths: - incident_write x-unstable: '**Note**: This endpoint is in public beta. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/{incident_id}/impacts: + get: + description: Get all impacts for an incident. + operationId: ListIncidentImpacts + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/IncidentImpactIncludeQueryParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentImpactsResponse' + 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: List an incident's impacts + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_read + x-unstable: '**Note**: This endpoint is in Preview. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create an impact for an incident. + operationId: CreateIncidentImpact + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/IncidentImpactIncludeQueryParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentImpactCreateRequest' + description: Incident impact payload. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentImpactResponse' + description: CREATED + '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: Create an incident impact + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_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/{incident_id}/impacts/{impact_id}: + delete: + description: Delete an incident impact. + operationId: DeleteIncidentImpact + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/IncidentImpactIDPathParameter' + responses: + '204': + description: No Content + '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 an incident impact + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_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/{incident_id}/relationships/integrations: get: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 1c4562c8ec..a344640c49 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -8593,6 +8593,83 @@ datadog\_api\_client.v2.model.incident\_field\_attributes\_value\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_impact\_attributes module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impact\_create\_attributes module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_create_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impact\_create\_data module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impact\_create\_request module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impact\_fields\_object module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_fields_object + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impact\_related\_object module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_related_object + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impact\_relationships module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impact\_response module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impact\_response\_data module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impact\_type module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impact_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_impacts\_response module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_impacts_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incident\_impacts\_type module ------------------------------------------------------------ @@ -15355,6 +15432,13 @@ datadog\_api\_client.v2.model.relationship\_item module :members: :show-inheritance: +datadog\_api\_client.v2.model.relationship\_to\_incident module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.relationship_to_incident + :members: + :show-inheritance: + datadog\_api\_client.v2.model.relationship\_to\_incident\_attachment module --------------------------------------------------------------------------- @@ -15369,6 +15453,13 @@ datadog\_api\_client.v2.model.relationship\_to\_incident\_attachment\_data modul :members: :show-inheritance: +datadog\_api\_client.v2.model.relationship\_to\_incident\_data module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.relationship_to_incident_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.relationship\_to\_incident\_impact\_data module ----------------------------------------------------------------------------- diff --git a/examples/v2/incidents/CreateIncidentImpact.py b/examples/v2/incidents/CreateIncidentImpact.py new file mode 100644 index 0000000000..24a6e5bc49 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentImpact.py @@ -0,0 +1,35 @@ +""" +Create an incident impact 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_impact_create_attributes import IncidentImpactCreateAttributes +from datadog_api_client.v2.model.incident_impact_create_data import IncidentImpactCreateData +from datadog_api_client.v2.model.incident_impact_create_request import IncidentImpactCreateRequest +from datadog_api_client.v2.model.incident_impact_type import IncidentImpactType +from datetime import datetime +from dateutil.tz import tzutc + +# there is a valid "incident" in the system +INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"] + +body = IncidentImpactCreateRequest( + data=IncidentImpactCreateData( + type=IncidentImpactType.INCIDENT_IMPACTS, + attributes=IncidentImpactCreateAttributes( + start_at=datetime(2025, 9, 12, 13, 50, tzinfo=tzutc()), + end_at=datetime(2025, 9, 12, 14, 50, tzinfo=tzutc()), + description="Outage in the us-east-1 region", + ), + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_incident_impact"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.create_incident_impact(incident_id=INCIDENT_DATA_ID, body=body) + + print(response) diff --git a/examples/v2/incidents/DeleteIncidentImpact.py b/examples/v2/incidents/DeleteIncidentImpact.py new file mode 100644 index 0000000000..95a4fa2732 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentImpact.py @@ -0,0 +1,20 @@ +""" +Delete an incident impact returns "No Content" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +# the "incident" has an "incident_impact" +INCIDENT_IMPACT_DATA_ID = environ["INCIDENT_IMPACT_DATA_ID"] +INCIDENT_IMPACT_DATA_RELATIONSHIPS_INCIDENT_DATA_ID = environ["INCIDENT_IMPACT_DATA_RELATIONSHIPS_INCIDENT_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["delete_incident_impact"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + api_instance.delete_incident_impact( + incident_id=INCIDENT_IMPACT_DATA_RELATIONSHIPS_INCIDENT_DATA_ID, + impact_id=INCIDENT_IMPACT_DATA_ID, + ) diff --git a/examples/v2/incidents/ListIncidentImpacts.py b/examples/v2/incidents/ListIncidentImpacts.py new file mode 100644 index 0000000000..cf41f4b312 --- /dev/null +++ b/examples/v2/incidents/ListIncidentImpacts.py @@ -0,0 +1,20 @@ +""" +List an incident's impacts 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 "incident" in the system +INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["list_incident_impacts"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.list_incident_impacts( + incident_id=INCIDENT_DATA_ID, + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index d2ae00ff19..d03a705882 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -268,12 +268,14 @@ def __init__( "v2.create_data_deletion_request": False, "v2.get_data_deletion_requests": False, "v2.create_incident": False, + "v2.create_incident_impact": False, "v2.create_incident_integration": False, "v2.create_incident_notification_rule": False, "v2.create_incident_notification_template": False, "v2.create_incident_todo": False, "v2.create_incident_type": False, "v2.delete_incident": False, + "v2.delete_incident_impact": False, "v2.delete_incident_integration": False, "v2.delete_incident_notification_rule": False, "v2.delete_incident_notification_template": False, @@ -286,6 +288,7 @@ def __init__( "v2.get_incident_todo": False, "v2.get_incident_type": False, "v2.list_incident_attachments": False, + "v2.list_incident_impacts": False, "v2.list_incident_integrations": False, "v2.list_incident_notification_rules": False, "v2.list_incident_notification_templates": False, diff --git a/src/datadog_api_client/v2/api/incidents_api.py b/src/datadog_api_client/v2/api/incidents_api.py index 99ae061de9..b5f6b3a657 100644 --- a/src/datadog_api_client/v2/api/incidents_api.py +++ b/src/datadog_api_client/v2/api/incidents_api.py @@ -45,6 +45,10 @@ from datadog_api_client.v2.model.incident_attachment_attachment_type import IncidentAttachmentAttachmentType from datadog_api_client.v2.model.incident_attachment_update_response import IncidentAttachmentUpdateResponse from datadog_api_client.v2.model.incident_attachment_update_request import IncidentAttachmentUpdateRequest +from datadog_api_client.v2.model.incident_impacts_response import IncidentImpactsResponse +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_integration_metadata_list_response import ( IncidentIntegrationMetadataListResponse, ) @@ -91,6 +95,38 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_incident_impact_endpoint = _Endpoint( + settings={ + "response_type": (IncidentImpactResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/{incident_id}/impacts", + "operation_id": "create_incident_impact", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "incident_id": { + "required": True, + "openapi_types": (str,), + "attribute": "incident_id", + "location": "path", + }, + "include": { + "openapi_types": ([IncidentImpactRelatedObject],), + "attribute": "include", + "location": "query", + "collection_format": "csv", + }, + "body": { + "required": True, + "openapi_types": (IncidentImpactCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_incident_integration_endpoint = _Endpoint( settings={ "response_type": (IncidentIntegrationMetadataResponse,), @@ -226,6 +262,35 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_incident_impact_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/{incident_id}/impacts/{impact_id}", + "operation_id": "delete_incident_impact", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "incident_id": { + "required": True, + "openapi_types": (str,), + "attribute": "incident_id", + "location": "path", + }, + "impact_id": { + "required": True, + "openapi_types": (str,), + "attribute": "impact_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._delete_incident_integration_endpoint = _Endpoint( settings={ "response_type": None, @@ -564,6 +629,35 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_incident_impacts_endpoint = _Endpoint( + settings={ + "response_type": (IncidentImpactsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/{incident_id}/impacts", + "operation_id": "list_incident_impacts", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "incident_id": { + "required": True, + "openapi_types": (str,), + "attribute": "incident_id", + "location": "path", + }, + "include": { + "openapi_types": ([IncidentImpactRelatedObject],), + "attribute": "include", + "location": "query", + "collection_format": "csv", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_incident_integrations_endpoint = _Endpoint( settings={ "response_type": (IncidentIntegrationMetadataListResponse,), @@ -990,6 +1084,35 @@ def create_incident( return self._create_incident_endpoint.call_with_http_info(**kwargs) + def create_incident_impact( + self, + incident_id: str, + body: IncidentImpactCreateRequest, + *, + include: Union[List[IncidentImpactRelatedObject], UnsetType] = unset, + ) -> IncidentImpactResponse: + """Create an incident impact. + + Create an impact for an incident. + + :param incident_id: The UUID of the incident. + :type incident_id: str + :param body: Incident impact payload. + :type body: IncidentImpactCreateRequest + :param include: Specifies which related resources should be included in the response. + :type include: [IncidentImpactRelatedObject], optional + :rtype: IncidentImpactResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["incident_id"] = incident_id + + if include is not unset: + kwargs["include"] = include + + kwargs["body"] = body + + return self._create_incident_impact_endpoint.call_with_http_info(**kwargs) + def create_incident_integration( self, incident_id: str, @@ -1100,6 +1223,28 @@ def delete_incident( return self._delete_incident_endpoint.call_with_http_info(**kwargs) + def delete_incident_impact( + self, + incident_id: str, + impact_id: str, + ) -> None: + """Delete an incident impact. + + Delete an incident impact. + + :param incident_id: The UUID of the incident. + :type incident_id: str + :param impact_id: The UUID of the incident impact. + :type impact_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["incident_id"] = incident_id + + kwargs["impact_id"] = impact_id + + return self._delete_incident_impact_endpoint.call_with_http_info(**kwargs) + def delete_incident_integration( self, incident_id: str, @@ -1372,6 +1517,30 @@ def list_incident_attachments( return self._list_incident_attachments_endpoint.call_with_http_info(**kwargs) + def list_incident_impacts( + self, + incident_id: str, + *, + include: Union[List[IncidentImpactRelatedObject], UnsetType] = unset, + ) -> IncidentImpactsResponse: + """List an incident's impacts. + + Get all impacts for an incident. + + :param incident_id: The UUID of the incident. + :type incident_id: str + :param include: Specifies which related resources should be included in the response. + :type include: [IncidentImpactRelatedObject], optional + :rtype: IncidentImpactsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["incident_id"] = incident_id + + if include is not unset: + kwargs["include"] = include + + return self._list_incident_impacts_endpoint.call_with_http_info(**kwargs) + def list_incident_integrations( self, incident_id: str, diff --git a/src/datadog_api_client/v2/model/incident_impact_attributes.py b/src/datadog_api_client/v2/model/incident_impact_attributes.py new file mode 100644 index 0000000000..8465ff1d7b --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_attributes.py @@ -0,0 +1,99 @@ +# 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, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_impact_fields_object import IncidentImpactFieldsObject + + +class IncidentImpactAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_impact_fields_object import IncidentImpactFieldsObject + + return { + "created": (datetime,), + "description": (str,), + "end_at": (datetime, none_type), + "fields": (IncidentImpactFieldsObject,), + "impact_type": (str,), + "modified": (datetime,), + "start_at": (datetime,), + } + + attribute_map = { + "created": "created", + "description": "description", + "end_at": "end_at", + "fields": "fields", + "impact_type": "impact_type", + "modified": "modified", + "start_at": "start_at", + } + read_only_vars = { + "created", + "modified", + } + + def __init__( + self_, + description: str, + start_at: datetime, + created: Union[datetime, UnsetType] = unset, + end_at: Union[datetime, none_type, UnsetType] = unset, + fields: Union[IncidentImpactFieldsObject, none_type, UnsetType] = unset, + impact_type: Union[str, UnsetType] = unset, + modified: Union[datetime, UnsetType] = unset, + **kwargs, + ): + """ + The incident impact's attributes. + + :param created: Timestamp when the impact was created. + :type created: datetime, optional + + :param description: Description of the impact. + :type description: str + + :param end_at: Timestamp when the impact ended. + :type end_at: datetime, none_type, optional + + :param fields: An object mapping impact field names to field values. + :type fields: IncidentImpactFieldsObject, none_type, optional + + :param impact_type: The type of impact. + :type impact_type: str, optional + + :param modified: Timestamp when the impact was last modified. + :type modified: datetime, optional + + :param start_at: Timestamp representing when the impact started. + :type start_at: datetime + """ + if created is not unset: + kwargs["created"] = created + if end_at is not unset: + kwargs["end_at"] = end_at + if fields is not unset: + kwargs["fields"] = fields + if impact_type is not unset: + kwargs["impact_type"] = impact_type + if modified is not unset: + kwargs["modified"] = modified + super().__init__(kwargs) + + self_.description = description + self_.start_at = start_at diff --git a/src/datadog_api_client/v2/model/incident_impact_create_attributes.py b/src/datadog_api_client/v2/model/incident_impact_create_attributes.py new file mode 100644 index 0000000000..624a173124 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_create_attributes.py @@ -0,0 +1,71 @@ +# 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, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_impact_fields_object import IncidentImpactFieldsObject + + +class IncidentImpactCreateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_impact_fields_object import IncidentImpactFieldsObject + + return { + "description": (str,), + "end_at": (datetime, none_type), + "fields": (IncidentImpactFieldsObject,), + "start_at": (datetime,), + } + + attribute_map = { + "description": "description", + "end_at": "end_at", + "fields": "fields", + "start_at": "start_at", + } + + def __init__( + self_, + description: str, + start_at: datetime, + end_at: Union[datetime, none_type, UnsetType] = unset, + fields: Union[IncidentImpactFieldsObject, none_type, UnsetType] = unset, + **kwargs, + ): + """ + The incident impact's attributes for a create request. + + :param description: Description of the impact. + :type description: str + + :param end_at: Timestamp when the impact ended. + :type end_at: datetime, none_type, optional + + :param fields: An object mapping impact field names to field values. + :type fields: IncidentImpactFieldsObject, none_type, optional + + :param start_at: Timestamp when the impact started. + :type start_at: datetime + """ + if end_at is not unset: + kwargs["end_at"] = end_at + if fields is not unset: + kwargs["fields"] = fields + super().__init__(kwargs) + + self_.description = description + self_.start_at = start_at diff --git a/src/datadog_api_client/v2/model/incident_impact_create_data.py b/src/datadog_api_client/v2/model/incident_impact_create_data.py new file mode 100644 index 0000000000..362006005b --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_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_impact_create_attributes import IncidentImpactCreateAttributes + from datadog_api_client.v2.model.incident_impact_type import IncidentImpactType + + +class IncidentImpactCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_impact_create_attributes import IncidentImpactCreateAttributes + from datadog_api_client.v2.model.incident_impact_type import IncidentImpactType + + return { + "attributes": (IncidentImpactCreateAttributes,), + "type": (IncidentImpactType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: IncidentImpactCreateAttributes, type: IncidentImpactType, **kwargs): + """ + Incident impact data for a create request. + + :param attributes: The incident impact's attributes for a create request. + :type attributes: IncidentImpactCreateAttributes + + :param type: Incident impact resource type. + :type type: IncidentImpactType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_impact_create_request.py b/src/datadog_api_client/v2/model/incident_impact_create_request.py new file mode 100644 index 0000000000..2f868847f2 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_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_impact_create_data import IncidentImpactCreateData + + +class IncidentImpactCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_impact_create_data import IncidentImpactCreateData + + return { + "data": (IncidentImpactCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: IncidentImpactCreateData, **kwargs): + """ + Create request for an incident impact. + + :param data: Incident impact data for a create request. + :type data: IncidentImpactCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/incident_impact_fields_object.py b/src/datadog_api_client/v2/model/incident_impact_fields_object.py new file mode 100644 index 0000000000..4e9a773a82 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_fields_object.py @@ -0,0 +1,19 @@ +# 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, +) + + +class IncidentImpactFieldsObject(ModelNormal): + _nullable = True + + def __init__(self_, **kwargs): + """ + An object mapping impact field names to field values. + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_impact_related_object.py b/src/datadog_api_client/v2/model/incident_impact_related_object.py new file mode 100644 index 0000000000..4185e41017 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_related_object.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 IncidentImpactRelatedObject(ModelSimple): + """ + A reference to a resource related to an incident impact. + + :param value: Must be one of ["incident", "created_by_user", "last_modified_by_user"]. + :type value: str + """ + + allowed_values = { + "incident", + "created_by_user", + "last_modified_by_user", + } + INCIDENT: ClassVar["IncidentImpactRelatedObject"] + CREATED_BY_USER: ClassVar["IncidentImpactRelatedObject"] + LAST_MODIFIED_BY_USER: ClassVar["IncidentImpactRelatedObject"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +IncidentImpactRelatedObject.INCIDENT = IncidentImpactRelatedObject("incident") +IncidentImpactRelatedObject.CREATED_BY_USER = IncidentImpactRelatedObject("created_by_user") +IncidentImpactRelatedObject.LAST_MODIFIED_BY_USER = IncidentImpactRelatedObject("last_modified_by_user") diff --git a/src/datadog_api_client/v2/model/incident_impact_relationships.py b/src/datadog_api_client/v2/model/incident_impact_relationships.py new file mode 100644 index 0000000000..6346d25142 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_relationships.py @@ -0,0 +1,64 @@ +# 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.relationship_to_user import RelationshipToUser + from datadog_api_client.v2.model.relationship_to_incident import RelationshipToIncident + + +class IncidentImpactRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.relationship_to_user import RelationshipToUser + from datadog_api_client.v2.model.relationship_to_incident import RelationshipToIncident + + return { + "created_by_user": (RelationshipToUser,), + "incident": (RelationshipToIncident,), + "last_modified_by_user": (RelationshipToUser,), + } + + attribute_map = { + "created_by_user": "created_by_user", + "incident": "incident", + "last_modified_by_user": "last_modified_by_user", + } + + def __init__( + self_, + created_by_user: Union[RelationshipToUser, UnsetType] = unset, + incident: Union[RelationshipToIncident, UnsetType] = unset, + last_modified_by_user: Union[RelationshipToUser, UnsetType] = unset, + **kwargs, + ): + """ + The incident impact's resource relationships. + + :param created_by_user: Relationship to user. + :type created_by_user: RelationshipToUser, optional + + :param incident: Relationship to incident. + :type incident: RelationshipToIncident, optional + + :param last_modified_by_user: Relationship to user. + :type last_modified_by_user: RelationshipToUser, optional + """ + if created_by_user is not unset: + kwargs["created_by_user"] = created_by_user + 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 + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_impact_response.py b/src/datadog_api_client/v2/model/incident_impact_response.py new file mode 100644 index 0000000000..66fbd3e6ab --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_response.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 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_impact_response_data import IncidentImpactResponseData + from datadog_api_client.v2.model.incident_user_data import IncidentUserData + + +class IncidentImpactResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_impact_response_data import IncidentImpactResponseData + from datadog_api_client.v2.model.incident_user_data import IncidentUserData + + return { + "data": (IncidentImpactResponseData,), + "included": ([IncidentUserData],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + read_only_vars = { + "included", + } + + def __init__( + self_, data: IncidentImpactResponseData, included: Union[List[IncidentUserData], UnsetType] = unset, **kwargs + ): + """ + Response with an incident impact. + + :param data: Incident impact data from a response. + :type data: IncidentImpactResponseData + + :param included: Included related resources that the user requested. + :type included: [IncidentUserData], 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_impact_response_data.py b/src/datadog_api_client/v2/model/incident_impact_response_data.py new file mode 100644 index 0000000000..4f7af730ad --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_response_data.py @@ -0,0 +1,73 @@ +# 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.incident_impact_attributes import IncidentImpactAttributes + from datadog_api_client.v2.model.incident_impact_relationships import IncidentImpactRelationships + from datadog_api_client.v2.model.incident_impact_type import IncidentImpactType + + +class IncidentImpactResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_impact_attributes import IncidentImpactAttributes + from datadog_api_client.v2.model.incident_impact_relationships import IncidentImpactRelationships + from datadog_api_client.v2.model.incident_impact_type import IncidentImpactType + + return { + "attributes": (IncidentImpactAttributes,), + "id": (str,), + "relationships": (IncidentImpactRelationships,), + "type": (IncidentImpactType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + id: str, + type: IncidentImpactType, + attributes: Union[IncidentImpactAttributes, UnsetType] = unset, + relationships: Union[IncidentImpactRelationships, UnsetType] = unset, + **kwargs, + ): + """ + Incident impact data from a response. + + :param attributes: The incident impact's attributes. + :type attributes: IncidentImpactAttributes, optional + + :param id: The incident impact's ID. + :type id: str + + :param relationships: The incident impact's resource relationships. + :type relationships: IncidentImpactRelationships, optional + + :param type: Incident impact resource type. + :type type: IncidentImpactType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if relationships is not unset: + kwargs["relationships"] = relationships + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_impact_type.py b/src/datadog_api_client/v2/model/incident_impact_type.py new file mode 100644 index 0000000000..ccbc62928f --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impact_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 IncidentImpactType(ModelSimple): + """ + Incident impact resource type. + + :param value: If omitted defaults to "incident_impacts". Must be one of ["incident_impacts"]. + :type value: str + """ + + allowed_values = { + "incident_impacts", + } + INCIDENT_IMPACTS: ClassVar["IncidentImpactType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +IncidentImpactType.INCIDENT_IMPACTS = IncidentImpactType("incident_impacts") diff --git a/src/datadog_api_client/v2/model/incident_impacts_response.py b/src/datadog_api_client/v2/model/incident_impacts_response.py new file mode 100644 index 0000000000..68e3d5e110 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_impacts_response.py @@ -0,0 +1,59 @@ +# 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_impact_response_data import IncidentImpactResponseData + from datadog_api_client.v2.model.incident_user_data import IncidentUserData + + +class IncidentImpactsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_impact_response_data import IncidentImpactResponseData + from datadog_api_client.v2.model.incident_user_data import IncidentUserData + + return { + "data": ([IncidentImpactResponseData],), + "included": ([IncidentUserData],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + read_only_vars = { + "included", + } + + def __init__( + self_, + data: List[IncidentImpactResponseData], + included: Union[List[IncidentUserData], UnsetType] = unset, + **kwargs, + ): + """ + Response with a list of incident impacts. + + :param data: An array of incident impacts. + :type data: [IncidentImpactResponseData] + + :param included: Included related resources that the user requested. + :type included: [IncidentUserData], 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_response_attributes.py b/src/datadog_api_client/v2/model/incident_response_attributes.py index 6104b3170e..8e8bc7a884 100644 --- a/src/datadog_api_client/v2/model/incident_response_attributes.py +++ b/src/datadog_api_client/v2/model/incident_response_attributes.py @@ -16,8 +16,8 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.incident_field_attributes import IncidentFieldAttributes from datadog_api_client.v2.model.incident_non_datadog_creator import IncidentNonDatadogCreator + from datadog_api_client.v2.model.incident_field_attributes import IncidentFieldAttributes from datadog_api_client.v2.model.incident_notification_handle import IncidentNotificationHandle from datadog_api_client.v2.model.incident_severity import IncidentSeverity from datadog_api_client.v2.model.incident_field_attributes_single_value import IncidentFieldAttributesSingleValue @@ -29,8 +29,8 @@ class IncidentResponseAttributes(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.incident_field_attributes import IncidentFieldAttributes from datadog_api_client.v2.model.incident_non_datadog_creator import IncidentNonDatadogCreator + from datadog_api_client.v2.model.incident_field_attributes import IncidentFieldAttributes from datadog_api_client.v2.model.incident_notification_handle import IncidentNotificationHandle from datadog_api_client.v2.model.incident_severity import IncidentSeverity @@ -43,6 +43,9 @@ def openapi_types(_): "customer_impact_scope": (str, none_type), "customer_impact_start": (datetime, none_type), "customer_impacted": (bool,), + "declared": (datetime,), + "declared_by": (IncidentNonDatadogCreator,), + "declared_by_uuid": (str, none_type), "detected": (datetime, none_type), "fields": ({str: (IncidentFieldAttributes,)},), "incident_type_uuid": (str,), @@ -71,6 +74,9 @@ def openapi_types(_): "customer_impact_scope": "customer_impact_scope", "customer_impact_start": "customer_impact_start", "customer_impacted": "customer_impacted", + "declared": "declared", + "declared_by": "declared_by", + "declared_by_uuid": "declared_by_uuid", "detected": "detected", "fields": "fields", "incident_type_uuid": "incident_type_uuid", @@ -93,6 +99,7 @@ def openapi_types(_): "archived", "created", "customer_impact_duration", + "declared", "modified", "time_to_detect", "time_to_internal_response", @@ -111,6 +118,9 @@ def __init__( customer_impact_scope: Union[str, none_type, UnsetType] = unset, customer_impact_start: Union[datetime, none_type, UnsetType] = unset, customer_impacted: Union[bool, UnsetType] = unset, + declared: Union[datetime, UnsetType] = unset, + declared_by: Union[IncidentNonDatadogCreator, none_type, UnsetType] = unset, + declared_by_uuid: Union[str, none_type, UnsetType] = unset, detected: Union[datetime, none_type, UnsetType] = unset, fields: Union[ Dict[ @@ -165,6 +175,15 @@ def __init__( :param customer_impacted: A flag indicating whether the incident caused customer impact. :type customer_impacted: bool, optional + :param declared: Timestamp when the incident was declared. + :type declared: datetime, optional + + :param declared_by: Incident's non Datadog creator. + :type declared_by: IncidentNonDatadogCreator, none_type, optional + + :param declared_by_uuid: UUID of the user who declared the incident. + :type declared_by_uuid: str, none_type, optional + :param detected: Timestamp when the incident was detected. :type detected: datetime, none_type, optional @@ -233,6 +252,12 @@ def __init__( kwargs["customer_impact_start"] = customer_impact_start if customer_impacted is not unset: kwargs["customer_impacted"] = customer_impacted + if declared is not unset: + kwargs["declared"] = declared + if declared_by is not unset: + kwargs["declared_by"] = declared_by + if declared_by_uuid is not unset: + kwargs["declared_by_uuid"] = declared_by_uuid if detected is not unset: kwargs["detected"] = detected if fields is not unset: diff --git a/src/datadog_api_client/v2/model/incident_response_relationships.py b/src/datadog_api_client/v2/model/incident_response_relationships.py index c5c4a55feb..2769e1bc83 100644 --- a/src/datadog_api_client/v2/model/incident_response_relationships.py +++ b/src/datadog_api_client/v2/model/incident_response_relationships.py @@ -47,6 +47,7 @@ def openapi_types(_): "attachments": (RelationshipToIncidentAttachment,), "commander_user": (NullableRelationshipToUser,), "created_by_user": (RelationshipToUser,), + "declared_by_user": (RelationshipToUser,), "impacts": (RelationshipToIncidentImpacts,), "integrations": (RelationshipToIncidentIntegrationMetadatas,), "last_modified_by_user": (RelationshipToUser,), @@ -58,6 +59,7 @@ def openapi_types(_): "attachments": "attachments", "commander_user": "commander_user", "created_by_user": "created_by_user", + "declared_by_user": "declared_by_user", "impacts": "impacts", "integrations": "integrations", "last_modified_by_user": "last_modified_by_user", @@ -70,6 +72,7 @@ def __init__( attachments: Union[RelationshipToIncidentAttachment, UnsetType] = unset, commander_user: Union[NullableRelationshipToUser, none_type, UnsetType] = unset, created_by_user: Union[RelationshipToUser, UnsetType] = unset, + declared_by_user: Union[RelationshipToUser, UnsetType] = unset, impacts: Union[RelationshipToIncidentImpacts, UnsetType] = unset, integrations: Union[RelationshipToIncidentIntegrationMetadatas, UnsetType] = unset, last_modified_by_user: Union[RelationshipToUser, UnsetType] = unset, @@ -89,6 +92,9 @@ def __init__( :param created_by_user: Relationship to user. :type created_by_user: RelationshipToUser, optional + :param declared_by_user: Relationship to user. + :type declared_by_user: RelationshipToUser, optional + :param impacts: Relationship to impacts. :type impacts: RelationshipToIncidentImpacts, optional @@ -110,6 +116,8 @@ def __init__( kwargs["commander_user"] = commander_user if created_by_user is not unset: kwargs["created_by_user"] = created_by_user + if declared_by_user is not unset: + kwargs["declared_by_user"] = declared_by_user if impacts is not unset: kwargs["impacts"] = impacts if integrations is not unset: diff --git a/src/datadog_api_client/v2/model/relationship_to_incident.py b/src/datadog_api_client/v2/model/relationship_to_incident.py new file mode 100644 index 0000000000..65f00c3918 --- /dev/null +++ b/src/datadog_api_client/v2/model/relationship_to_incident.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.relationship_to_incident_data import RelationshipToIncidentData + + +class RelationshipToIncident(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.relationship_to_incident_data import RelationshipToIncidentData + + return { + "data": (RelationshipToIncidentData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: RelationshipToIncidentData, **kwargs): + """ + Relationship to incident. + + :param data: Relationship to incident object. + :type data: RelationshipToIncidentData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/relationship_to_incident_data.py b/src/datadog_api_client/v2/model/relationship_to_incident_data.py new file mode 100644 index 0000000000..a0a1891855 --- /dev/null +++ b/src/datadog_api_client/v2/model/relationship_to_incident_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_type import IncidentType + + +class RelationshipToIncidentData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_type import IncidentType + + return { + "id": (str,), + "type": (IncidentType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: str, type: IncidentType, **kwargs): + """ + Relationship to incident object. + + :param id: A unique identifier that represents the incident. + :type id: str + + :param type: Incident resource type. + :type type: IncidentType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 2804329b11..0e5bafd40a 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1585,6 +1585,17 @@ IncidentFieldAttributesSingleValueType, ) from datadog_api_client.v2.model.incident_field_attributes_value_type import IncidentFieldAttributesValueType +from datadog_api_client.v2.model.incident_impact_attributes import IncidentImpactAttributes +from datadog_api_client.v2.model.incident_impact_create_attributes import IncidentImpactCreateAttributes +from datadog_api_client.v2.model.incident_impact_create_data import IncidentImpactCreateData +from datadog_api_client.v2.model.incident_impact_create_request import IncidentImpactCreateRequest +from datadog_api_client.v2.model.incident_impact_fields_object import IncidentImpactFieldsObject +from datadog_api_client.v2.model.incident_impact_related_object import IncidentImpactRelatedObject +from datadog_api_client.v2.model.incident_impact_relationships import IncidentImpactRelationships +from datadog_api_client.v2.model.incident_impact_response import IncidentImpactResponse +from datadog_api_client.v2.model.incident_impact_response_data import IncidentImpactResponseData +from datadog_api_client.v2.model.incident_impact_type import IncidentImpactType +from datadog_api_client.v2.model.incident_impacts_response import IncidentImpactsResponse from datadog_api_client.v2.model.incident_impacts_type import IncidentImpactsType from datadog_api_client.v2.model.incident_integration_metadata_attributes import IncidentIntegrationMetadataAttributes from datadog_api_client.v2.model.incident_integration_metadata_create_data import IncidentIntegrationMetadataCreateData @@ -3107,8 +3118,10 @@ from datadog_api_client.v2.model.relation_to_entity import RelationToEntity from datadog_api_client.v2.model.relation_type import RelationType from datadog_api_client.v2.model.relationship_item import RelationshipItem +from datadog_api_client.v2.model.relationship_to_incident import RelationshipToIncident from datadog_api_client.v2.model.relationship_to_incident_attachment import RelationshipToIncidentAttachment from datadog_api_client.v2.model.relationship_to_incident_attachment_data import RelationshipToIncidentAttachmentData +from datadog_api_client.v2.model.relationship_to_incident_data import RelationshipToIncidentData from datadog_api_client.v2.model.relationship_to_incident_impact_data import RelationshipToIncidentImpactData from datadog_api_client.v2.model.relationship_to_incident_impacts import RelationshipToIncidentImpacts from datadog_api_client.v2.model.relationship_to_incident_integration_metadata_data import ( @@ -5415,6 +5428,17 @@ "IncidentFieldAttributesSingleValue", "IncidentFieldAttributesSingleValueType", "IncidentFieldAttributesValueType", + "IncidentImpactAttributes", + "IncidentImpactCreateAttributes", + "IncidentImpactCreateData", + "IncidentImpactCreateRequest", + "IncidentImpactFieldsObject", + "IncidentImpactRelatedObject", + "IncidentImpactRelationships", + "IncidentImpactResponse", + "IncidentImpactResponseData", + "IncidentImpactType", + "IncidentImpactsResponse", "IncidentImpactsType", "IncidentIntegrationMetadataAttributes", "IncidentIntegrationMetadataCreateData", @@ -6425,8 +6449,10 @@ "RelationToEntity", "RelationType", "RelationshipItem", + "RelationshipToIncident", "RelationshipToIncidentAttachment", "RelationshipToIncidentAttachmentData", + "RelationshipToIncidentData", "RelationshipToIncidentImpactData", "RelationshipToIncidentImpacts", "RelationshipToIncidentIntegrationMetadataData", diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_bad_request_response.frozen new file mode 100644 index 0000000000..0016a9985b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-09-16T19:46:43.553Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_bad_request_response.yaml new file mode 100644 index 0000000000..475973dad3 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_bad_request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '{"data":{"attributes":{"description":"Service was unavailable for external + users","end_at":"2025-08-29T13:17:00Z","fields":{"customers_impacted":"all","products_impacted":["shopping","marketing"]},"start_at":"2025-08-28T13:17:00Z"},"type":"incident_impacts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000000/impacts + response: + body: + string: '{"errors":[{"title":"Bad Request","detail":"invalid impact data: incident + id is required: invalid impact"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_created_response.frozen new file mode 100644 index 0000000000..aa2f3172f8 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_created_response.frozen @@ -0,0 +1 @@ +2025-09-16T19:46:53.892Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_created_response.yaml new file mode 100644 index 0000000000..94d5e57769 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_created_response.yaml @@ -0,0 +1,71 @@ +interactions: +- request: + body: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Create_an_incident_impact_returns_CREATED_response-1758052013"},"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":"5826fc99-ad8c-54cb-8c18-cd270bfe42fb","attributes":{"public_id":309851,"incident_type_uuid":"41d2e10b-4108-4736-92d7-791d00ea0702","title":"Test-Create_an_incident_impact_returns_CREATED_response-1758052013","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":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":"frog","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2025-09-16T19:46:54.038695+00:00","modified":"2025-09-16T19:46:54.038695+00:00","commander":null,"detected":"2025-09-16T19:46:54.027387+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":"frog","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?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,"archived":null,"is_test":false,"declared":"2025-09-16T19:46:54.038695+00:00","declared_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":"frog","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"declared_by_uuid":null,"fields":{"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},"teams":{"type":"autocomplete","value":null}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"commander_user":{"data":null},"declared_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"user_defined_fields":{"data":[{"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":"3cbe9e60-d794-532c-acc0-73641f782813"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"description":"Outage in the us-east-1 region","end_at":"2025-09-12T14:50:00.000Z","start_at":"2025-09-12T13:50:00.000Z"},"type":"incident_impacts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/5826fc99-ad8c-54cb-8c18-cd270bfe42fb/impacts + response: + body: + string: '{"data":{"id":"7d4f5663-7c01-4727-b90b-323953603092","type":"incident_impacts","attributes":{"created":"2025-09-16T19:46:54.291754Z","description":"Outage + in the us-east-1 region","end_at":"2025-09-12T14:50:00Z","fields":null,"impact_type":"customer","modified":"2025-09-16T19:46:54.291754Z","start_at":"2025-09-12T13:50:00Z"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident":{"data":{"id":"5826fc99-ad8c-54cb-8c18-cd270bfe42fb","type":"incidents"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + 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/5826fc99-ad8c-54cb-8c18-cd270bfe42fb/impacts/7d4f5663-7c01-4727-b90b-323953603092 + 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/5826fc99-ad8c-54cb-8c18-cd270bfe42fb + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_not_found_response.frozen new file mode 100644 index 0000000000..112e404d11 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_not_found_response.frozen @@ -0,0 +1 @@ +2025-09-16T19:47:06.306Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_not_found_response.yaml new file mode 100644 index 0000000000..452bb42834 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_an_incident_impact_returns_not_found_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '{"data":{"attributes":{"description":"Service was unavailable for external + users","end_at":"2025-08-29T13:17:00Z","fields":{"customers_impacted":"all","products_impacted":["shopping","marketing"]},"start_at":"2025-08-28T13:17:00Z"},"type":"incident_impacts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000001/impacts + response: + body: + string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = NotFound + desc = incident not found: failed to get incident: incident not found"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_no_content_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_no_content_response.frozen new file mode 100644 index 0000000000..69564fd4b0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_no_content_response.frozen @@ -0,0 +1 @@ +2025-09-16T19:47:17.707Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_no_content_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_no_content_response.yaml new file mode 100644 index 0000000000..22f2551ede --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_no_content_response.yaml @@ -0,0 +1,88 @@ +interactions: +- request: + body: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Delete_an_incident_impact_returns_No_Content_response-1758052037"},"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":"1a838ffb-9c95-5df6-978c-4cf21f854fd1","attributes":{"public_id":309852,"incident_type_uuid":"41d2e10b-4108-4736-92d7-791d00ea0702","title":"Test-Delete_an_incident_impact_returns_No_Content_response-1758052037","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":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":"frog","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2025-09-16T19:47:17.862681+00:00","modified":"2025-09-16T19:47:17.862681+00:00","commander":null,"detected":"2025-09-16T19:47:17.850799+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":"frog","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?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,"archived":null,"is_test":false,"declared":"2025-09-16T19:47:17.862681+00:00","declared_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":"frog","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"declared_by_uuid":null,"fields":{"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},"teams":{"type":"autocomplete","value":null}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"commander_user":{"data":null},"declared_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"user_defined_fields":{"data":[{"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":"3cbe9e60-d794-532c-acc0-73641f782813"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"data":{"attributes":{"description":"Outage in the us-east-1 region","end_at":"2025-09-12T14:50:00.000Z","start_at":"2025-09-12T13:50:00.000Z"},"type":"incident_impacts"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/1a838ffb-9c95-5df6-978c-4cf21f854fd1/impacts + response: + body: + string: '{"data":{"id":"db11b25d-0383-4f98-bde7-bfc4a10d16eb","type":"incident_impacts","attributes":{"created":"2025-09-16T19:47:18.208811Z","description":"Outage + in the us-east-1 region","end_at":"2025-09-12T14:50:00Z","fields":null,"impact_type":"customer","modified":"2025-09-16T19:47:18.208811Z","start_at":"2025-09-12T13:50:00Z"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident":{"data":{"id":"1a838ffb-9c95-5df6-978c-4cf21f854fd1","type":"incidents"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + 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/1a838ffb-9c95-5df6-978c-4cf21f854fd1/impacts/db11b25d-0383-4f98-bde7-bfc4a10d16eb + 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/1a838ffb-9c95-5df6-978c-4cf21f854fd1/impacts/db11b25d-0383-4f98-bde7-bfc4a10d16eb + response: + body: + string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = NotFound + desc = impact not found: impact 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/1a838ffb-9c95-5df6-978c-4cf21f854fd1 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response.frozen new file mode 100644 index 0000000000..8494194471 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response.frozen @@ -0,0 +1 @@ +2025-09-16T19:47:29.411Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response.yaml new file mode 100644 index 0000000000..f0a5edd427 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000001/impacts/00000000-0000-0000-0000-000000000001 + response: + body: + string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = NotFound + desc = impact not found: impact not found"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_different_invalid_ids_.frozen b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_different_invalid_ids_.frozen new file mode 100644 index 0000000000..81d2f935c8 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_different_invalid_ids_.frozen @@ -0,0 +1 @@ +2025-09-16T14:11:22.028Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_different_invalid_ids_.yaml b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_different_invalid_ids_.yaml new file mode 100644 index 0000000000..8c9f97f04d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_different_invalid_ids_.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000002/impacts/00000000-0000-0000-0000-000000000002 + response: + body: + string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = NotFound + desc = impact not found: impact not found"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_invalid_incident_and_impact_.frozen b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_invalid_incident_and_impact_.frozen new file mode 100644 index 0000000000..17375a815d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_invalid_incident_and_impact_.frozen @@ -0,0 +1 @@ +2025-09-16T14:11:00.035Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_invalid_incident_and_impact_.yaml b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_invalid_incident_and_impact_.yaml new file mode 100644 index 0000000000..bce70d5711 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_an_incident_impact_returns_not_found_response_invalid_incident_and_impact_.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000000/impacts/00000000-0000-0000-0000-000000000000 + response: + body: + string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = NotFound + desc = impact not found: impact not found"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_an_incidents_impacts_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_an_incidents_impacts_returns_ok_response.frozen new file mode 100644 index 0000000000..55431a90fb --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_an_incidents_impacts_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-09-16T19:47:40.461Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_an_incidents_impacts_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_an_incidents_impacts_returns_ok_response.yaml new file mode 100644 index 0000000000..31e653241a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_an_incidents_impacts_returns_ok_response.yaml @@ -0,0 +1,54 @@ +interactions: +- request: + body: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-List_an_incident_s_impacts_returns_OK_response-1758052060"},"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":"81b6cd9f-526a-5a08-a204-ac402f36ea5f","attributes":{"public_id":309853,"incident_type_uuid":"41d2e10b-4108-4736-92d7-791d00ea0702","title":"Test-List_an_incident_s_impacts_returns_OK_response-1758052060","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":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":"frog","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2025-09-16T19:47:40.679710+00:00","modified":"2025-09-16T19:47:40.679710+00:00","commander":null,"detected":"2025-09-16T19:47:40.668385+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":"frog","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?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,"archived":null,"is_test":false,"declared":"2025-09-16T19:47:40.679710+00:00","declared_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":"frog","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"declared_by_uuid":null,"fields":{"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},"teams":{"type":"autocomplete","value":null}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"commander_user":{"data":null},"declared_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"user_defined_fields":{"data":[{"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":"3cbe9e60-d794-532c-acc0-73641f782813"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/incidents/81b6cd9f-526a-5a08-a204-ac402f36ea5f/impacts + response: + body: + string: '{"data":[]}' + 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/81b6cd9f-526a-5a08-a204-ac402f36ea5f + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index a4872ca4d5..06f7f855c1 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -329,6 +329,22 @@ "tag": "Incidents", "operationId": "UpdateIncidentAttachments" }, + { + "operationId": "CreateIncidentImpact", + "parameters": [ + { + "name": "incident_id", + "source": "incident.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"incident_impacts\",\n \"attributes\": {\n \"start_at\": \"2025-09-12T13:50:00.000Z\",\n \"end_at\": \"2025-09-12T14:50:00.000Z\",\n \"description\": \"Outage in the us-east-1 region\"\n }\n }\n}" + } + ], + "step": "the \"incident\" has an \"incident_impact\"", + "key": "incident_impact", + "tag": "Incidents" + }, { "parameters": [ { diff --git a/tests/v2/features/incidents.feature b/tests/v2/features/incidents.feature index 4f278f2816..74ae965968 100644 --- a/tests/v2/features/incidents.feature +++ b/tests/v2/features/incidents.feature @@ -35,6 +35,36 @@ Feature: Incidents And the response "data[0].attributes.attachment_type" is equal to "link" And the response "data[0].attributes.attachment.documentUrl" is equal to "https://www.example.com/doc" + @skip @team:DataDog/incident-app + Scenario: Create an incident impact returns "Bad Request" response + Given operation "CreateIncidentImpact" enabled + And new "CreateIncidentImpact" request + And request contains "incident_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/incident-app + Scenario: Create an incident impact returns "CREATED" response + Given there is a valid "incident" in the system + And operation "CreateIncidentImpact" enabled + And new "CreateIncidentImpact" request + And request contains "incident_id" parameter from "incident.data.id" + And body with value {"data": {"type": "incident_impacts", "attributes": {"start_at": "2025-09-12T13:50:00.000Z", "end_at": "2025-09-12T14:50:00.000Z", "description": "Outage in the us-east-1 region"}}} + When the request is sent + Then the response status is 201 CREATED + And the response "data.type" is equal to "incident_impacts" + And the response "data.relationships.incident.data.id" has the same value as "incident.data.id" + + @skip @team:DataDog/incident-app + Scenario: Create an incident impact returns "Not Found" response + Given operation "CreateIncidentImpact" enabled + And new "CreateIncidentImpact" request + And request contains "incident_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Create an incident integration metadata returns "Bad Request" response Given operation "CreateIncidentIntegration" enabled @@ -295,6 +325,26 @@ Feature: Incidents When the request is sent Then the response status is 204 OK + @skip @team:DataDog/incident-app + Scenario: Delete an incident impact returns "No Content" response + Given there is a valid "incident" in the system + And the "incident" has an "incident_impact" + And operation "DeleteIncidentImpact" enabled + And new "DeleteIncidentImpact" request + And request contains "incident_id" parameter from "incident_impact.data.relationships.incident.data.id" + And request contains "impact_id" parameter from "incident_impact.data.id" + When the request is sent + Then the response status is 204 No Content + + @skip @team:DataDog/incident-app + Scenario: Delete an incident impact returns "Not Found" response + Given operation "DeleteIncidentImpact" enabled + And new "DeleteIncidentImpact" request + And request contains "incident_id" parameter with value "00000000-0000-0000-0000-000000000001" + And request contains "impact_id" parameter with value "00000000-0000-0000-0000-000000000001" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Delete an incident integration metadata returns "Bad Request" response Given operation "DeleteIncidentIntegration" enabled @@ -754,6 +804,31 @@ Feature: Incidents Then the response status is 200 OK And the response "data.attributes.title" has the same value as "incident.data.attributes.title" + @generated @skip @team:DataDog/incident-app + Scenario: List an incident's impacts returns "Bad Request" response + Given operation "ListIncidentImpacts" enabled + And new "ListIncidentImpacts" 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: List an incident's impacts returns "Not Found" response + Given operation "ListIncidentImpacts" enabled + And new "ListIncidentImpacts" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/incident-app + Scenario: List an incident's impacts returns "OK" response + Given there is a valid "incident" in the system + And operation "ListIncidentImpacts" enabled + And new "ListIncidentImpacts" request + And request contains "incident_id" parameter from "incident.data.id" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:Datadog/incident-app Scenario: List incident notification rules returns "Bad Request" response Given operation "ListIncidentNotificationRules" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 9aa936bc99..b2fe236d00 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1297,6 +1297,35 @@ "type": "idempotent" } }, + "ListIncidentImpacts": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentImpact": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentImpact", + "parameters": [ + { + "name": "incident_id", + "source": "data.relationships.incident.data.id" + }, + { + "name": "impact_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentImpact": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ListIncidentIntegrations": { "tag": "Incidents", "undo": {