diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6cd7c2ab9ef..90a96bb6ac2 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -41678,6 +41678,24 @@ components: - type - method type: object + OnCallTrigger: + description: Trigger a workflow from an On-Call Page or On-Call Handover. For + automatic triggering a handle must be configured and the workflow must be + published. + properties: + rateLimit: + $ref: '#/components/schemas/TriggerRateLimit' + type: object + OnCallTriggerWrapper: + description: Schema for an On-Call-based trigger. + properties: + onCallTrigger: + $ref: '#/components/schemas/OnCallTrigger' + startStepNames: + $ref: '#/components/schemas/StartStepNames' + required: + - onCallTrigger + type: object OnDemandConcurrencyCap: description: On-demand concurrency cap. properties: @@ -60788,6 +60806,7 @@ components: - $ref: '#/components/schemas/IncidentTriggerWrapper' - $ref: '#/components/schemas/MonitorTriggerWrapper' - $ref: '#/components/schemas/NotebookTriggerWrapper' + - $ref: '#/components/schemas/OnCallTriggerWrapper' - $ref: '#/components/schemas/ScheduleTriggerWrapper' - $ref: '#/components/schemas/SecurityTriggerWrapper' - $ref: '#/components/schemas/SelfServiceTriggerWrapper' diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 0d9ba8f96c3..eec868dae28 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3529,6 +3529,8 @@ def overrides "v2.on_call_page_target_type" => "OnCallPageTargetType", "v2.on_call_phone_notification_rule_method" => "OnCallPhoneNotificationRuleMethod", "v2.on_call_phone_notification_rule_settings" => "OnCallPhoneNotificationRuleSettings", + "v2.on_call_trigger" => "OnCallTrigger", + "v2.on_call_trigger_wrapper" => "OnCallTriggerWrapper", "v2.on_demand_concurrency_cap" => "OnDemandConcurrencyCap", "v2.on_demand_concurrency_cap_attributes" => "OnDemandConcurrencyCapAttributes", "v2.on_demand_concurrency_cap_response" => "OnDemandConcurrencyCapResponse", diff --git a/lib/datadog_api_client/v2/models/on_call_trigger.rb b/lib/datadog_api_client/v2/models/on_call_trigger.rb new file mode 100644 index 00000000000..89629916d4e --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_trigger.rb @@ -0,0 +1,105 @@ +=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 On-Call Page or On-Call Handover. For automatic triggering a handle must be configured and the workflow must be published. + class OnCallTrigger + include BaseGenericModel + + # Defines a rate limit for a trigger. + attr_accessor :rate_limit + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'rate_limit' => :'rateLimit' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'rate_limit' => :'TriggerRateLimit' + } + 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::OnCallTrigger` 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?(:'rate_limit') + self.rate_limit = attributes[:'rate_limit'] + 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 && + rate_limit == o.rate_limit && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [rate_limit, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/on_call_trigger_wrapper.rb b/lib/datadog_api_client/v2/models/on_call_trigger_wrapper.rb new file mode 100644 index 00000000000..8119f0e9518 --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_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 On-Call-based trigger. + class OnCallTriggerWrapper + include BaseGenericModel + + # Trigger a workflow from an On-Call Page or On-Call Handover. For automatic triggering a handle must be configured and the workflow must be published. + attr_reader :on_call_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 + { + :'on_call_trigger' => :'onCallTrigger', + :'start_step_names' => :'startStepNames' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'on_call_trigger' => :'OnCallTrigger', + :'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::OnCallTriggerWrapper` 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?(:'on_call_trigger') + self.on_call_trigger = attributes[:'on_call_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 @on_call_trigger.nil? + true + end + + # Custom attribute writer method with validation + # @param on_call_trigger [Object] Object to be assigned + # @!visibility private + def on_call_trigger=(on_call_trigger) + if on_call_trigger.nil? + fail ArgumentError, 'invalid value for "on_call_trigger", on_call_trigger cannot be nil.' + end + @on_call_trigger = on_call_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 && + on_call_trigger == o.on_call_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 + [on_call_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 089d4804c9d..1073a1a9747 100644 --- a/lib/datadog_api_client/v2/models/trigger.rb +++ b/lib/datadog_api_client/v2/models/trigger.rb @@ -37,6 +37,7 @@ def openapi_one_of :'IncidentTriggerWrapper', :'MonitorTriggerWrapper', :'NotebookTriggerWrapper', + :'OnCallTriggerWrapper', :'ScheduleTriggerWrapper', :'SecurityTriggerWrapper', :'SelfServiceTriggerWrapper',