From 7635f92f3f3669b524a186d3a8ba947301585e02 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 22 Feb 2021 09:19:56 +0000 Subject: [PATCH] Regenerate client from commit ab657a6 of spec repo --- .apigentools-info | 8 +- .openapi-generator/FILES | 12 + data/v2/openapi.yaml | 57 +++++ docs/v2/README.md | 4 + .../SecurityMonitoringRuleDetectionMethod.md | 15 ++ .../SecurityMonitoringRuleNewValueOptions.md | 20 ++ ...onitoringRuleNewValueOptionsForgetAfter.md | 15 ++ ...ringRuleNewValueOptionsLearningDuration.md | 15 ++ docs/v2/SecurityMonitoringRuleOptions.md | 6 +- lib/datadog_api_client/v2.rb | 4 + ...curity_monitoring_rule_detection_method.rb | 40 +++ ...urity_monitoring_rule_new_value_options.rb | 231 ++++++++++++++++++ ...ing_rule_new_value_options_forget_after.rb | 44 ++++ ...ule_new_value_options_learning_duration.rb | 41 ++++ .../security_monitoring_rule_options.rb | 26 +- ...urity_monitoring_rule_query_aggregation.rb | 1 + ...y_monitoring_rule_detection_method_spec.rb | 31 +++ ...ule_new_value_options_forget_after_spec.rb | 31 +++ ...ew_value_options_learning_duration_spec.rb | 31 +++ ..._monitoring_rule_new_value_options_spec.rb | 43 ++++ 20 files changed, 666 insertions(+), 9 deletions(-) create mode 100644 docs/v2/SecurityMonitoringRuleDetectionMethod.md create mode 100644 docs/v2/SecurityMonitoringRuleNewValueOptions.md create mode 100644 docs/v2/SecurityMonitoringRuleNewValueOptionsForgetAfter.md create mode 100644 docs/v2/SecurityMonitoringRuleNewValueOptionsLearningDuration.md create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_detection_method.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_forget_after.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_learning_duration.rb create mode 100644 spec/v2/models/security_monitoring_rule_detection_method_spec.rb create mode 100644 spec/v2/models/security_monitoring_rule_new_value_options_forget_after_spec.rb create mode 100644 spec/v2/models/security_monitoring_rule_new_value_options_learning_duration_spec.rb create mode 100644 spec/v2/models/security_monitoring_rule_new_value_options_spec.rb diff --git a/.apigentools-info b/.apigentools-info index 6d2c2a0a342e..e85ac0f1e3d1 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.4.1.dev2", - "regenerated": "2021-02-22 08:58:32.265871", - "spec_repo_commit": "11611e4" + "regenerated": "2021-02-22 09:19:42.085978", + "spec_repo_commit": "ab657a6" }, "v2": { "apigentools_version": "1.4.1.dev2", - "regenerated": "2021-02-22 08:58:43.236921", - "spec_repo_commit": "11611e4" + "regenerated": "2021-02-22 09:19:54.796032", + "spec_repo_commit": "ab657a6" } } } \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 6fb58dbfdadf..40ebbb482153 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -257,9 +257,13 @@ docs/SecurityMonitoringListRulesResponse.md docs/SecurityMonitoringRuleCase.md docs/SecurityMonitoringRuleCaseCreate.md docs/SecurityMonitoringRuleCreatePayload.md +docs/SecurityMonitoringRuleDetectionMethod.md docs/SecurityMonitoringRuleEvaluationWindow.md docs/SecurityMonitoringRuleKeepAlive.md docs/SecurityMonitoringRuleMaxSignalDuration.md +docs/SecurityMonitoringRuleNewValueOptions.md +docs/SecurityMonitoringRuleNewValueOptionsForgetAfter.md +docs/SecurityMonitoringRuleNewValueOptionsLearningDuration.md docs/SecurityMonitoringRuleOptions.md docs/SecurityMonitoringRuleQuery.md docs/SecurityMonitoringRuleQueryAggregation.md @@ -563,9 +567,13 @@ lib/datadog_api_client/v2/models/security_monitoring_list_rules_response.rb lib/datadog_api_client/v2/models/security_monitoring_rule_case.rb lib/datadog_api_client/v2/models/security_monitoring_rule_case_create.rb lib/datadog_api_client/v2/models/security_monitoring_rule_create_payload.rb +lib/datadog_api_client/v2/models/security_monitoring_rule_detection_method.rb lib/datadog_api_client/v2/models/security_monitoring_rule_evaluation_window.rb lib/datadog_api_client/v2/models/security_monitoring_rule_keep_alive.rb lib/datadog_api_client/v2/models/security_monitoring_rule_max_signal_duration.rb +lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options.rb +lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_forget_after.rb +lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_learning_duration.rb lib/datadog_api_client/v2/models/security_monitoring_rule_options.rb lib/datadog_api_client/v2/models/security_monitoring_rule_query.rb lib/datadog_api_client/v2/models/security_monitoring_rule_query_aggregation.rb @@ -866,9 +874,13 @@ spec/models/security_monitoring_list_rules_response_spec.rb spec/models/security_monitoring_rule_case_create_spec.rb spec/models/security_monitoring_rule_case_spec.rb spec/models/security_monitoring_rule_create_payload_spec.rb +spec/models/security_monitoring_rule_detection_method_spec.rb spec/models/security_monitoring_rule_evaluation_window_spec.rb spec/models/security_monitoring_rule_keep_alive_spec.rb spec/models/security_monitoring_rule_max_signal_duration_spec.rb +spec/models/security_monitoring_rule_new_value_options_forget_after_spec.rb +spec/models/security_monitoring_rule_new_value_options_learning_duration_spec.rb +spec/models/security_monitoring_rule_new_value_options_spec.rb spec/models/security_monitoring_rule_options_spec.rb spec/models/security_monitoring_rule_query_aggregation_spec.rb spec/models/security_monitoring_rule_query_create_spec.rb diff --git a/data/v2/openapi.yaml b/data/v2/openapi.yaml index 6e10a5602602..436488cc41c2 100644 --- a/data/v2/openapi.yaml +++ b/data/v2/openapi.yaml @@ -3899,6 +3899,15 @@ components: - cases - message type: object + SecurityMonitoringRuleDetectionMethod: + description: The detection method. + enum: + - threshold + - new_value + type: string + x-enum-varnames: + - THRESHOLD + - NEW_VALUE SecurityMonitoringRuleEvaluationWindow: description: 'A time window is specified to match when at least one of the cases matches true. This is a sliding window @@ -3983,15 +3992,61 @@ components: - SIX_HOURS - TWELVE_HOURS - ONE_DAY + SecurityMonitoringRuleNewValueOptions: + description: Options on new value rules. + properties: + forgetAfter: + $ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsForgetAfter' + learningDuration: + $ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsLearningDuration' + type: object + SecurityMonitoringRuleNewValueOptionsForgetAfter: + description: The duration in days after which a learned value is forgotten. + enum: + - 1 + - 2 + - 7 + - 14 + - 21 + - 28 + format: int32 + type: integer + x-enum-varnames: + - ONE_DAY + - TWO_DAYS + - ONE_WEEK + - TWO_WEEKS + - THREE_WEEKS + - FOUR_WEEKS + SecurityMonitoringRuleNewValueOptionsLearningDuration: + description: 'The duration in days during which values are learned, and after + which signals will be generated for values that + + weren''t learned. If set to 0, a signal will be generated for all new values + after the first value is learned.' + enum: + - 0 + - 1 + - 7 + format: int32 + type: integer + x-enum-varnames: + - ZERO_DAYS + - ONE_DAY + - SEVEN_DAYS SecurityMonitoringRuleOptions: description: Options on rules. properties: + detectionMethod: + $ref: '#/components/schemas/SecurityMonitoringRuleDetectionMethod' evaluationWindow: $ref: '#/components/schemas/SecurityMonitoringRuleEvaluationWindow' keepAlive: $ref: '#/components/schemas/SecurityMonitoringRuleKeepAlive' maxSignalDuration: $ref: '#/components/schemas/SecurityMonitoringRuleMaxSignalDuration' + newValueOptions: + $ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptions' type: object SecurityMonitoringRuleQuery: description: Query for matching rule. @@ -4029,12 +4084,14 @@ components: - cardinality - sum - max + - new_value type: string x-enum-varnames: - COUNT - CARDINALITY - SUM - MAX + - NEW_VALUE SecurityMonitoringRuleQueryCreate: description: Query for matching rule. properties: diff --git a/docs/v2/README.md b/docs/v2/README.md index 864fff314cc8..6c73dc219444 100644 --- a/docs/v2/README.md +++ b/docs/v2/README.md @@ -418,9 +418,13 @@ Class | Method | HTTP request | Description - [DatadogAPIClient::V2::SecurityMonitoringRuleCase](SecurityMonitoringRuleCase.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleCaseCreate](SecurityMonitoringRuleCaseCreate.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleCreatePayload](SecurityMonitoringRuleCreatePayload.md) + - [DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod](SecurityMonitoringRuleDetectionMethod.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleEvaluationWindow](SecurityMonitoringRuleEvaluationWindow.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleKeepAlive](SecurityMonitoringRuleKeepAlive.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleMaxSignalDuration](SecurityMonitoringRuleMaxSignalDuration.md) + - [DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions](SecurityMonitoringRuleNewValueOptions.md) + - [DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsForgetAfter](SecurityMonitoringRuleNewValueOptionsForgetAfter.md) + - [DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningDuration](SecurityMonitoringRuleNewValueOptionsLearningDuration.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleOptions](SecurityMonitoringRuleOptions.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleQuery](SecurityMonitoringRuleQuery.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleQueryAggregation](SecurityMonitoringRuleQueryAggregation.md) diff --git a/docs/v2/SecurityMonitoringRuleDetectionMethod.md b/docs/v2/SecurityMonitoringRuleDetectionMethod.md new file mode 100644 index 000000000000..613c54d346e6 --- /dev/null +++ b/docs/v2/SecurityMonitoringRuleDetectionMethod.md @@ -0,0 +1,15 @@ +# DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod.new() +``` + diff --git a/docs/v2/SecurityMonitoringRuleNewValueOptions.md b/docs/v2/SecurityMonitoringRuleNewValueOptions.md new file mode 100644 index 000000000000..752a5f0a4ce9 --- /dev/null +++ b/docs/v2/SecurityMonitoringRuleNewValueOptions.md @@ -0,0 +1,20 @@ +# DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **forget_after** | [**SecurityMonitoringRuleNewValueOptionsForgetAfter**](SecurityMonitoringRuleNewValueOptionsForgetAfter.md) | | [optional] | +| **learning_duration** | [**SecurityMonitoringRuleNewValueOptionsLearningDuration**](SecurityMonitoringRuleNewValueOptionsLearningDuration.md) | | [optional] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions.new( + forget_after: null, + learning_duration: null +) +``` + diff --git a/docs/v2/SecurityMonitoringRuleNewValueOptionsForgetAfter.md b/docs/v2/SecurityMonitoringRuleNewValueOptionsForgetAfter.md new file mode 100644 index 000000000000..bf66243dcf16 --- /dev/null +++ b/docs/v2/SecurityMonitoringRuleNewValueOptionsForgetAfter.md @@ -0,0 +1,15 @@ +# DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsForgetAfter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsForgetAfter.new() +``` + diff --git a/docs/v2/SecurityMonitoringRuleNewValueOptionsLearningDuration.md b/docs/v2/SecurityMonitoringRuleNewValueOptionsLearningDuration.md new file mode 100644 index 000000000000..0e2db22deb7b --- /dev/null +++ b/docs/v2/SecurityMonitoringRuleNewValueOptionsLearningDuration.md @@ -0,0 +1,15 @@ +# DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningDuration + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningDuration.new() +``` + diff --git a/docs/v2/SecurityMonitoringRuleOptions.md b/docs/v2/SecurityMonitoringRuleOptions.md index 68ee4a3c72f9..6681cce32622 100644 --- a/docs/v2/SecurityMonitoringRuleOptions.md +++ b/docs/v2/SecurityMonitoringRuleOptions.md @@ -4,9 +4,11 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **detection_method** | [**SecurityMonitoringRuleDetectionMethod**](SecurityMonitoringRuleDetectionMethod.md) | | [optional] | | **evaluation_window** | [**SecurityMonitoringRuleEvaluationWindow**](SecurityMonitoringRuleEvaluationWindow.md) | | [optional] | | **keep_alive** | [**SecurityMonitoringRuleKeepAlive**](SecurityMonitoringRuleKeepAlive.md) | | [optional] | | **max_signal_duration** | [**SecurityMonitoringRuleMaxSignalDuration**](SecurityMonitoringRuleMaxSignalDuration.md) | | [optional] | +| **new_value_options** | [**SecurityMonitoringRuleNewValueOptions**](SecurityMonitoringRuleNewValueOptions.md) | | [optional] | ## Example @@ -14,9 +16,11 @@ require 'datadog_api_client/v2' instance = DatadogAPIClient::V2::SecurityMonitoringRuleOptions.new( + detection_method: null, evaluation_window: null, keep_alive: null, - max_signal_duration: null + max_signal_duration: null, + new_value_options: null ) ``` diff --git a/lib/datadog_api_client/v2.rb b/lib/datadog_api_client/v2.rb index bb510d43db99..3637efbea247 100644 --- a/lib/datadog_api_client/v2.rb +++ b/lib/datadog_api_client/v2.rb @@ -264,9 +264,13 @@ require 'datadog_api_client/v2/models/security_monitoring_rule_case' require 'datadog_api_client/v2/models/security_monitoring_rule_case_create' require 'datadog_api_client/v2/models/security_monitoring_rule_create_payload' +require 'datadog_api_client/v2/models/security_monitoring_rule_detection_method' require 'datadog_api_client/v2/models/security_monitoring_rule_evaluation_window' require 'datadog_api_client/v2/models/security_monitoring_rule_keep_alive' require 'datadog_api_client/v2/models/security_monitoring_rule_max_signal_duration' +require 'datadog_api_client/v2/models/security_monitoring_rule_new_value_options' +require 'datadog_api_client/v2/models/security_monitoring_rule_new_value_options_forget_after' +require 'datadog_api_client/v2/models/security_monitoring_rule_new_value_options_learning_duration' require 'datadog_api_client/v2/models/security_monitoring_rule_options' require 'datadog_api_client/v2/models/security_monitoring_rule_query' require 'datadog_api_client/v2/models/security_monitoring_rule_query_aggregation' diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_detection_method.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_detection_method.rb new file mode 100644 index 000000000000..586f1661dbde --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_detection_method.rb @@ -0,0 +1,40 @@ +=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://openapi-generator.tech + + 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 + class SecurityMonitoringRuleDetectionMethod + THRESHOLD = "threshold".freeze + NEW_VALUE = "new_value".freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = SecurityMonitoringRuleDetectionMethod.constants.select { |c| SecurityMonitoringRuleDetectionMethod::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #SecurityMonitoringRuleDetectionMethod" if constantValues.empty? + value + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options.rb new file mode 100644 index 000000000000..53bdfb0cbeba --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options.rb @@ -0,0 +1,231 @@ +=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://openapi-generator.tech + + 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 + # Options on new value rules. + class SecurityMonitoringRuleNewValueOptions + attr_accessor :forget_after + + attr_accessor :learning_duration + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'forget_after' => :'forgetAfter', + :'learning_duration' => :'learningDuration' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'forget_after' => :'SecurityMonitoringRuleNewValueOptionsForgetAfter', + :'learning_duration' => :'SecurityMonitoringRuleNewValueOptionsLearningDuration' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'forget_after') + self.forget_after = attributes[:'forget_after'] + end + + if attributes.key?(:'learning_duration') + self.learning_duration = attributes[:'learning_duration'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + forget_after == o.forget_after && + learning_duration == o.learning_duration + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [forget_after, learning_duration].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = DatadogAPIClient::V2.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + 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 + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_forget_after.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_forget_after.rb new file mode 100644 index 000000000000..9623e6fc45bc --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_forget_after.rb @@ -0,0 +1,44 @@ +=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://openapi-generator.tech + + 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 + class SecurityMonitoringRuleNewValueOptionsForgetAfter + ONE_DAY = 1.freeze + TWO_DAYS = 2.freeze + ONE_WEEK = 7.freeze + TWO_WEEKS = 14.freeze + THREE_WEEKS = 21.freeze + FOUR_WEEKS = 28.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = SecurityMonitoringRuleNewValueOptionsForgetAfter.constants.select { |c| SecurityMonitoringRuleNewValueOptionsForgetAfter::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #SecurityMonitoringRuleNewValueOptionsForgetAfter" if constantValues.empty? + value + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_learning_duration.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_learning_duration.rb new file mode 100644 index 000000000000..a1998ded0d1a --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_new_value_options_learning_duration.rb @@ -0,0 +1,41 @@ +=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://openapi-generator.tech + + 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 + class SecurityMonitoringRuleNewValueOptionsLearningDuration + ZERO_DAYS = 0.freeze + ONE_DAY = 1.freeze + SEVEN_DAYS = 7.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = SecurityMonitoringRuleNewValueOptionsLearningDuration.constants.select { |c| SecurityMonitoringRuleNewValueOptionsLearningDuration::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #SecurityMonitoringRuleNewValueOptionsLearningDuration" if constantValues.empty? + value + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_options.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_options.rb index e49fe393c572..2b880d78edd6 100644 --- a/lib/datadog_api_client/v2/models/security_monitoring_rule_options.rb +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_options.rb @@ -19,18 +19,24 @@ module DatadogAPIClient::V2 # Options on rules. class SecurityMonitoringRuleOptions + attr_accessor :detection_method + attr_accessor :evaluation_window attr_accessor :keep_alive attr_accessor :max_signal_duration + attr_accessor :new_value_options + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'detection_method' => :'detectionMethod', :'evaluation_window' => :'evaluationWindow', :'keep_alive' => :'keepAlive', - :'max_signal_duration' => :'maxSignalDuration' + :'max_signal_duration' => :'maxSignalDuration', + :'new_value_options' => :'newValueOptions' } end @@ -42,9 +48,11 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { + :'detection_method' => :'SecurityMonitoringRuleDetectionMethod', :'evaluation_window' => :'SecurityMonitoringRuleEvaluationWindow', :'keep_alive' => :'SecurityMonitoringRuleKeepAlive', - :'max_signal_duration' => :'SecurityMonitoringRuleMaxSignalDuration' + :'max_signal_duration' => :'SecurityMonitoringRuleMaxSignalDuration', + :'new_value_options' => :'SecurityMonitoringRuleNewValueOptions' } end @@ -69,6 +77,10 @@ def initialize(attributes = {}) h[k.to_sym] = v } + if attributes.key?(:'detection_method') + self.detection_method = attributes[:'detection_method'] + end + if attributes.key?(:'evaluation_window') self.evaluation_window = attributes[:'evaluation_window'] end @@ -80,6 +92,10 @@ def initialize(attributes = {}) if attributes.key?(:'max_signal_duration') self.max_signal_duration = attributes[:'max_signal_duration'] end + + if attributes.key?(:'new_value_options') + self.new_value_options = attributes[:'new_value_options'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -100,9 +116,11 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && + detection_method == o.detection_method && evaluation_window == o.evaluation_window && keep_alive == o.keep_alive && - max_signal_duration == o.max_signal_duration + max_signal_duration == o.max_signal_duration && + new_value_options == o.new_value_options end # @see the `==` method @@ -114,7 +132,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [evaluation_window, keep_alive, max_signal_duration].hash + [detection_method, evaluation_window, keep_alive, max_signal_duration, new_value_options].hash end # Builds the object from hash diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_query_aggregation.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_query_aggregation.rb index a342f719abec..a6b3dafeada0 100644 --- a/lib/datadog_api_client/v2/models/security_monitoring_rule_query_aggregation.rb +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_query_aggregation.rb @@ -22,6 +22,7 @@ class SecurityMonitoringRuleQueryAggregation CARDINALITY = "cardinality".freeze SUM = "sum".freeze MAX = "max".freeze + NEW_VALUE = "new_value".freeze # Builds the enum from string # @param [String] The enum value in the form of the string diff --git a/spec/v2/models/security_monitoring_rule_detection_method_spec.rb b/spec/v2/models/security_monitoring_rule_detection_method_spec.rb new file mode 100644 index 000000000000..30405d4aa113 --- /dev/null +++ b/spec/v2/models/security_monitoring_rule_detection_method_spec.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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod do + let(:instance) { DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod.new } + + describe 'test an instance of SecurityMonitoringRuleDetectionMethod' do + it 'should create an instance of SecurityMonitoringRuleDetectionMethod' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::SecurityMonitoringRuleDetectionMethod) + end + end +end diff --git a/spec/v2/models/security_monitoring_rule_new_value_options_forget_after_spec.rb b/spec/v2/models/security_monitoring_rule_new_value_options_forget_after_spec.rb new file mode 100644 index 000000000000..ee80efba23e4 --- /dev/null +++ b/spec/v2/models/security_monitoring_rule_new_value_options_forget_after_spec.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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsForgetAfter +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsForgetAfter do + let(:instance) { DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsForgetAfter.new } + + describe 'test an instance of SecurityMonitoringRuleNewValueOptionsForgetAfter' do + it 'should create an instance of SecurityMonitoringRuleNewValueOptionsForgetAfter' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsForgetAfter) + end + end +end diff --git a/spec/v2/models/security_monitoring_rule_new_value_options_learning_duration_spec.rb b/spec/v2/models/security_monitoring_rule_new_value_options_learning_duration_spec.rb new file mode 100644 index 000000000000..cfb3c6126900 --- /dev/null +++ b/spec/v2/models/security_monitoring_rule_new_value_options_learning_duration_spec.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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningDuration +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningDuration do + let(:instance) { DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningDuration.new } + + describe 'test an instance of SecurityMonitoringRuleNewValueOptionsLearningDuration' do + it 'should create an instance of SecurityMonitoringRuleNewValueOptionsLearningDuration' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptionsLearningDuration) + end + end +end diff --git a/spec/v2/models/security_monitoring_rule_new_value_options_spec.rb b/spec/v2/models/security_monitoring_rule_new_value_options_spec.rb new file mode 100644 index 000000000000..184f7e5f2f39 --- /dev/null +++ b/spec/v2/models/security_monitoring_rule_new_value_options_spec.rb @@ -0,0 +1,43 @@ +=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://openapi-generator.tech + + 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 'spec_helper' +require 'json' +require 'date' + +# Unit tests for DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions do + let(:instance) { DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions.new } + + describe 'test an instance of SecurityMonitoringRuleNewValueOptions' do + it 'should create an instance of SecurityMonitoringRuleNewValueOptions' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::SecurityMonitoringRuleNewValueOptions) + end + end + describe 'test attribute "forget_after"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "learning_duration"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end