diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 50b7ccf9b24d..67003f11ba51 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/features/v2/incidents.feature b/features/v2/incidents.feature index e30ccb252928..646ec88d8798 100644 --- a/features/v2/incidents.feature +++ b/features/v2/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 diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 50df41aafe1d..b5448a033d8c 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3812,6 +3812,7 @@ def overrides "v2.incident_trigger_wrapper" => "IncidentTriggerWrapper", "v2.incident_type" => "IncidentType", "v2.incident_type_attributes" => "IncidentTypeAttributes", + "v2.incident_type_configuration" => "IncidentTypeConfiguration", "v2.incident_type_create_data" => "IncidentTypeCreateData", "v2.incident_type_create_request" => "IncidentTypeCreateRequest", "v2.incident_type_list_response" => "IncidentTypeListResponse", @@ -3820,6 +3821,7 @@ def overrides "v2.incident_type_patch_request" => "IncidentTypePatchRequest", "v2.incident_type_relationships" => "IncidentTypeRelationships", "v2.incident_type_response" => "IncidentTypeResponse", + "v2.incident_type_slug_source" => "IncidentTypeSlugSource", "v2.incident_type_type" => "IncidentTypeType", "v2.incident_type_update_attributes" => "IncidentTypeUpdateAttributes", "v2.incident_update_attributes" => "IncidentUpdateAttributes", diff --git a/lib/datadog_api_client/v2/models/incident_type_attributes.rb b/lib/datadog_api_client/v2/models/incident_type_attributes.rb index 96693c0fd922..84918721e628 100644 --- a/lib/datadog_api_client/v2/models/incident_type_attributes.rb +++ b/lib/datadog_api_client/v2/models/incident_type_attributes.rb @@ -21,6 +21,9 @@ module DatadogAPIClient::V2 class IncidentTypeAttributes include BaseGenericModel + # 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. + attr_accessor :configuration + # Timestamp when the incident type was created. attr_accessor :created_at @@ -51,6 +54,7 @@ class IncidentTypeAttributes # @!visibility private def self.attribute_map { + :'configuration' => :'configuration', :'created_at' => :'createdAt', :'created_by' => :'createdBy', :'description' => :'description', @@ -66,6 +70,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'configuration' => :'IncidentTypeConfiguration', :'created_at' => :'Time', :'created_by' => :'String', :'description' => :'String', @@ -95,6 +100,10 @@ def initialize(attributes = {}) end } + if attributes.key?(:'configuration') + self.configuration = attributes[:'configuration'] + end + if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end @@ -172,6 +181,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + configuration == o.configuration && created_at == o.created_at && created_by == o.created_by && description == o.description && @@ -187,7 +197,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [created_at, created_by, description, is_default, last_modified_by, modified_at, name, prefix, additional_properties].hash + [configuration, created_at, created_by, description, is_default, last_modified_by, modified_at, name, prefix, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/incident_type_configuration.rb b/lib/datadog_api_client/v2/models/incident_type_configuration.rb new file mode 100644 index 000000000000..e64535e8bcaa --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_type_configuration.rb @@ -0,0 +1,185 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class IncidentTypeConfiguration + include BaseGenericModel + + # Whether incidents of this type can be deleted. + attr_accessor :allow_incident_deletion + + # Whether automation workflows can be triggered for incidents of this type. + attr_accessor :allow_workflows + + # An optional message shown to users when they declare an incident of this type. + attr_accessor :create_message + + # Whether the out-of-the-box postmortem template is disabled for incidents of this type. + attr_accessor :disable_out_of_the_box_postmortem_template + + # Whether responders can edit incident timestamps for incidents of this type. + attr_accessor :editable_timestamps + + # 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. + attr_accessor :private_incidents + + # Whether incidents of this type are created as private by default. + attr_accessor :private_incidents_by_default + + # 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. + attr_accessor :slug_source + + # Whether incidents of this type are treated as test incidents. + attr_accessor :test_incidents + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.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' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'allow_incident_deletion' => :'Boolean', + :'allow_workflows' => :'Boolean', + :'create_message' => :'String', + :'disable_out_of_the_box_postmortem_template' => :'Boolean', + :'editable_timestamps' => :'Boolean', + :'private_incidents' => :'Boolean', + :'private_incidents_by_default' => :'Boolean', + :'slug_source' => :'IncidentTypeSlugSource', + :'test_incidents' => :'Boolean' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentTypeConfiguration` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'allow_incident_deletion') + self.allow_incident_deletion = attributes[:'allow_incident_deletion'] + end + + if attributes.key?(:'allow_workflows') + self.allow_workflows = attributes[:'allow_workflows'] + end + + if attributes.key?(:'create_message') + self.create_message = attributes[:'create_message'] + end + + if attributes.key?(:'disable_out_of_the_box_postmortem_template') + self.disable_out_of_the_box_postmortem_template = attributes[:'disable_out_of_the_box_postmortem_template'] + end + + if attributes.key?(:'editable_timestamps') + self.editable_timestamps = attributes[:'editable_timestamps'] + end + + if attributes.key?(:'private_incidents') + self.private_incidents = attributes[:'private_incidents'] + end + + if attributes.key?(:'private_incidents_by_default') + self.private_incidents_by_default = attributes[:'private_incidents_by_default'] + end + + if attributes.key?(:'slug_source') + self.slug_source = attributes[:'slug_source'] + end + + if attributes.key?(:'test_incidents') + self.test_incidents = attributes[:'test_incidents'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + allow_incident_deletion == o.allow_incident_deletion && + allow_workflows == o.allow_workflows && + create_message == o.create_message && + disable_out_of_the_box_postmortem_template == o.disable_out_of_the_box_postmortem_template && + editable_timestamps == o.editable_timestamps && + private_incidents == o.private_incidents && + private_incidents_by_default == o.private_incidents_by_default && + slug_source == o.slug_source && + test_incidents == o.test_incidents && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [allow_incident_deletion, allow_workflows, create_message, disable_out_of_the_box_postmortem_template, editable_timestamps, private_incidents, private_incidents_by_default, slug_source, test_incidents, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_type_slug_source.rb b/lib/datadog_api_client/v2/models/incident_type_slug_source.rb new file mode 100644 index 000000000000..49425dd2100c --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_type_slug_source.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class IncidentTypeSlugSource + include BaseEnumModel + + DEFAULT = "default".freeze + SERVICENOW = "servicenow".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_type_update_attributes.rb b/lib/datadog_api_client/v2/models/incident_type_update_attributes.rb index 66f4b3e1e210..68269854fba6 100644 --- a/lib/datadog_api_client/v2/models/incident_type_update_attributes.rb +++ b/lib/datadog_api_client/v2/models/incident_type_update_attributes.rb @@ -21,6 +21,9 @@ module DatadogAPIClient::V2 class IncidentTypeUpdateAttributes include BaseGenericModel + # 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. + attr_accessor :configuration + # Timestamp when the incident type was created. attr_accessor :created_at @@ -51,6 +54,7 @@ class IncidentTypeUpdateAttributes # @!visibility private def self.attribute_map { + :'configuration' => :'configuration', :'created_at' => :'createdAt', :'created_by' => :'createdBy', :'description' => :'description', @@ -66,6 +70,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'configuration' => :'IncidentTypeConfiguration', :'created_at' => :'Time', :'created_by' => :'String', :'description' => :'String', @@ -95,6 +100,10 @@ def initialize(attributes = {}) end } + if attributes.key?(:'configuration') + self.configuration = attributes[:'configuration'] + end + if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end @@ -154,6 +163,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + configuration == o.configuration && created_at == o.created_at && created_by == o.created_by && description == o.description && @@ -169,7 +179,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [created_at, created_by, description, is_default, last_modified_by, modified_at, name, prefix, additional_properties].hash + [configuration, created_at, created_by, description, is_default, last_modified_by, modified_at, name, prefix, additional_properties].hash end end end