diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9733a374055e..46ddf3fb6357 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -90635,6 +90635,22 @@ components: - type - method type: object + OnCallShiftChangeTrigger: + description: "Trigger a workflow when an On-Call shift changes. The workflow must be published." + properties: + rateLimit: + $ref: "#/components/schemas/TriggerRateLimit" + type: object + OnCallShiftChangeTriggerWrapper: + description: "Schema for an On-Call shift change trigger." + properties: + onCallShiftChangeTrigger: + $ref: "#/components/schemas/OnCallShiftChangeTrigger" + startStepNames: + $ref: "#/components/schemas/StartStepNames" + required: + - onCallShiftChangeTrigger + 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: @@ -135313,6 +135329,7 @@ components: - $ref: "#/components/schemas/IncidentTriggerWrapper" - $ref: "#/components/schemas/MonitorTriggerWrapper" - $ref: "#/components/schemas/NotebookTriggerWrapper" + - $ref: "#/components/schemas/OnCallShiftChangeTriggerWrapper" - $ref: "#/components/schemas/OnCallTriggerWrapper" - $ref: "#/components/schemas/ScheduleTriggerWrapper" - $ref: "#/components/schemas/SecurityTriggerWrapper" diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 8fdefa616ee8..f34a0b4768d3 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -6381,6 +6381,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_shift_change_trigger" => "OnCallShiftChangeTrigger", + "v2.on_call_shift_change_trigger_wrapper" => "OnCallShiftChangeTriggerWrapper", "v2.on_call_trigger" => "OnCallTrigger", "v2.on_call_trigger_wrapper" => "OnCallTriggerWrapper", "v2.on_demand_concurrency_cap" => "OnDemandConcurrencyCap", diff --git a/lib/datadog_api_client/v2/models/on_call_shift_change_trigger.rb b/lib/datadog_api_client/v2/models/on_call_shift_change_trigger.rb new file mode 100644 index 000000000000..645eb818ac10 --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_shift_change_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 when an On-Call shift changes. The workflow must be published. + class OnCallShiftChangeTrigger + 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::OnCallShiftChangeTrigger` 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_shift_change_trigger_wrapper.rb b/lib/datadog_api_client/v2/models/on_call_shift_change_trigger_wrapper.rb new file mode 100644 index 000000000000..4679240faa6d --- /dev/null +++ b/lib/datadog_api_client/v2/models/on_call_shift_change_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 shift change trigger. + class OnCallShiftChangeTriggerWrapper + include BaseGenericModel + + # Trigger a workflow when an On-Call shift changes. The workflow must be published. + attr_reader :on_call_shift_change_trigger + + # Names of existing workflow 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_shift_change_trigger' => :'onCallShiftChangeTrigger', + :'start_step_names' => :'startStepNames' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'on_call_shift_change_trigger' => :'OnCallShiftChangeTrigger', + :'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::OnCallShiftChangeTriggerWrapper` 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_shift_change_trigger') + self.on_call_shift_change_trigger = attributes[:'on_call_shift_change_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_shift_change_trigger.nil? + true + end + + # Custom attribute writer method with validation + # @param on_call_shift_change_trigger [Object] Object to be assigned + # @!visibility private + def on_call_shift_change_trigger=(on_call_shift_change_trigger) + if on_call_shift_change_trigger.nil? + fail ArgumentError, 'invalid value for "on_call_shift_change_trigger", on_call_shift_change_trigger cannot be nil.' + end + @on_call_shift_change_trigger = on_call_shift_change_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_shift_change_trigger == o.on_call_shift_change_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_shift_change_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 3288e1107df1..e36d6c823ae1 100644 --- a/lib/datadog_api_client/v2/models/trigger.rb +++ b/lib/datadog_api_client/v2/models/trigger.rb @@ -46,6 +46,7 @@ def openapi_one_of :'IncidentTriggerWrapper', :'MonitorTriggerWrapper', :'NotebookTriggerWrapper', + :'OnCallShiftChangeTriggerWrapper', :'OnCallTriggerWrapper', :'ScheduleTriggerWrapper', :'SecurityTriggerWrapper',