Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions features/v2/incidents.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 2 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
12 changes: 11 additions & 1 deletion lib/datadog_api_client/v2/models/incident_type_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -51,6 +54,7 @@ class IncidentTypeAttributes
# @!visibility private
def self.attribute_map
{
:'configuration' => :'configuration',
:'created_at' => :'createdAt',
:'created_by' => :'createdBy',
:'description' => :'description',
Expand All @@ -66,6 +70,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'configuration' => :'IncidentTypeConfiguration',
:'created_at' => :'Time',
:'created_by' => :'String',
:'description' => :'String',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 &&
Expand All @@ -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
185 changes: 185 additions & 0 deletions lib/datadog_api_client/v2/models/incident_type_configuration.rb
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading