From 2ba1eee1fd74962813672bff657e6549fc8f589b Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 28 May 2026 20:23:27 +0000 Subject: [PATCH] Regenerate client from commit befca65 of spec repo --- .generator/schemas/v2/openapi.yaml | 104 ++++++++++++ ...kConvertExistingSecurityMonitoringRules.rb | 18 ++ features/scenarios_model_mapping.rb | 3 + features/v2/security_monitoring.feature | 21 +++ features/v2/undo.json | 6 + lib/datadog_api_client/inflector.rb | 4 + .../v2/api/security_monitoring_api.rb | 72 ++++++++ ...monitoring_rule_convert_bulk_attributes.rb | 130 +++++++++++++++ ...urity_monitoring_rule_convert_bulk_data.rb | 154 ++++++++++++++++++ ..._monitoring_rule_convert_bulk_data_type.rb | 26 +++ ...ty_monitoring_rule_convert_bulk_payload.rb | 123 ++++++++++++++ 11 files changed, 661 insertions(+) create mode 100644 examples/v2/security-monitoring/BulkConvertExistingSecurityMonitoringRules.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_data.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_payload.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4d59bfade193..1f6f404aa1cc 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -76194,6 +76194,53 @@ components: required: - status type: object + SecurityMonitoringRuleConvertBulkAttributes: + description: Attributes for bulk converting security monitoring rules to Terraform. + properties: + ruleIds: + description: "List of rule IDs to convert. Each rule will be included in the resulting ZIP file\nas a separate Terraform file." + example: + - def-000-u7q + - def-000-7dd + items: + description: A rule ID to include in the bulk convert. + type: string + minItems: 1 + type: array + required: + - ruleIds + type: object + SecurityMonitoringRuleConvertBulkData: + description: Data for bulk converting security monitoring rules to Terraform. + properties: + attributes: + $ref: "#/components/schemas/SecurityMonitoringRuleConvertBulkAttributes" + id: + description: Request ID. + example: convert_bulk + type: string + type: + $ref: "#/components/schemas/SecurityMonitoringRuleConvertBulkDataType" + required: + - attributes + - type + type: object + SecurityMonitoringRuleConvertBulkDataType: + description: The type of the resource. + enum: + - security_monitoring_rules_convert_bulk + example: security_monitoring_rules_convert_bulk + type: string + x-enum-varnames: + - SECURITY_MONITORING_RULES_CONVERT_BULK + SecurityMonitoringRuleConvertBulkPayload: + description: Payload for bulk converting security monitoring rules to Terraform. + properties: + data: + $ref: "#/components/schemas/SecurityMonitoringRuleConvertBulkData" + required: + - data + type: object SecurityMonitoringRuleConvertPayload: description: Convert a rule from JSON to Terraform. oneOf: @@ -153576,6 +153623,63 @@ paths: operator: OR permissions: - security_monitoring_rules_write + /api/v2/security_monitoring/rules/convert/bulk: + post: + description: |- + Convert a list of existing security monitoring rules to Terraform for the Datadog provider + resource `datadog_security_monitoring_rule`. Returns a ZIP archive containing one Terraform + file per rule. You can convert rules for the following types: + - App and API Protection + - Cloud SIEM (log detection and signal correlation) + - Workload Protection + operationId: BulkConvertExistingSecurityMonitoringRules + requestBody: + content: + "application/json": + examples: + default: + value: + data: + attributes: + ruleIds: + - def-000-u7q + - def-000-7dd + id: convert_bulk + type: security_monitoring_rules_convert_bulk + schema: + $ref: "#/components/schemas/SecurityMonitoringRuleConvertBulkPayload" + required: true + responses: + "200": + content: + application/zip: + examples: + default: + value: "" + schema: + format: binary + type: string + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_rules_read + summary: Bulk convert rules to Terraform + tags: ["Security Monitoring"] + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_rules_read /api/v2/security_monitoring/rules/test: post: description: |- diff --git a/examples/v2/security-monitoring/BulkConvertExistingSecurityMonitoringRules.rb b/examples/v2/security-monitoring/BulkConvertExistingSecurityMonitoringRules.rb new file mode 100644 index 000000000000..a34db2bb8bb3 --- /dev/null +++ b/examples/v2/security-monitoring/BulkConvertExistingSecurityMonitoringRules.rb @@ -0,0 +1,18 @@ +# Bulk convert rules to Terraform returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::SecurityMonitoringRuleConvertBulkPayload.new({ + data: DatadogAPIClient::V2::SecurityMonitoringRuleConvertBulkData.new({ + attributes: DatadogAPIClient::V2::SecurityMonitoringRuleConvertBulkAttributes.new({ + rule_ids: [ + "def-000-u7q", + "def-000-7dd", + ], + }), + id: "convert_bulk", + type: DatadogAPIClient::V2::SecurityMonitoringRuleConvertBulkDataType::SECURITY_MONITORING_RULES_CONVERT_BULK, + }), +}) +p api_instance.bulk_convert_existing_security_monitoring_rules(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index fb9b295c7eca..1016e1709a9d 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2271,6 +2271,9 @@ "v2.ConvertSecurityMonitoringRuleFromJSONToTerraform" => { "body" => "SecurityMonitoringRuleConvertPayload", }, + "v2.BulkConvertExistingSecurityMonitoringRules" => { + "body" => "SecurityMonitoringRuleConvertBulkPayload", + }, "v2.TestSecurityMonitoringRule" => { "body" => "SecurityMonitoringRuleTestRequest", }, diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index 4bafaa9bebfb..d23634826e6a 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -115,6 +115,27 @@ Feature: Security Monitoring And the response "data.attributes.insights" has item with field "resource_id" with value "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=" And the response "data.attributes.insights" has item with field "resource_id" with value "MmUzMzZkODQ2YTI3NDU0OTk4NDk3NzhkOTY5YjU2Zjh-YWJjZGI1ODI4OTYzNWM3ZmUwZTBlOWRkYTRiMGUyOGQ=" + @generated @skip @team:DataDog/k9-cloud-siem + Scenario: Bulk convert rules to Terraform returns "Bad Request" response + Given new "BulkConvertExistingSecurityMonitoringRules" request + And body with value {"data": {"attributes": {"ruleIds": ["def-000-u7q", "def-000-7dd"]}, "id": "convert_bulk", "type": "security_monitoring_rules_convert_bulk"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-siem + Scenario: Bulk convert rules to Terraform returns "Not Found" response + Given new "BulkConvertExistingSecurityMonitoringRules" request + And body with value {"data": {"attributes": {"ruleIds": ["def-000-u7q", "def-000-7dd"]}, "id": "convert_bulk", "type": "security_monitoring_rules_convert_bulk"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-cloud-siem + Scenario: Bulk convert rules to Terraform returns "OK" response + Given new "BulkConvertExistingSecurityMonitoringRules" request + And body with value {"data": {"attributes": {"ruleIds": ["def-000-u7q", "def-000-7dd"]}, "id": "convert_bulk", "type": "security_monitoring_rules_convert_bulk"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-siem Scenario: Bulk delete security monitoring rules returns "Bad Request" response Given new "BulkDeleteSecurityMonitoringRules" request diff --git a/features/v2/undo.json b/features/v2/undo.json index b6003df86834..0dadc6fa7a5a 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -6688,6 +6688,12 @@ "type": "idempotent" } }, + "BulkConvertExistingSecurityMonitoringRules": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "TestSecurityMonitoringRule": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6ed9f06191bc..fa3951bdd689 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5825,6 +5825,10 @@ def overrides "v2.security_monitoring_rule_case_action_options_flagged_ip_type" => "SecurityMonitoringRuleCaseActionOptionsFlaggedIPType", "v2.security_monitoring_rule_case_action_type" => "SecurityMonitoringRuleCaseActionType", "v2.security_monitoring_rule_case_create" => "SecurityMonitoringRuleCaseCreate", + "v2.security_monitoring_rule_convert_bulk_attributes" => "SecurityMonitoringRuleConvertBulkAttributes", + "v2.security_monitoring_rule_convert_bulk_data" => "SecurityMonitoringRuleConvertBulkData", + "v2.security_monitoring_rule_convert_bulk_data_type" => "SecurityMonitoringRuleConvertBulkDataType", + "v2.security_monitoring_rule_convert_bulk_payload" => "SecurityMonitoringRuleConvertBulkPayload", "v2.security_monitoring_rule_convert_payload" => "SecurityMonitoringRuleConvertPayload", "v2.security_monitoring_rule_convert_response" => "SecurityMonitoringRuleConvertResponse", "v2.security_monitoring_rule_create_payload" => "SecurityMonitoringRuleCreatePayload", diff --git a/lib/datadog_api_client/v2/api/security_monitoring_api.rb b/lib/datadog_api_client/v2/api/security_monitoring_api.rb index af0443c45d0b..14499c50ad99 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -311,6 +311,78 @@ def batch_get_security_monitoring_dataset_dependencies_with_http_info(body, opts return data, status_code, headers end + # Bulk convert rules to Terraform. + # + # @see #bulk_convert_existing_security_monitoring_rules_with_http_info + def bulk_convert_existing_security_monitoring_rules(body, opts = {}) + data, _status_code, _headers = bulk_convert_existing_security_monitoring_rules_with_http_info(body, opts) + data + end + + # Bulk convert rules to Terraform. + # + # Convert a list of existing security monitoring rules to Terraform for the Datadog provider + # resource `datadog_security_monitoring_rule`. Returns a ZIP archive containing one Terraform + # file per rule. You can convert rules for the following types: + # - App and API Protection + # - Cloud SIEM (log detection and signal correlation) + # - Workload Protection + # + # @param body [SecurityMonitoringRuleConvertBulkPayload] + # @param opts [Hash] the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def bulk_convert_existing_security_monitoring_rules_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.bulk_convert_existing_security_monitoring_rules ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SecurityMonitoringAPI.bulk_convert_existing_security_monitoring_rules" + end + # resource path + local_var_path = '/api/v2/security_monitoring/rules/convert/bulk' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/zip', 'application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :bulk_convert_existing_security_monitoring_rules, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#bulk_convert_existing_security_monitoring_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Bulk subscribe to sample log generation. # # @see #bulk_create_sample_log_generation_subscriptions_with_http_info diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_attributes.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_attributes.rb new file mode 100644 index 000000000000..bf4e0ffd3b1e --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_attributes.rb @@ -0,0 +1,130 @@ +=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 + # Attributes for bulk converting security monitoring rules to Terraform. + class SecurityMonitoringRuleConvertBulkAttributes + include BaseGenericModel + + # List of rule IDs to convert. Each rule will be included in the resulting ZIP file + # as a separate Terraform file. + attr_reader :rule_ids + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'rule_ids' => :'ruleIds' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'rule_ids' => :'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::SecurityMonitoringRuleConvertBulkAttributes` 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?(:'rule_ids') + if (value = attributes[:'rule_ids']).is_a?(Array) + self.rule_ids = 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 @rule_ids.nil? + return false if @rule_ids.length < 1 + true + end + + # Custom attribute writer method with validation + # @param rule_ids [Object] Object to be assigned + # @!visibility private + def rule_ids=(rule_ids) + if rule_ids.nil? + fail ArgumentError, 'invalid value for "rule_ids", rule_ids cannot be nil.' + end + if rule_ids.length < 1 + fail ArgumentError, 'invalid value for "rule_ids", number of items must be greater than or equal to 1.' + end + @rule_ids = rule_ids + 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 && + rule_ids == o.rule_ids && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [rule_ids, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_data.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_data.rb new file mode 100644 index 000000000000..6a85609246d6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_data.rb @@ -0,0 +1,154 @@ +=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 + # Data for bulk converting security monitoring rules to Terraform. + class SecurityMonitoringRuleConvertBulkData + include BaseGenericModel + + # Attributes for bulk converting security monitoring rules to Terraform. + attr_reader :attributes + + # Request ID. + attr_accessor :id + + # The type of the resource. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SecurityMonitoringRuleConvertBulkAttributes', + :'id' => :'String', + :'type' => :'SecurityMonitoringRuleConvertBulkDataType' + } + 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::SecurityMonitoringRuleConvertBulkData` 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?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + 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 @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + 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 + + # 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 && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_data_type.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_data_type.rb new file mode 100644 index 000000000000..330532fdba65 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_data_type.rb @@ -0,0 +1,26 @@ +=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 the resource. + class SecurityMonitoringRuleConvertBulkDataType + include BaseEnumModel + + SECURITY_MONITORING_RULES_CONVERT_BULK = "security_monitoring_rules_convert_bulk".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_payload.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_payload.rb new file mode 100644 index 000000000000..0fa2a4bb30e8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_convert_bulk_payload.rb @@ -0,0 +1,123 @@ +=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 + # Payload for bulk converting security monitoring rules to Terraform. + class SecurityMonitoringRuleConvertBulkPayload + include BaseGenericModel + + # Data for bulk converting security monitoring rules to Terraform. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SecurityMonitoringRuleConvertBulkData' + } + 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::SecurityMonitoringRuleConvertBulkPayload` 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?(:'data') + self.data = attributes[:'data'] + 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 @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + 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 && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end