From 04767901f1189b020fc85ce54c38ab84f02b3d5f Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Wed, 24 Mar 2021 08:26:25 +0100 Subject: [PATCH] Regenerate client from commit e5b275c of spec repo (#260) --- .apigentools-info | 8 +- .openapi-generator/FILES | 3 + data/v2/openapi.yaml | 22 ++ docs/v2/README.md | 1 + docs/v2/SecurityMonitoringRuleQuery.md | 2 + docs/v2/SecurityMonitoringRuleQueryCreate.md | 2 + docs/v2/SecurityMonitoringRuntimeAgentRule.md | 20 ++ lib/datadog_api_client/v2.rb | 1 + .../models/security_monitoring_rule_query.rb | 11 +- .../security_monitoring_rule_query_create.rb | 11 +- .../security_monitoring_runtime_agent_rule.rb | 233 ++++++++++++++++++ ...rity_monitoring_runtime_agent_rule_spec.rb | 43 ++++ 12 files changed, 351 insertions(+), 6 deletions(-) create mode 100644 docs/v2/SecurityMonitoringRuntimeAgentRule.md create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_runtime_agent_rule.rb create mode 100644 spec/v2/models/security_monitoring_runtime_agent_rule_spec.rb diff --git a/.apigentools-info b/.apigentools-info index 20c1b0b4bb5..897b632175e 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-03-23 21:29:15.200267", - "spec_repo_commit": "b654b25" + "regenerated": "2021-03-24 07:14:30.714449", + "spec_repo_commit": "e5b275c" }, "v2": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-03-23 21:29:27.892470", - "spec_repo_commit": "b654b25" + "regenerated": "2021-03-24 07:14:44.330825", + "spec_repo_commit": "e5b275c" } } } \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 4c65a1c5240..008e7edd74f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -282,6 +282,7 @@ docs/SecurityMonitoringRuleQueryCreate.md docs/SecurityMonitoringRuleResponse.md docs/SecurityMonitoringRuleSeverity.md docs/SecurityMonitoringRuleUpdatePayload.md +docs/SecurityMonitoringRuntimeAgentRule.md docs/SecurityMonitoringSignal.md docs/SecurityMonitoringSignalAttributes.md docs/SecurityMonitoringSignalListRequest.md @@ -603,6 +604,7 @@ lib/datadog_api_client/v2/models/security_monitoring_rule_query_create.rb lib/datadog_api_client/v2/models/security_monitoring_rule_response.rb lib/datadog_api_client/v2/models/security_monitoring_rule_severity.rb lib/datadog_api_client/v2/models/security_monitoring_rule_update_payload.rb +lib/datadog_api_client/v2/models/security_monitoring_runtime_agent_rule.rb lib/datadog_api_client/v2/models/security_monitoring_signal.rb lib/datadog_api_client/v2/models/security_monitoring_signal_attributes.rb lib/datadog_api_client/v2/models/security_monitoring_signal_list_request.rb @@ -921,6 +923,7 @@ spec/models/security_monitoring_rule_query_spec.rb spec/models/security_monitoring_rule_response_spec.rb spec/models/security_monitoring_rule_severity_spec.rb spec/models/security_monitoring_rule_update_payload_spec.rb +spec/models/security_monitoring_runtime_agent_rule_spec.rb spec/models/security_monitoring_signal_attributes_spec.rb spec/models/security_monitoring_signal_list_request_filter_spec.rb spec/models/security_monitoring_signal_list_request_page_spec.rb diff --git a/data/v2/openapi.yaml b/data/v2/openapi.yaml index 3a9f8157849..6fc729c3a4d 100644 --- a/data/v2/openapi.yaml +++ b/data/v2/openapi.yaml @@ -4157,6 +4157,8 @@ components: SecurityMonitoringRuleQuery: description: Query for matching rule. properties: + agentRule: + $ref: '#/components/schemas/SecurityMonitoringRuntimeAgentRule' aggregation: $ref: '#/components/schemas/SecurityMonitoringRuleQueryAggregation' distinctFields: @@ -4201,6 +4203,8 @@ components: SecurityMonitoringRuleQueryCreate: description: Query for matching rule. properties: + agentRule: + $ref: '#/components/schemas/SecurityMonitoringRuntimeAgentRule' aggregation: $ref: '#/components/schemas/SecurityMonitoringRuleQueryAggregation' distinctFields: @@ -4339,6 +4343,24 @@ components: type: string type: array type: object + SecurityMonitoringRuntimeAgentRule: + description: The Agent rule. + properties: + agentRuleId: + description: The Agent rule ID. Must be unique within the rule. + example: etc_shadow + type: string + expression: + description: 'A Runtime Security expression determines what activity should + be collected by the Datadog Agent. + + These logical expressions can use predefined operators and attributes. + Tags cannot be used in Runtime + + Security expressions. Instead, allow or deny based on tags under the advanced + option.' + type: string + type: object SecurityMonitoringSignal: description: Object description of a security signal. properties: diff --git a/docs/v2/README.md b/docs/v2/README.md index d8e60c9dc22..6ccca6eb4c9 100644 --- a/docs/v2/README.md +++ b/docs/v2/README.md @@ -445,6 +445,7 @@ Class | Method | HTTP request | Description - [DatadogAPIClient::V2::SecurityMonitoringRuleResponse](SecurityMonitoringRuleResponse.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleSeverity](SecurityMonitoringRuleSeverity.md) - [DatadogAPIClient::V2::SecurityMonitoringRuleUpdatePayload](SecurityMonitoringRuleUpdatePayload.md) + - [DatadogAPIClient::V2::SecurityMonitoringRuntimeAgentRule](SecurityMonitoringRuntimeAgentRule.md) - [DatadogAPIClient::V2::SecurityMonitoringSignal](SecurityMonitoringSignal.md) - [DatadogAPIClient::V2::SecurityMonitoringSignalAttributes](SecurityMonitoringSignalAttributes.md) - [DatadogAPIClient::V2::SecurityMonitoringSignalListRequest](SecurityMonitoringSignalListRequest.md) diff --git a/docs/v2/SecurityMonitoringRuleQuery.md b/docs/v2/SecurityMonitoringRuleQuery.md index cc4865a8dc6..f6324590537 100644 --- a/docs/v2/SecurityMonitoringRuleQuery.md +++ b/docs/v2/SecurityMonitoringRuleQuery.md @@ -4,6 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **agent_rule** | [**SecurityMonitoringRuntimeAgentRule**](SecurityMonitoringRuntimeAgentRule.md) | | [optional] | | **aggregation** | [**SecurityMonitoringRuleQueryAggregation**](SecurityMonitoringRuleQueryAggregation.md) | | [optional] | | **distinct_fields** | **Array<String>** | Field for which the cardinality is measured. Sent as an array. | [optional] | | **group_by_fields** | **Array<String>** | Fields to group by. | [optional] | @@ -17,6 +18,7 @@ require 'datadog_api_client/v2' instance = DatadogAPIClient::V2::SecurityMonitoringRuleQuery.new( + agent_rule: null, aggregation: null, distinct_fields: null, group_by_fields: null, diff --git a/docs/v2/SecurityMonitoringRuleQueryCreate.md b/docs/v2/SecurityMonitoringRuleQueryCreate.md index ebd9ccbe058..7d1411eeea9 100644 --- a/docs/v2/SecurityMonitoringRuleQueryCreate.md +++ b/docs/v2/SecurityMonitoringRuleQueryCreate.md @@ -4,6 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **agent_rule** | [**SecurityMonitoringRuntimeAgentRule**](SecurityMonitoringRuntimeAgentRule.md) | | [optional] | | **aggregation** | [**SecurityMonitoringRuleQueryAggregation**](SecurityMonitoringRuleQueryAggregation.md) | | [optional] | | **distinct_fields** | **Array<String>** | Field for which the cardinality is measured. Sent as an array. | [optional] | | **group_by_fields** | **Array<String>** | Fields to group by. | [optional] | @@ -17,6 +18,7 @@ require 'datadog_api_client/v2' instance = DatadogAPIClient::V2::SecurityMonitoringRuleQueryCreate.new( + agent_rule: null, aggregation: null, distinct_fields: null, group_by_fields: null, diff --git a/docs/v2/SecurityMonitoringRuntimeAgentRule.md b/docs/v2/SecurityMonitoringRuntimeAgentRule.md new file mode 100644 index 00000000000..360c8f724f7 --- /dev/null +++ b/docs/v2/SecurityMonitoringRuntimeAgentRule.md @@ -0,0 +1,20 @@ +# DatadogAPIClient::V2::SecurityMonitoringRuntimeAgentRule + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **agent_rule_id** | **String** | The Agent rule ID. Must be unique within the rule. | [optional] | +| **expression** | **String** | A Runtime Security expression determines what activity should be collected by the Datadog Agent. These logical expressions can use predefined operators and attributes. Tags cannot be used in Runtime Security expressions. Instead, allow or deny based on tags under the advanced option. | [optional] | + +## Example + +```ruby +require 'datadog_api_client/v2' + +instance = DatadogAPIClient::V2::SecurityMonitoringRuntimeAgentRule.new( + agent_rule_id: etc_shadow, + expression: null +) +``` + diff --git a/lib/datadog_api_client/v2.rb b/lib/datadog_api_client/v2.rb index 23c1e3f215c..22ae1486d12 100644 --- a/lib/datadog_api_client/v2.rb +++ b/lib/datadog_api_client/v2.rb @@ -289,6 +289,7 @@ require 'datadog_api_client/v2/models/security_monitoring_rule_response' require 'datadog_api_client/v2/models/security_monitoring_rule_severity' require 'datadog_api_client/v2/models/security_monitoring_rule_update_payload' +require 'datadog_api_client/v2/models/security_monitoring_runtime_agent_rule' require 'datadog_api_client/v2/models/security_monitoring_signal' require 'datadog_api_client/v2/models/security_monitoring_signal_attributes' require 'datadog_api_client/v2/models/security_monitoring_signal_list_request' diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_query.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_query.rb index 6b633db567c..aae8d5ccc17 100644 --- a/lib/datadog_api_client/v2/models/security_monitoring_rule_query.rb +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_query.rb @@ -19,6 +19,8 @@ module DatadogAPIClient::V2 # Query for matching rule. class SecurityMonitoringRuleQuery + attr_accessor :agent_rule + attr_accessor :aggregation # Field for which the cardinality is measured. Sent as an array. @@ -39,6 +41,7 @@ class SecurityMonitoringRuleQuery # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'agent_rule' => :'agentRule', :'aggregation' => :'aggregation', :'distinct_fields' => :'distinctFields', :'group_by_fields' => :'groupByFields', @@ -56,6 +59,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { + :'agent_rule' => :'SecurityMonitoringRuntimeAgentRule', :'aggregation' => :'SecurityMonitoringRuleQueryAggregation', :'distinct_fields' => :'Array', :'group_by_fields' => :'Array', @@ -86,6 +90,10 @@ def initialize(attributes = {}) h[k.to_sym] = v } + if attributes.key?(:'agent_rule') + self.agent_rule = attributes[:'agent_rule'] + end + if attributes.key?(:'aggregation') self.aggregation = attributes[:'aggregation'] end @@ -133,6 +141,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && + agent_rule == o.agent_rule && aggregation == o.aggregation && distinct_fields == o.distinct_fields && group_by_fields == o.group_by_fields && @@ -150,7 +159,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [aggregation, distinct_fields, group_by_fields, metric, name, query].hash + [agent_rule, aggregation, distinct_fields, group_by_fields, metric, name, query].hash end # Builds the object from hash diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_query_create.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_query_create.rb index 9c97dfc7250..801da9b0d93 100644 --- a/lib/datadog_api_client/v2/models/security_monitoring_rule_query_create.rb +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_query_create.rb @@ -19,6 +19,8 @@ module DatadogAPIClient::V2 # Query for matching rule. class SecurityMonitoringRuleQueryCreate + attr_accessor :agent_rule + attr_accessor :aggregation # Field for which the cardinality is measured. Sent as an array. @@ -39,6 +41,7 @@ class SecurityMonitoringRuleQueryCreate # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'agent_rule' => :'agentRule', :'aggregation' => :'aggregation', :'distinct_fields' => :'distinctFields', :'group_by_fields' => :'groupByFields', @@ -56,6 +59,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { + :'agent_rule' => :'SecurityMonitoringRuntimeAgentRule', :'aggregation' => :'SecurityMonitoringRuleQueryAggregation', :'distinct_fields' => :'Array', :'group_by_fields' => :'Array', @@ -86,6 +90,10 @@ def initialize(attributes = {}) h[k.to_sym] = v } + if attributes.key?(:'agent_rule') + self.agent_rule = attributes[:'agent_rule'] + end + if attributes.key?(:'aggregation') self.aggregation = attributes[:'aggregation'] end @@ -138,6 +146,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && + agent_rule == o.agent_rule && aggregation == o.aggregation && distinct_fields == o.distinct_fields && group_by_fields == o.group_by_fields && @@ -155,7 +164,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [aggregation, distinct_fields, group_by_fields, metric, name, query].hash + [agent_rule, aggregation, distinct_fields, group_by_fields, metric, name, query].hash end # Builds the object from hash diff --git a/lib/datadog_api_client/v2/models/security_monitoring_runtime_agent_rule.rb b/lib/datadog_api_client/v2/models/security_monitoring_runtime_agent_rule.rb new file mode 100644 index 00000000000..4a1407604b0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_runtime_agent_rule.rb @@ -0,0 +1,233 @@ +=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 + # The Agent rule. + class SecurityMonitoringRuntimeAgentRule + # The Agent rule ID. Must be unique within the rule. + attr_accessor :agent_rule_id + + # A Runtime Security expression determines what activity should be collected by the Datadog Agent. These logical expressions can use predefined operators and attributes. Tags cannot be used in Runtime Security expressions. Instead, allow or deny based on tags under the advanced option. + attr_accessor :expression + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'agent_rule_id' => :'agentRuleId', + :'expression' => :'expression' + } + 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 + { + :'agent_rule_id' => :'String', + :'expression' => :'String' + } + 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::SecurityMonitoringRuntimeAgentRule` 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::SecurityMonitoringRuntimeAgentRule`. 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?(:'agent_rule_id') + self.agent_rule_id = attributes[:'agent_rule_id'] + end + + if attributes.key?(:'expression') + self.expression = attributes[:'expression'] + 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 && + agent_rule_id == o.agent_rule_id && + expression == o.expression + 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 + [agent_rule_id, expression].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/spec/v2/models/security_monitoring_runtime_agent_rule_spec.rb b/spec/v2/models/security_monitoring_runtime_agent_rule_spec.rb new file mode 100644 index 00000000000..456f5599f87 --- /dev/null +++ b/spec/v2/models/security_monitoring_runtime_agent_rule_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::SecurityMonitoringRuntimeAgentRule +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe DatadogAPIClient::V2::SecurityMonitoringRuntimeAgentRule do + let(:instance) { DatadogAPIClient::V2::SecurityMonitoringRuntimeAgentRule.new } + + describe 'test an instance of SecurityMonitoringRuntimeAgentRule' do + it 'should create an instance of SecurityMonitoringRuntimeAgentRule' do + expect(instance).to be_instance_of(DatadogAPIClient::V2::SecurityMonitoringRuntimeAgentRule) + end + end + describe 'test attribute "agent_rule_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "expression"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end