diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 50b7ccf9b2..67003f11ba 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -46414,6 +46414,9 @@ components: IncidentTypeAttributes: description: Incident type's attributes. properties: + configuration: + $ref: "#/components/schemas/IncidentTypeConfiguration" + readOnly: true createdAt: description: Timestamp when the incident type was created. format: date-time @@ -46455,6 +46458,53 @@ components: required: - name type: object + IncidentTypeConfiguration: + description: >- + The incident-type-scoped behavior settings. All fields are optional on update. Any field omitted from a PATCH request keeps its current value. This object is read-only on the incident type resource itself and is only mutated through the update (PATCH) endpoint. + properties: + allow_incident_deletion: + default: false + description: Whether incidents of this type can be deleted. + example: false + type: boolean + allow_workflows: + default: true + description: Whether automation workflows can be triggered for incidents of this type. + example: true + type: boolean + create_message: + description: An optional message shown to users when they declare an incident of this type. + example: "Create an incident here" + type: string + disable_out_of_the_box_postmortem_template: + default: false + description: Whether the out-of-the-box postmortem template is disabled for incidents of this type. + example: false + type: boolean + editable_timestamps: + default: false + description: Whether responders can edit incident timestamps for incidents of this type. + example: false + type: boolean + private_incidents: + default: false + description: >- + Whether responders can create private incidents of this type. This is an opt-in setting, distinct from `private_incidents_by_default`, which controls whether incidents are created private automatically. + example: false + type: boolean + private_incidents_by_default: + default: false + description: Whether incidents of this type are created as private by default. + example: false + type: boolean + slug_source: + $ref: "#/components/schemas/IncidentTypeSlugSource" + test_incidents: + default: true + description: Whether incidents of this type are treated as test incidents. + example: true + type: boolean + type: object IncidentTypeCreateData: description: Incident type data for a create request. properties: @@ -46549,6 +46599,18 @@ components: required: - data type: object + IncidentTypeSlugSource: + default: default + description: >- + When set to `servicenow`, incidents will display the ServiceNow record ID instead of the public ID. If no ServiceNow integration exists, the public ID will be displayed. + enum: + - default + - servicenow + example: default + type: string + x-enum-varnames: + - DEFAULT + - SERVICENOW IncidentTypeType: default: incident_types description: Incident type resource type. @@ -46561,6 +46623,8 @@ components: IncidentTypeUpdateAttributes: description: Incident type's attributes for updates. properties: + configuration: + $ref: "#/components/schemas/IncidentTypeConfiguration" createdAt: description: Timestamp when the incident type was created. format: date-time diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index caa0ea4800..2a9b95be14 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -18806,6 +18806,13 @@ datadog\_api\_client.v2.model.incident\_type\_attributes module :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_type\_configuration module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_type_configuration + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incident\_type\_create\_data module ----------------------------------------------------------------- @@ -18862,6 +18869,13 @@ datadog\_api\_client.v2.model.incident\_type\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_type\_slug\_source module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_type_slug_source + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incident\_type\_type module --------------------------------------------------------- diff --git a/src/datadog_api_client/v2/model/incident_type_attributes.py b/src/datadog_api_client/v2/model/incident_type_attributes.py index 894a3c7abf..094f09d58e 100644 --- a/src/datadog_api_client/v2/model/incident_type_attributes.py +++ b/src/datadog_api_client/v2/model/incident_type_attributes.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -14,10 +14,17 @@ ) +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_type_configuration import IncidentTypeConfiguration + + class IncidentTypeAttributes(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.incident_type_configuration import IncidentTypeConfiguration + return { + "configuration": (IncidentTypeConfiguration,), "created_at": (datetime,), "created_by": (str,), "description": (str,), @@ -29,6 +36,7 @@ def openapi_types(_): } attribute_map = { + "configuration": "configuration", "created_at": "createdAt", "created_by": "createdBy", "description": "description", @@ -49,6 +57,7 @@ def openapi_types(_): def __init__( self_, name: str, + configuration: Union[IncidentTypeConfiguration, UnsetType] = unset, created_at: Union[datetime, UnsetType] = unset, created_by: Union[str, UnsetType] = unset, description: Union[str, UnsetType] = unset, @@ -61,6 +70,9 @@ def __init__( """ Incident type's attributes. + :param configuration: The incident-type-scoped behavior settings. All fields are optional on update. Any field omitted from a PATCH request keeps its current value. This object is read-only on the incident type resource itself and is only mutated through the update (PATCH) endpoint. + :type configuration: IncidentTypeConfiguration, optional + :param created_at: Timestamp when the incident type was created. :type created_at: datetime, optional @@ -85,6 +97,8 @@ def __init__( :param prefix: The string that will be prepended to the incident title across the Datadog app. :type prefix: str, optional """ + if configuration is not unset: + kwargs["configuration"] = configuration if created_at is not unset: kwargs["created_at"] = created_at if created_by is not unset: diff --git a/src/datadog_api_client/v2/model/incident_type_configuration.py b/src/datadog_api_client/v2/model/incident_type_configuration.py new file mode 100644 index 0000000000..3f9e73b98b --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_type_configuration.py @@ -0,0 +1,110 @@ +# 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_type_slug_source import IncidentTypeSlugSource + + +class IncidentTypeConfiguration(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_type_slug_source import IncidentTypeSlugSource + + return { + "allow_incident_deletion": (bool,), + "allow_workflows": (bool,), + "create_message": (str,), + "disable_out_of_the_box_postmortem_template": (bool,), + "editable_timestamps": (bool,), + "private_incidents": (bool,), + "private_incidents_by_default": (bool,), + "slug_source": (IncidentTypeSlugSource,), + "test_incidents": (bool,), + } + + attribute_map = { + "allow_incident_deletion": "allow_incident_deletion", + "allow_workflows": "allow_workflows", + "create_message": "create_message", + "disable_out_of_the_box_postmortem_template": "disable_out_of_the_box_postmortem_template", + "editable_timestamps": "editable_timestamps", + "private_incidents": "private_incidents", + "private_incidents_by_default": "private_incidents_by_default", + "slug_source": "slug_source", + "test_incidents": "test_incidents", + } + + def __init__( + self_, + allow_incident_deletion: Union[bool, UnsetType] = unset, + allow_workflows: Union[bool, UnsetType] = unset, + create_message: Union[str, UnsetType] = unset, + disable_out_of_the_box_postmortem_template: Union[bool, UnsetType] = unset, + editable_timestamps: Union[bool, UnsetType] = unset, + private_incidents: Union[bool, UnsetType] = unset, + private_incidents_by_default: Union[bool, UnsetType] = unset, + slug_source: Union[IncidentTypeSlugSource, UnsetType] = unset, + test_incidents: Union[bool, UnsetType] = unset, + **kwargs, + ): + """ + The incident-type-scoped behavior settings. All fields are optional on update. Any field omitted from a PATCH request keeps its current value. This object is read-only on the incident type resource itself and is only mutated through the update (PATCH) endpoint. + + :param allow_incident_deletion: Whether incidents of this type can be deleted. + :type allow_incident_deletion: bool, optional + + :param allow_workflows: Whether automation workflows can be triggered for incidents of this type. + :type allow_workflows: bool, optional + + :param create_message: An optional message shown to users when they declare an incident of this type. + :type create_message: str, optional + + :param disable_out_of_the_box_postmortem_template: Whether the out-of-the-box postmortem template is disabled for incidents of this type. + :type disable_out_of_the_box_postmortem_template: bool, optional + + :param editable_timestamps: Whether responders can edit incident timestamps for incidents of this type. + :type editable_timestamps: bool, optional + + :param private_incidents: Whether responders can create private incidents of this type. This is an opt-in setting, distinct from ``private_incidents_by_default`` , which controls whether incidents are created private automatically. + :type private_incidents: bool, optional + + :param private_incidents_by_default: Whether incidents of this type are created as private by default. + :type private_incidents_by_default: bool, optional + + :param slug_source: When set to ``servicenow`` , incidents will display the ServiceNow record ID instead of the public ID. If no ServiceNow integration exists, the public ID will be displayed. + :type slug_source: IncidentTypeSlugSource, optional + + :param test_incidents: Whether incidents of this type are treated as test incidents. + :type test_incidents: bool, optional + """ + if allow_incident_deletion is not unset: + kwargs["allow_incident_deletion"] = allow_incident_deletion + if allow_workflows is not unset: + kwargs["allow_workflows"] = allow_workflows + if create_message is not unset: + kwargs["create_message"] = create_message + if disable_out_of_the_box_postmortem_template is not unset: + kwargs["disable_out_of_the_box_postmortem_template"] = disable_out_of_the_box_postmortem_template + if editable_timestamps is not unset: + kwargs["editable_timestamps"] = editable_timestamps + if private_incidents is not unset: + kwargs["private_incidents"] = private_incidents + if private_incidents_by_default is not unset: + kwargs["private_incidents_by_default"] = private_incidents_by_default + if slug_source is not unset: + kwargs["slug_source"] = slug_source + if test_incidents is not unset: + kwargs["test_incidents"] = test_incidents + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_type_slug_source.py b/src/datadog_api_client/v2/model/incident_type_slug_source.py new file mode 100644 index 0000000000..e773a73179 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_type_slug_source.py @@ -0,0 +1,38 @@ +# 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 IncidentTypeSlugSource(ModelSimple): + """ + When set to `servicenow`, incidents will display the ServiceNow record ID instead of the public ID. If no ServiceNow integration exists, the public ID will be displayed. + + :param value: If omitted defaults to "default". Must be one of ["default", "servicenow"]. + :type value: str + """ + + allowed_values = { + "default", + "servicenow", + } + DEFAULT: ClassVar["IncidentTypeSlugSource"] + SERVICENOW: ClassVar["IncidentTypeSlugSource"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +IncidentTypeSlugSource.DEFAULT = IncidentTypeSlugSource("default") +IncidentTypeSlugSource.SERVICENOW = IncidentTypeSlugSource("servicenow") diff --git a/src/datadog_api_client/v2/model/incident_type_update_attributes.py b/src/datadog_api_client/v2/model/incident_type_update_attributes.py index d48db866f1..037db8a5e4 100644 --- a/src/datadog_api_client/v2/model/incident_type_update_attributes.py +++ b/src/datadog_api_client/v2/model/incident_type_update_attributes.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -14,10 +14,17 @@ ) +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_type_configuration import IncidentTypeConfiguration + + class IncidentTypeUpdateAttributes(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.incident_type_configuration import IncidentTypeConfiguration + return { + "configuration": (IncidentTypeConfiguration,), "created_at": (datetime,), "created_by": (str,), "description": (str,), @@ -29,6 +36,7 @@ def openapi_types(_): } attribute_map = { + "configuration": "configuration", "created_at": "createdAt", "created_by": "createdBy", "description": "description", @@ -48,6 +56,7 @@ def openapi_types(_): def __init__( self_, + configuration: Union[IncidentTypeConfiguration, UnsetType] = unset, created_at: Union[datetime, UnsetType] = unset, created_by: Union[str, UnsetType] = unset, description: Union[str, UnsetType] = unset, @@ -61,6 +70,9 @@ def __init__( """ Incident type's attributes for updates. + :param configuration: The incident-type-scoped behavior settings. All fields are optional on update. Any field omitted from a PATCH request keeps its current value. This object is read-only on the incident type resource itself and is only mutated through the update (PATCH) endpoint. + :type configuration: IncidentTypeConfiguration, optional + :param created_at: Timestamp when the incident type was created. :type created_at: datetime, optional @@ -85,6 +97,8 @@ def __init__( :param prefix: The string that will be prepended to the incident title across the Datadog app. :type prefix: str, optional """ + if configuration is not unset: + kwargs["configuration"] = configuration if created_at is not unset: kwargs["created_at"] = created_at if created_by is not unset: diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index c126db4284..4cfffe4e86 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3511,6 +3511,7 @@ from datadog_api_client.v2.model.incident_trigger_wrapper import IncidentTriggerWrapper from datadog_api_client.v2.model.incident_type import IncidentType from datadog_api_client.v2.model.incident_type_attributes import IncidentTypeAttributes +from datadog_api_client.v2.model.incident_type_configuration import IncidentTypeConfiguration from datadog_api_client.v2.model.incident_type_create_data import IncidentTypeCreateData from datadog_api_client.v2.model.incident_type_create_request import IncidentTypeCreateRequest from datadog_api_client.v2.model.incident_type_list_response import IncidentTypeListResponse @@ -3519,6 +3520,7 @@ from datadog_api_client.v2.model.incident_type_patch_request import IncidentTypePatchRequest from datadog_api_client.v2.model.incident_type_relationships import IncidentTypeRelationships from datadog_api_client.v2.model.incident_type_response import IncidentTypeResponse +from datadog_api_client.v2.model.incident_type_slug_source import IncidentTypeSlugSource from datadog_api_client.v2.model.incident_type_type import IncidentTypeType from datadog_api_client.v2.model.incident_type_update_attributes import IncidentTypeUpdateAttributes from datadog_api_client.v2.model.incident_update_attributes import IncidentUpdateAttributes @@ -12244,6 +12246,7 @@ "IncidentTriggerWrapper", "IncidentType", "IncidentTypeAttributes", + "IncidentTypeConfiguration", "IncidentTypeCreateData", "IncidentTypeCreateRequest", "IncidentTypeListResponse", @@ -12252,6 +12255,7 @@ "IncidentTypePatchRequest", "IncidentTypeRelationships", "IncidentTypeResponse", + "IncidentTypeSlugSource", "IncidentTypeType", "IncidentTypeUpdateAttributes", "IncidentUpdateAttributes", diff --git a/tests/v2/features/incidents.feature b/tests/v2/features/incidents.feature index e30ccb2529..646ec88d87 100644 --- a/tests/v2/features/incidents.feature +++ b/tests/v2/features/incidents.feature @@ -166,7 +166,7 @@ Feature: Incidents Scenario: Create an incident type returns "Bad Request" response Given operation "CreateIncidentType" enabled And new "CreateIncidentType" request - And body with value {"data": {"attributes": {"description": "Any incidents that harm (or have the potential to) the confidentiality, integrity, or availability of our data.", "is_default": false, "name": "Security Incident"}, "type": "incident_types"}} + And body with value {"data": {"attributes": {"configuration": {"allow_incident_deletion": false, "allow_workflows": true, "create_message": "Create an incident here", "disable_out_of_the_box_postmortem_template": false, "editable_timestamps": false, "private_incidents": false, "private_incidents_by_default": false, "slug_source": "default", "test_incidents": true}, "description": "Any incidents that harm (or have the potential to) the confidentiality, integrity, or availability of our data.", "is_default": false, "name": "Security Incident"}, "type": "incident_types"}} When the request is sent Then the response status is 400 Bad Request @@ -182,7 +182,7 @@ Feature: Incidents Scenario: Create an incident type returns "Not Found" response Given operation "CreateIncidentType" enabled And new "CreateIncidentType" request - And body with value {"data": {"attributes": {"description": "Any incidents that harm (or have the potential to) the confidentiality, integrity, or availability of our data.", "is_default": false, "name": "Security Incident"}, "type": "incident_types"}} + And body with value {"data": {"attributes": {"configuration": {"allow_incident_deletion": false, "allow_workflows": true, "create_message": "Create an incident here", "disable_out_of_the_box_postmortem_template": false, "editable_timestamps": false, "private_incidents": false, "private_incidents_by_default": false, "slug_source": "default", "test_incidents": true}, "description": "Any incidents that harm (or have the potential to) the confidentiality, integrity, or availability of our data.", "is_default": false, "name": "Security Incident"}, "type": "incident_types"}} When the request is sent Then the response status is 404 Not Found @@ -1298,7 +1298,7 @@ Feature: Incidents Given operation "UpdateIncidentType" enabled And new "UpdateIncidentType" request And request contains "incident_type_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"description": "Any incidents that harm (or have the potential to) the confidentiality, integrity, or availability of our data. Note: This will notify the security team.", "is_default": false, "name": "Security Incident"}, "id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}} + And body with value {"data": {"attributes": {"configuration": {"allow_incident_deletion": false, "allow_workflows": true, "create_message": "Create an incident here", "disable_out_of_the_box_postmortem_template": false, "editable_timestamps": false, "private_incidents": false, "private_incidents_by_default": false, "slug_source": "default", "test_incidents": true}, "description": "Any incidents that harm (or have the potential to) the confidentiality, integrity, or availability of our data. Note: This will notify the security team.", "is_default": false, "name": "Security Incident"}, "id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}} When the request is sent Then the response status is 400 Bad Request @@ -1307,7 +1307,7 @@ Feature: Incidents Given operation "UpdateIncidentType" enabled And new "UpdateIncidentType" request And request contains "incident_type_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"description": "Any incidents that harm (or have the potential to) the confidentiality, integrity, or availability of our data. Note: This will notify the security team.", "is_default": false, "name": "Security Incident"}, "id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}} + And body with value {"data": {"attributes": {"configuration": {"allow_incident_deletion": false, "allow_workflows": true, "create_message": "Create an incident here", "disable_out_of_the_box_postmortem_template": false, "editable_timestamps": false, "private_incidents": false, "private_incidents_by_default": false, "slug_source": "default", "test_incidents": true}, "description": "Any incidents that harm (or have the potential to) the confidentiality, integrity, or availability of our data. Note: This will notify the security team.", "is_default": false, "name": "Security Incident"}, "id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}} When the request is sent Then the response status is 404 Not Found