diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index a484bec1a76..b380cb71468 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -28684,6 +28684,19 @@ components: type: string x-enum-varnames: - INCIDENT_ATTACHMENTS + IncidentCondition: + description: A condition evaluated against incident tags. + properties: + tags: + description: Tags that must match for the condition to pass. + example: + - '' + items: + type: string + type: array + required: + - tags + type: object IncidentCreateAttributes: description: The incident's attributes for a create request. properties: @@ -30203,6 +30216,32 @@ components: user_defined_fields: $ref: '#/components/schemas/RelationshipToIncidentUserDefinedFields' type: object + IncidentScheduleTrigger: + description: Trigger a workflow from an Incident Schedule. The workflow must + be published. + properties: + incidentType: + description: Incident type filter for the schedule. + type: string + rrule: + description: Recurrence rule expression for scheduling. + example: '' + type: string + tagCondition: + $ref: '#/components/schemas/IncidentCondition' + required: + - rrule + type: object + IncidentScheduleTriggerWrapper: + description: Schema for an Incident Schedule-based trigger. + properties: + incidentScheduleTrigger: + $ref: '#/components/schemas/IncidentScheduleTrigger' + startStepNames: + $ref: '#/components/schemas/StartStepNames' + required: + - incidentScheduleTrigger + type: object IncidentSearchResponse: description: Response with incidents and facets. properties: @@ -65465,6 +65504,7 @@ components: - $ref: '#/components/schemas/DashboardTriggerWrapper' - $ref: '#/components/schemas/GithubWebhookTriggerWrapper' - $ref: '#/components/schemas/IncidentTriggerWrapper' + - $ref: '#/components/schemas/IncidentScheduleTriggerWrapper' - $ref: '#/components/schemas/MonitorTriggerWrapper' - $ref: '#/components/schemas/NotebookTriggerWrapper' - $ref: '#/components/schemas/OnCallTriggerWrapper' diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 77636ca0dc7..f85b734ccc4 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2705,6 +2705,7 @@ def overrides "v2.http_token_update" => "HTTPTokenUpdate", "v2.idp_metadata_form_data" => "IdPMetadataFormData", "v2.incident_attachment_type" => "IncidentAttachmentType", + "v2.incident_condition" => "IncidentCondition", "v2.incident_create_attributes" => "IncidentCreateAttributes", "v2.incident_create_data" => "IncidentCreateData", "v2.incident_create_relationships" => "IncidentCreateRelationships", @@ -2796,6 +2797,8 @@ def overrides "v2.incident_response_meta" => "IncidentResponseMeta", "v2.incident_response_meta_pagination" => "IncidentResponseMetaPagination", "v2.incident_response_relationships" => "IncidentResponseRelationships", + "v2.incident_schedule_trigger" => "IncidentScheduleTrigger", + "v2.incident_schedule_trigger_wrapper" => "IncidentScheduleTriggerWrapper", "v2.incident_search_response" => "IncidentSearchResponse", "v2.incident_search_response_attributes" => "IncidentSearchResponseAttributes", "v2.incident_search_response_data" => "IncidentSearchResponseData", diff --git a/lib/datadog_api_client/v2/models/incident_condition.rb b/lib/datadog_api_client/v2/models/incident_condition.rb new file mode 100644 index 00000000000..fabc7137ae6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_condition.rb @@ -0,0 +1,125 @@ +=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 + # A condition evaluated against incident tags. + class IncidentCondition + include BaseGenericModel + + # Tags that must match for the condition to pass. + attr_reader :tags + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'tags' => :'tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'tags' => :'Array' + } + 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::IncidentCondition` 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?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @tags.nil? + true + end + + # Custom attribute writer method with validation + # @param tags [Object] Object to be assigned + # @!visibility private + def tags=(tags) + if tags.nil? + fail ArgumentError, 'invalid value for "tags", tags cannot be nil.' + end + @tags = tags + 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 && + tags == o.tags && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [tags, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_schedule_trigger.rb b/lib/datadog_api_client/v2/models/incident_schedule_trigger.rb new file mode 100644 index 00000000000..0e6561cab10 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_schedule_trigger.rb @@ -0,0 +1,143 @@ +=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 + # Trigger a workflow from an Incident Schedule. The workflow must be published. + class IncidentScheduleTrigger + include BaseGenericModel + + # Incident type filter for the schedule. + attr_accessor :incident_type + + # Recurrence rule expression for scheduling. + attr_reader :rrule + + # A condition evaluated against incident tags. + attr_accessor :tag_condition + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'incident_type' => :'incidentType', + :'rrule' => :'rrule', + :'tag_condition' => :'tagCondition' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'incident_type' => :'String', + :'rrule' => :'String', + :'tag_condition' => :'IncidentCondition' + } + 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::IncidentScheduleTrigger` 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?(:'incident_type') + self.incident_type = attributes[:'incident_type'] + end + + if attributes.key?(:'rrule') + self.rrule = attributes[:'rrule'] + end + + if attributes.key?(:'tag_condition') + self.tag_condition = attributes[:'tag_condition'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @rrule.nil? + true + end + + # Custom attribute writer method with validation + # @param rrule [Object] Object to be assigned + # @!visibility private + def rrule=(rrule) + if rrule.nil? + fail ArgumentError, 'invalid value for "rrule", rrule cannot be nil.' + end + @rrule = rrule + 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 && + incident_type == o.incident_type && + rrule == o.rrule && + tag_condition == o.tag_condition && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [incident_type, rrule, tag_condition, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_schedule_trigger_wrapper.rb b/lib/datadog_api_client/v2/models/incident_schedule_trigger_wrapper.rb new file mode 100644 index 00000000000..b66f5e05c65 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_schedule_trigger_wrapper.rb @@ -0,0 +1,135 @@ +=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 + # Schema for an Incident Schedule-based trigger. + class IncidentScheduleTriggerWrapper + include BaseGenericModel + + # Trigger a workflow from an Incident Schedule. The workflow must be published. + attr_reader :incident_schedule_trigger + + # A list of steps that run first after a trigger fires. + attr_accessor :start_step_names + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'incident_schedule_trigger' => :'incidentScheduleTrigger', + :'start_step_names' => :'startStepNames' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'incident_schedule_trigger' => :'IncidentScheduleTrigger', + :'start_step_names' => :'Array' + } + 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::IncidentScheduleTriggerWrapper` 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?(:'incident_schedule_trigger') + self.incident_schedule_trigger = attributes[:'incident_schedule_trigger'] + end + + if attributes.key?(:'start_step_names') + if (value = attributes[:'start_step_names']).is_a?(Array) + self.start_step_names = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @incident_schedule_trigger.nil? + true + end + + # Custom attribute writer method with validation + # @param incident_schedule_trigger [Object] Object to be assigned + # @!visibility private + def incident_schedule_trigger=(incident_schedule_trigger) + if incident_schedule_trigger.nil? + fail ArgumentError, 'invalid value for "incident_schedule_trigger", incident_schedule_trigger cannot be nil.' + end + @incident_schedule_trigger = incident_schedule_trigger + 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 && + incident_schedule_trigger == o.incident_schedule_trigger && + start_step_names == o.start_step_names && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [incident_schedule_trigger, start_step_names, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/trigger.rb b/lib/datadog_api_client/v2/models/trigger.rb index 1073a1a9747..14e017238bf 100644 --- a/lib/datadog_api_client/v2/models/trigger.rb +++ b/lib/datadog_api_client/v2/models/trigger.rb @@ -35,6 +35,7 @@ def openapi_one_of :'DashboardTriggerWrapper', :'GithubWebhookTriggerWrapper', :'IncidentTriggerWrapper', + :'IncidentScheduleTriggerWrapper', :'MonitorTriggerWrapper', :'NotebookTriggerWrapper', :'OnCallTriggerWrapper',