From 01d57df5544f7c82bc05dae5ec5d2b3bba377f3f Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 5 Aug 2026 22:53:06 +0000 Subject: [PATCH] Regenerate client from commit 01552e6 of spec repo --- .generator/schemas/v2/openapi.yaml | 102 ++++++++ .../CreateFeatureFlag_2426084719.rb | 41 +++ features/v2/feature_flags.feature | 9 + lib/datadog_api_client/inflector.rb | 4 + .../models/create_feature_flag_attributes.rb | 27 +- .../v2/models/notification_rule_target.rb | 165 ++++++++++++ .../notification_rule_target_configuration.rb | 235 ++++++++++++++++++ ...ion_rule_target_configuration_recipient.rb | 105 ++++++++ .../models/notification_rule_target_type.rb | 31 +++ 9 files changed, 718 insertions(+), 1 deletion(-) create mode 100644 examples/v2/feature-flags/CreateFeatureFlag_2426084719.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_target.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_target_configuration.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_target_configuration_recipient.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_target_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 05592fbb5535..fe8496d75721 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -24463,6 +24463,19 @@ components: description: The name of the feature flag. example: "Feature Flag ABC123" type: string + notification_rule_query: + description: |- + Query used to determine which change events on this feature flag trigger notifications to `rule_targets`. Uses Datadog's standard log search syntax (`AND`, `OR`, `NOT`, parentheses) to match against the `notification_type` facet. + + Supported `notification_type` values for a feature flag are: `flag_enabled_disabled`, `flag_archived`, `flag_approval_required`, `rollout_started`, `rollout_scheduled`, `rollout_step_started`, `rollout_paused_guardrail`, `rollout_paused_user`, `rollout_aborted_guardrail`, `rollout_aborted_user`, `targeting_rule_created`, `targeting_rule_updated`, `targeting_rule_updated_via_filter`, and `targeting_rule_deleted`. + example: "notification_type:rollout_started OR notification_type:targeting_rule_updated" + nullable: true + type: string + rule_targets: + description: Targets to notify about changes to this feature flag that match `notification_rule_query`. + items: + $ref: "#/components/schemas/NotificationRuleTarget" + type: array value_type: $ref: "#/components/schemas/ValueType" variants: @@ -69161,6 +69174,95 @@ components: type: string x-enum-varnames: - MANUAL + NotificationRuleTarget: + description: A notification target that receives change alerts for a feature flag. + properties: + configuration: + $ref: "#/components/schemas/NotificationRuleTargetConfiguration" + type: + $ref: "#/components/schemas/NotificationRuleTargetType" + version: + description: Schema version of `configuration`. + example: 1 + format: int64 + type: integer + required: + - type + - version + - configuration + type: object + NotificationRuleTargetConfiguration: + description: "Configuration for a notification target. Which fields apply depends on the target's `type`." + properties: + channel: + description: Slack channel name, for a `SLACK_CHANNEL` target. + example: "#feature-flags" + type: string + channel_id: + description: Slack channel ID, for a `SLACK_CHANNEL` target, or Microsoft Teams channel ID, for an `MS_TEAMS_CHANNEL` target. + type: string + channel_name: + description: Microsoft Teams channel name, for an `MS_TEAMS_CHANNEL` target. + type: string + connector_name: + description: Microsoft Teams connector name, for an `MS_TEAMS_CHANNEL` target. + type: string + recipient: + $ref: "#/components/schemas/NotificationRuleTargetConfigurationRecipient" + service_name: + description: PagerDuty service name, for a `PAGERDUTY_SERVICE` target. + type: string + team_id: + description: Microsoft Teams team ID, for an `MS_TEAMS_CHANNEL` target. + type: string + team_name: + description: Microsoft Teams team name, for an `MS_TEAMS_CHANNEL` target. + type: string + tenant_id: + description: Microsoft Teams tenant ID, for an `MS_TEAMS_CHANNEL` target. + type: string + tenant_name: + description: Microsoft Teams tenant name, for an `MS_TEAMS_CHANNEL` target. + type: string + username: + description: Slack username, for a `SLACK_USER` target. + type: string + webhook_name: + description: Name of the configured webhook, for a `WEBHOOK` target. + type: string + workspace: + description: Slack workspace name, for a `SLACK_CHANNEL` or `SLACK_USER` target. + type: string + workspace_id: + description: Slack workspace ID, for a `SLACK_CHANNEL` target. + type: string + type: object + NotificationRuleTargetConfigurationRecipient: + description: Recipient for an `EMAIL` target. + properties: + email: + description: Email address to notify. + example: "user@example.com" + type: string + type: object + NotificationRuleTargetType: + description: The type of notification target. + enum: + - "EMAIL" + - "SLACK_CHANNEL" + - "SLACK_USER" + - "WEBHOOK" + - "PAGERDUTY_SERVICE" + - "MS_TEAMS_CHANNEL" + example: "SLACK_CHANNEL" + type: string + x-enum-varnames: + - EMAIL + - SLACK_CHANNEL + - SLACK_USER + - WEBHOOK + - PAGERDUTY_SERVICE + - MS_TEAMS_CHANNEL NotificationRulesListResponse: description: The list of notification rules. properties: diff --git a/examples/v2/feature-flags/CreateFeatureFlag_2426084719.rb b/examples/v2/feature-flags/CreateFeatureFlag_2426084719.rb new file mode 100644 index 000000000000..d21d06c21c34 --- /dev/null +++ b/examples/v2/feature-flags/CreateFeatureFlag_2426084719.rb @@ -0,0 +1,41 @@ +# Create a feature flag with notification rule targets returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new + +body = DatadogAPIClient::V2::CreateFeatureFlagRequest.new({ + data: DatadogAPIClient::V2::CreateFeatureFlagData.new({ + type: DatadogAPIClient::V2::CreateFeatureFlagDataType::FEATURE_FLAGS, + attributes: DatadogAPIClient::V2::CreateFeatureFlagAttributes.new({ + default_variant_key: "variant-Example-Feature-Flag-1", + description: "Test feature flag with notification rule targets for BDD scenarios", + key: "test-feature-flag-notify-Example-Feature-Flag", + name: "Test Feature Flag Notify Example-Feature-Flag", + value_type: DatadogAPIClient::V2::ValueType::BOOLEAN, + variants: [ + DatadogAPIClient::V2::CreateVariant.new({ + key: "variant-Example-Feature-Flag-1", + name: "Variant Example-Feature-Flag A", + value: "true", + }), + DatadogAPIClient::V2::CreateVariant.new({ + key: "variant-Example-Feature-Flag-2", + name: "Variant Example-Feature-Flag B", + value: "false", + }), + ], + notification_rule_query: "notification_type:rollout_started", + rule_targets: [ + DatadogAPIClient::V2::NotificationRuleTarget.new({ + type: DatadogAPIClient::V2::NotificationRuleTargetType::SLACK_CHANNEL, + version: 1, + configuration: DatadogAPIClient::V2::NotificationRuleTargetConfiguration.new({ + channel: "#feature-flags-test", + workspace: "datadoghq", + }), + }), + ], + }), + }), +}) +p api_instance.create_feature_flag(body) diff --git a/features/v2/feature_flags.feature b/features/v2/feature_flags.feature index f44699236d86..36ffeb8de6ff 100644 --- a/features/v2/feature_flags.feature +++ b/features/v2/feature_flags.feature @@ -85,6 +85,15 @@ Feature: Feature Flags And the response "data.attributes.name" is equal to "Test Feature Flag {{ unique }}" And the response "data.attributes.value_type" is equal to "BOOLEAN" + @team:DataDog/feature-flags + Scenario: Create a feature flag with notification rule targets returns "Created" response + Given new "CreateFeatureFlag" request + And body with value {"data": {"type": "feature-flags", "attributes": {"default_variant_key": "variant-{{ unique }}-1", "description": "Test feature flag with notification rule targets for BDD scenarios", "key": "test-feature-flag-notify-{{ unique }}", "name": "Test Feature Flag Notify {{ unique }}", "value_type": "BOOLEAN", "variants": [{"key": "variant-{{ unique }}-1", "name": "Variant {{ unique }} A", "value": "true"}, {"key": "variant-{{ unique }}-2", "name": "Variant {{ unique }} B", "value": "false"}], "notification_rule_query": "notification_type:rollout_started", "rule_targets": [{"type": "SLACK_CHANNEL", "version": 1, "configuration": {"channel": "#feature-flags-test", "workspace": "datadoghq"}}]}}} + When the request is sent + Then the response status is 201 Created + And the response "data.attributes.key" is equal to "test-feature-flag-notify-{{ unique }}" + And the response "data.attributes.name" is equal to "Test Feature Flag Notify {{ unique }}" + @team:DataDog/feature-flags Scenario: Create allocation for a flag in an environment returns "Created" response Given there is a valid "feature_flag" in the system diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 7f236b0012e7..4e56e972a382 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5254,6 +5254,10 @@ def overrides "v2.notification_rule_routing_mode" => "NotificationRuleRoutingMode", "v2.notification_rules_list_response" => "NotificationRulesListResponse", "v2.notification_rules_type" => "NotificationRulesType", + "v2.notification_rule_target" => "NotificationRuleTarget", + "v2.notification_rule_target_configuration" => "NotificationRuleTargetConfiguration", + "v2.notification_rule_target_configuration_recipient" => "NotificationRuleTargetConfigurationRecipient", + "v2.notification_rule_target_type" => "NotificationRuleTargetType", "v2.notion_api_key" => "NotionAPIKey", "v2.notion_api_key_type" => "NotionAPIKeyType", "v2.notion_api_key_update" => "NotionAPIKeyUpdate", diff --git a/lib/datadog_api_client/v2/models/create_feature_flag_attributes.rb b/lib/datadog_api_client/v2/models/create_feature_flag_attributes.rb index c0cade510c1d..324b9671df33 100644 --- a/lib/datadog_api_client/v2/models/create_feature_flag_attributes.rb +++ b/lib/datadog_api_client/v2/models/create_feature_flag_attributes.rb @@ -36,6 +36,14 @@ class CreateFeatureFlagAttributes # The name of the feature flag. attr_reader :name + # Query used to determine which change events on this feature flag trigger notifications to `rule_targets`. Uses Datadog's standard log search syntax (`AND`, `OR`, `NOT`, parentheses) to match against the `notification_type` facet. + # + # Supported `notification_type` values for a feature flag are: `flag_enabled_disabled`, `flag_archived`, `flag_approval_required`, `rollout_started`, `rollout_scheduled`, `rollout_step_started`, `rollout_paused_guardrail`, `rollout_paused_user`, `rollout_aborted_guardrail`, `rollout_aborted_user`, `targeting_rule_created`, `targeting_rule_updated`, `targeting_rule_updated_via_filter`, and `targeting_rule_deleted`. + attr_accessor :notification_rule_query + + # Targets to notify about changes to this feature flag that match `notification_rule_query`. + attr_accessor :rule_targets + # The type of values for the feature flag variants. attr_reader :value_type @@ -53,6 +61,8 @@ def self.attribute_map :'json_schema' => :'json_schema', :'key' => :'key', :'name' => :'name', + :'notification_rule_query' => :'notification_rule_query', + :'rule_targets' => :'rule_targets', :'value_type' => :'value_type', :'variants' => :'variants' } @@ -67,6 +77,8 @@ def self.openapi_types :'json_schema' => :'String', :'key' => :'String', :'name' => :'String', + :'notification_rule_query' => :'String', + :'rule_targets' => :'Array', :'value_type' => :'ValueType', :'variants' => :'Array' } @@ -78,6 +90,7 @@ def self.openapi_nullable Set.new([ :'default_variant_key', :'json_schema', + :'notification_rule_query', ]) end @@ -119,6 +132,16 @@ def initialize(attributes = {}) self.name = attributes[:'name'] end + if attributes.key?(:'notification_rule_query') + self.notification_rule_query = attributes[:'notification_rule_query'] + end + + if attributes.key?(:'rule_targets') + if (value = attributes[:'rule_targets']).is_a?(Array) + self.rule_targets = value + end + end + if attributes.key?(:'value_type') self.value_type = attributes[:'value_type'] end @@ -223,6 +246,8 @@ def ==(o) json_schema == o.json_schema && key == o.key && name == o.name && + notification_rule_query == o.notification_rule_query && + rule_targets == o.rule_targets && value_type == o.value_type && variants == o.variants && additional_properties == o.additional_properties @@ -232,7 +257,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [default_variant_key, description, json_schema, key, name, value_type, variants, additional_properties].hash + [default_variant_key, description, json_schema, key, name, notification_rule_query, rule_targets, value_type, variants, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/notification_rule_target.rb b/lib/datadog_api_client/v2/models/notification_rule_target.rb new file mode 100644 index 000000000000..24e147146bbc --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_target.rb @@ -0,0 +1,165 @@ +=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 notification target that receives change alerts for a feature flag. + class NotificationRuleTarget + include BaseGenericModel + + # Configuration for a notification target. Which fields apply depends on the target's `type`. + attr_reader :configuration + + # The type of notification target. + attr_reader :type + + # Schema version of `configuration`. + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'configuration' => :'configuration', + :'type' => :'type', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'configuration' => :'NotificationRuleTargetConfiguration', + :'type' => :'NotificationRuleTargetType', + :'version' => :'Integer' + } + 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::NotificationRuleTarget` 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?(:'configuration') + self.configuration = attributes[:'configuration'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + 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 @configuration.nil? + return false if @type.nil? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param configuration [Object] Object to be assigned + # @!visibility private + def configuration=(configuration) + if configuration.nil? + fail ArgumentError, 'invalid value for "configuration", configuration cannot be nil.' + end + @configuration = configuration + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + 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 && + configuration == o.configuration && + type == o.type && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [configuration, type, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_target_configuration.rb b/lib/datadog_api_client/v2/models/notification_rule_target_configuration.rb new file mode 100644 index 000000000000..bfb876f686fe --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_target_configuration.rb @@ -0,0 +1,235 @@ +=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 + # Configuration for a notification target. Which fields apply depends on the target's `type`. + class NotificationRuleTargetConfiguration + include BaseGenericModel + + # Slack channel name, for a `SLACK_CHANNEL` target. + attr_accessor :channel + + # Slack channel ID, for a `SLACK_CHANNEL` target, or Microsoft Teams channel ID, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :channel_id + + # Microsoft Teams channel name, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :channel_name + + # Microsoft Teams connector name, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :connector_name + + # Recipient for an `EMAIL` target. + attr_accessor :recipient + + # PagerDuty service name, for a `PAGERDUTY_SERVICE` target. + attr_accessor :service_name + + # Microsoft Teams team ID, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :team_id + + # Microsoft Teams team name, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :team_name + + # Microsoft Teams tenant ID, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :tenant_id + + # Microsoft Teams tenant name, for an `MS_TEAMS_CHANNEL` target. + attr_accessor :tenant_name + + # Slack username, for a `SLACK_USER` target. + attr_accessor :username + + # Name of the configured webhook, for a `WEBHOOK` target. + attr_accessor :webhook_name + + # Slack workspace name, for a `SLACK_CHANNEL` or `SLACK_USER` target. + attr_accessor :workspace + + # Slack workspace ID, for a `SLACK_CHANNEL` target. + attr_accessor :workspace_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'channel' => :'channel', + :'channel_id' => :'channel_id', + :'channel_name' => :'channel_name', + :'connector_name' => :'connector_name', + :'recipient' => :'recipient', + :'service_name' => :'service_name', + :'team_id' => :'team_id', + :'team_name' => :'team_name', + :'tenant_id' => :'tenant_id', + :'tenant_name' => :'tenant_name', + :'username' => :'username', + :'webhook_name' => :'webhook_name', + :'workspace' => :'workspace', + :'workspace_id' => :'workspace_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'channel' => :'String', + :'channel_id' => :'String', + :'channel_name' => :'String', + :'connector_name' => :'String', + :'recipient' => :'NotificationRuleTargetConfigurationRecipient', + :'service_name' => :'String', + :'team_id' => :'String', + :'team_name' => :'String', + :'tenant_id' => :'String', + :'tenant_name' => :'String', + :'username' => :'String', + :'webhook_name' => :'String', + :'workspace' => :'String', + :'workspace_id' => :'String' + } + 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::NotificationRuleTargetConfiguration` 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?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'channel_id') + self.channel_id = attributes[:'channel_id'] + end + + if attributes.key?(:'channel_name') + self.channel_name = attributes[:'channel_name'] + end + + if attributes.key?(:'connector_name') + self.connector_name = attributes[:'connector_name'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'service_name') + self.service_name = attributes[:'service_name'] + end + + if attributes.key?(:'team_id') + self.team_id = attributes[:'team_id'] + end + + if attributes.key?(:'team_name') + self.team_name = attributes[:'team_name'] + end + + if attributes.key?(:'tenant_id') + self.tenant_id = attributes[:'tenant_id'] + end + + if attributes.key?(:'tenant_name') + self.tenant_name = attributes[:'tenant_name'] + end + + if attributes.key?(:'username') + self.username = attributes[:'username'] + end + + if attributes.key?(:'webhook_name') + self.webhook_name = attributes[:'webhook_name'] + end + + if attributes.key?(:'workspace') + self.workspace = attributes[:'workspace'] + end + + if attributes.key?(:'workspace_id') + self.workspace_id = attributes[:'workspace_id'] + 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 && + channel == o.channel && + channel_id == o.channel_id && + channel_name == o.channel_name && + connector_name == o.connector_name && + recipient == o.recipient && + service_name == o.service_name && + team_id == o.team_id && + team_name == o.team_name && + tenant_id == o.tenant_id && + tenant_name == o.tenant_name && + username == o.username && + webhook_name == o.webhook_name && + workspace == o.workspace && + workspace_id == o.workspace_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [channel, channel_id, channel_name, connector_name, recipient, service_name, team_id, team_name, tenant_id, tenant_name, username, webhook_name, workspace, workspace_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_target_configuration_recipient.rb b/lib/datadog_api_client/v2/models/notification_rule_target_configuration_recipient.rb new file mode 100644 index 000000000000..e063509a5bf7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_target_configuration_recipient.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 + # Recipient for an `EMAIL` target. + class NotificationRuleTargetConfigurationRecipient + include BaseGenericModel + + # Email address to notify. + attr_accessor :email + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'email' => :'email' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'email' => :'String' + } + 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::NotificationRuleTargetConfigurationRecipient` 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?(:'email') + self.email = attributes[:'email'] + 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 && + email == o.email && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [email, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_target_type.rb b/lib/datadog_api_client/v2/models/notification_rule_target_type.rb new file mode 100644 index 000000000000..42cb40fd552d --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_target_type.rb @@ -0,0 +1,31 @@ +=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 type of notification target. + class NotificationRuleTargetType + include BaseEnumModel + + EMAIL = "EMAIL".freeze + SLACK_CHANNEL = "SLACK_CHANNEL".freeze + SLACK_USER = "SLACK_USER".freeze + WEBHOOK = "WEBHOOK".freeze + PAGERDUTY_SERVICE = "PAGERDUTY_SERVICE".freeze + MS_TEAMS_CHANNEL = "MS_TEAMS_CHANNEL".freeze + end +end