diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb715496a..526df34c7132 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23526,6 +23526,30 @@ components: required: - data type: object + GetSuppressionVersionHistoryData: + description: Data for the suppression version history. + properties: + attributes: + $ref: '#/components/schemas/SuppressionVersionHistory' + id: + description: ID of the suppression. + type: string + type: + $ref: '#/components/schemas/GetSuppressionVersionHistoryDataType' + type: object + GetSuppressionVersionHistoryDataType: + description: Type of data. + enum: + - suppression_version_history + type: string + x-enum-varnames: + - SUPPRESSIONVERSIONHISTORY + GetSuppressionVersionHistoryResponse: + description: Response for getting the suppression version history. + properties: + data: + $ref: '#/components/schemas/GetSuppressionVersionHistoryData' + type: object GetTeamMembershipsSort: description: Specifies the order of returned team memberships enum: @@ -42745,38 +42769,13 @@ components: description: The `RuleVersionHistory` `data`. type: object type: object - RuleVersionUpdate: - description: A change in a rule version. - properties: - change: - description: The new value of the field. - example: cloud_provider:aws - type: string - field: - description: The field that was changed. - example: Tags - type: string - type: - $ref: '#/components/schemas/RuleVersionUpdateType' - type: object - RuleVersionUpdateType: - description: The type of change. - enum: - - create - - update - - delete - type: string - x-enum-varnames: - - CREATE - - UPDATE - - DELETE RuleVersions: description: A rule version with a list of updates. properties: changes: description: A list of changes. items: - $ref: '#/components/schemas/RuleVersionUpdate' + $ref: '#/components/schemas/VersionHistoryUpdate' type: array rule: $ref: '#/components/schemas/SecurityMonitoringRuleResponse' @@ -51322,6 +51321,32 @@ components: format: double type: number type: object + SuppressionVersionHistory: + description: Response object containing the version history of a suppression. + properties: + count: + description: The number of suppression versions. + format: int32 + maximum: 2147483647 + type: integer + data: + additionalProperties: + $ref: '#/components/schemas/SuppressionVersions' + description: A suppression version with a list of updates. + description: The version history of a suppression. + type: object + type: object + SuppressionVersions: + description: A suppression version with a list of updates. + properties: + changes: + description: A list of changes. + items: + $ref: '#/components/schemas/VersionHistoryUpdate' + type: array + suppression: + $ref: '#/components/schemas/SecurityMonitoringSuppressionAttributes' + type: object TableResultV2: description: A reference table resource containing its full configuration and state. @@ -55372,6 +55397,31 @@ components: example: 1 format: int64 type: integer + VersionHistoryUpdate: + description: A change in a rule version. + properties: + change: + description: The new value of the field. + example: cloud_provider:aws + type: string + field: + description: The field that was changed. + example: Tags + type: string + type: + $ref: '#/components/schemas/VersionHistoryUpdateType' + type: object + VersionHistoryUpdateType: + description: The type of change. + enum: + - create + - update + - delete + type: string + x-enum-varnames: + - CREATE + - UPDATE + - DELETE VirusTotalAPIKey: description: The definition of the `VirusTotalAPIKey` object. properties: @@ -79065,6 +79115,35 @@ paths: summary: Update a suppression rule tags: - Security Monitoring + /api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history: + get: + description: Get a suppression's version history. + operationId: GetSuppressionVersionHistory + parameters: + - $ref: '#/components/parameters/SecurityMonitoringSuppressionID' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetSuppressionVersionHistoryResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_suppressions_read + summary: Get a suppression's version history + tags: + - Security Monitoring /api/v2/security_monitoring/rules: get: description: List rules. diff --git a/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-Not-Found-response.frozen b/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..24bfeae8d402 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-11-26T13:33:06.081Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-Not-Found-response.yml b/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-Not-Found-response.yml new file mode 100644 index 000000000000..b47fae6320e9 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Wed, 26 Nov 2025 13:33:06 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/this-does-not-exist/version_history + response: + body: + encoding: UTF-8 + string: '{"errors":["not_found(Suppression with ID this-does-not-exist not found)"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-OK-response.frozen b/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-OK-response.frozen new file mode 100644 index 000000000000..d0d5ccec313b --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-11-26T13:33:06.482Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-OK-response.yml b/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-OK-response.yml new file mode 100644 index 000000000000..84c317daea05 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Get-a-suppression-s-version-history-returns-OK-response.yml @@ -0,0 +1,58 @@ +http_interactions: +- recorded_at: Wed, 26 Nov 2025 13:33:06 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"description":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","enabled":true,"name":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","rule_query":"source:cloudtrail","suppression_query":"env:test","tags":["technique:T1110-brute-force","source:cloudtrail"]},"type":"suppressions"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"456-piv-74h","type":"suppressions","attributes":{"creation_date":1764163986851,"creator":{"handle":"frog@datadoghq.com","name":"frog"},"data_exclusion_query":"","description":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","editable":true,"enabled":true,"name":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","rule_query":"source:cloudtrail","suppression_query":"env:test","tags":["source:cloudtrail","technique:T1110-brute-force"],"update_date":1764163986851,"updater":{"handle":"frog@datadoghq.com","name":"frog"},"version":1}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 26 Nov 2025 13:33:06 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/456-piv-74h/version_history + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"456-piv-74h","type":"suppression_version_history","attributes":{"count":1,"data":{"1":{"suppression":{"id":"456-piv-74h","name":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","enabled":true,"description":"Test-Get_a_suppression_s_version_history_returns_OK_response-1764163986","rule_query":"source:cloudtrail","suppression_query":"env:test","data_exclusion_query":"","version":1,"creator":{"handle":"frog@datadoghq.com","name":"frog"},"updater":{"handle":"frog@datadoghq.com","name":"frog"},"creation_date":1764163986851,"update_date":1764163986851,"editable":true,"tags":["source:cloudtrail","technique:T1110-brute-force"]},"changes":[]}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 26 Nov 2025 13:33:06 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/456-piv-74h + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/security-monitoring/GetSuppressionVersionHistory.rb b/examples/v2/security-monitoring/GetSuppressionVersionHistory.rb new file mode 100644 index 000000000000..ffd45c6fa65f --- /dev/null +++ b/examples/v2/security-monitoring/GetSuppressionVersionHistory.rb @@ -0,0 +1,8 @@ +# Get a suppression's version history returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +# there is a valid "suppression" in the system +SUPPRESSION_DATA_ID = ENV["SUPPRESSION_DATA_ID"] +p api_instance.get_suppression_version_history(SUPPRESSION_DATA_ID) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 15e1897d6c51..85aa3608ad23 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1523,6 +1523,11 @@ "suppression_id" => "String", "body" => "SecurityMonitoringSuppressionUpdateRequest", }, + "v2.GetSuppressionVersionHistory" => { + "suppression_id" => "String", + "page_size" => "Integer", + "page_number" => "Integer", + }, "v2.ListSecurityMonitoringRules" => { "page_size" => "Integer", "page_number" => "Integer", diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index 531c84c19c11..578e8d28e541 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -833,6 +833,21 @@ Feature: Security Monitoring And the response "data.attributes.rule_query" has the same value as "suppression.data.attributes.rule_query" And the response "data.attributes.suppression_query" is equal to "env:test" + @team:DataDog/k9-cloud-security-platform + Scenario: Get a suppression's version history returns "Not Found" response + Given new "GetSuppressionVersionHistory" request + And request contains "suppression_id" parameter with value "this-does-not-exist" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-cloud-security-platform + Scenario: Get a suppression's version history returns "OK" response + Given new "GetSuppressionVersionHistory" request + And there is a valid "suppression" in the system + And request contains "suppression_id" parameter from "suppression.data.id" + When the request is sent + Then the response status is 200 OK + @team:DataDog/k9-cloud-security-platform Scenario: Get all security filters returns "OK" response Given new "ListSecurityFilters" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 3799e64e630d..67b48870c47c 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -3830,6 +3830,12 @@ "type": "idempotent" } }, + "GetSuppressionVersionHistory": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListSecurityMonitoringRules": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 427fdcf8659c..939e2aad840e 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2366,6 +2366,9 @@ def overrides "v2.get_rule_version_history_data_type" => "GetRuleVersionHistoryDataType", "v2.get_rule_version_history_response" => "GetRuleVersionHistoryResponse", "v2.get_sbom_response" => "GetSBOMResponse", + "v2.get_suppression_version_history_data" => "GetSuppressionVersionHistoryData", + "v2.get_suppression_version_history_data_type" => "GetSuppressionVersionHistoryDataType", + "v2.get_suppression_version_history_response" => "GetSuppressionVersionHistoryResponse", "v2.get_team_memberships_sort" => "GetTeamMembershipsSort", "v2.get_workflow_response" => "GetWorkflowResponse", "v2.github_webhook_trigger" => "GithubWebhookTrigger", @@ -3621,8 +3624,6 @@ def overrides "v2.rule_user" => "RuleUser", "v2.rule_version_history" => "RuleVersionHistory", "v2.rule_versions" => "RuleVersions", - "v2.rule_version_update" => "RuleVersionUpdate", - "v2.rule_version_update_type" => "RuleVersionUpdateType", "v2.rum_aggregate_bucket_value" => "RUMAggregateBucketValue", "v2.rum_aggregate_bucket_value_timeseries_point" => "RUMAggregateBucketValueTimeseriesPoint", "v2.rum_aggregate_request" => "RUMAggregateRequest", @@ -4179,6 +4180,8 @@ def overrides "v2.step" => "Step", "v2.step_display" => "StepDisplay", "v2.step_display_bounds" => "StepDisplayBounds", + "v2.suppression_version_history" => "SuppressionVersionHistory", + "v2.suppression_versions" => "SuppressionVersions", "v2.table_result_v2" => "TableResultV2", "v2.table_result_v2_array" => "TableResultV2Array", "v2.table_result_v2_data" => "TableResultV2Data", @@ -4448,6 +4451,8 @@ def overrides "v2.validation_error" => "ValidationError", "v2.validation_error_meta" => "ValidationErrorMeta", "v2.validation_response" => "ValidationResponse", + "v2.version_history_update" => "VersionHistoryUpdate", + "v2.version_history_update_type" => "VersionHistoryUpdateType", "v2.virus_total_api_key" => "VirusTotalAPIKey", "v2.virus_total_api_key_type" => "VirusTotalAPIKeyType", "v2.virus_total_api_key_update" => "VirusTotalAPIKeyUpdate", 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 0a17ce5a0c60..b94763afb292 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -2522,6 +2522,75 @@ def get_suppressions_affecting_rule_with_http_info(rule_id, opts = {}) return data, status_code, headers end + # Get a suppression's version history. + # + # @see #get_suppression_version_history_with_http_info + def get_suppression_version_history(suppression_id, opts = {}) + data, _status_code, _headers = get_suppression_version_history_with_http_info(suppression_id, opts) + data + end + + # Get a suppression's version history. + # + # Get a suppression's version history. + # + # @param suppression_id [String] The ID of the suppression rule + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_size Size for a given page. The maximum allowed value is 100. + # @option opts [Integer] :page_number Specific page number to return. + # @return [Array<(GetSuppressionVersionHistoryResponse, Integer, Hash)>] GetSuppressionVersionHistoryResponse data, response status code and response headers + def get_suppression_version_history_with_http_info(suppression_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.get_suppression_version_history ...' + end + # verify the required parameter 'suppression_id' is set + if @api_client.config.client_side_validation && suppression_id.nil? + fail ArgumentError, "Missing the required parameter 'suppression_id' when calling SecurityMonitoringAPI.get_suppression_version_history" + end + # resource path + local_var_path = '/api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history'.sub('{suppression_id}', CGI.escape(suppression_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? + query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetSuppressionVersionHistoryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_suppression_version_history, + :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::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#get_suppression_version_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a job's details. # # @see #get_threat_hunting_job_with_http_info diff --git a/lib/datadog_api_client/v2/models/get_suppression_version_history_data.rb b/lib/datadog_api_client/v2/models/get_suppression_version_history_data.rb new file mode 100644 index 000000000000..f9ea2d284621 --- /dev/null +++ b/lib/datadog_api_client/v2/models/get_suppression_version_history_data.rb @@ -0,0 +1,125 @@ +=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 the suppression version history. + class GetSuppressionVersionHistoryData + include BaseGenericModel + + # Response object containing the version history of a suppression. + attr_accessor :attributes + + # ID of the suppression. + attr_accessor :id + + # Type of data. + attr_accessor :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' => :'SuppressionVersionHistory', + :'id' => :'String', + :'type' => :'GetSuppressionVersionHistoryDataType' + } + 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::GetSuppressionVersionHistoryData` 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 + + # 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/get_suppression_version_history_data_type.rb b/lib/datadog_api_client/v2/models/get_suppression_version_history_data_type.rb new file mode 100644 index 000000000000..e59004061891 --- /dev/null +++ b/lib/datadog_api_client/v2/models/get_suppression_version_history_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 + # Type of data. + class GetSuppressionVersionHistoryDataType + include BaseEnumModel + + SUPPRESSIONVERSIONHISTORY = "suppression_version_history".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/get_suppression_version_history_response.rb b/lib/datadog_api_client/v2/models/get_suppression_version_history_response.rb new file mode 100644 index 000000000000..8546c6e8e051 --- /dev/null +++ b/lib/datadog_api_client/v2/models/get_suppression_version_history_response.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 + # Response for getting the suppression version history. + class GetSuppressionVersionHistoryResponse + include BaseGenericModel + + # Data for the suppression version history. + attr_accessor :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' => :'GetSuppressionVersionHistoryData' + } + 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::GetSuppressionVersionHistoryResponse` 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 + + # 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 diff --git a/lib/datadog_api_client/v2/models/rule_versions.rb b/lib/datadog_api_client/v2/models/rule_versions.rb index c6386c89a111..6c41bd976946 100644 --- a/lib/datadog_api_client/v2/models/rule_versions.rb +++ b/lib/datadog_api_client/v2/models/rule_versions.rb @@ -42,7 +42,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'changes' => :'Array', + :'changes' => :'Array', :'rule' => :'SecurityMonitoringRuleResponse' } end diff --git a/lib/datadog_api_client/v2/models/suppression_version_history.rb b/lib/datadog_api_client/v2/models/suppression_version_history.rb new file mode 100644 index 000000000000..c79ace9a70b1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/suppression_version_history.rb @@ -0,0 +1,133 @@ +=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 + # Response object containing the version history of a suppression. + class SuppressionVersionHistory + include BaseGenericModel + + # The number of suppression versions. + attr_reader :count + + # The version history of a suppression. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'count' => :'count', + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'count' => :'Integer', + :'data' => :'Hash' + } + 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::SuppressionVersionHistory` 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?(:'count') + self.count = attributes[:'count'] + 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 !@count.nil? && @count > 2147483647 + true + end + + # Custom attribute writer method with validation + # @param count [Object] Object to be assigned + # @!visibility private + def count=(count) + if !count.nil? && count > 2147483647 + fail ArgumentError, 'invalid value for "count", must be smaller than or equal to 2147483647.' + end + @count = count + 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 && + count == o.count && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [count, data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/suppression_versions.rb b/lib/datadog_api_client/v2/models/suppression_versions.rb new file mode 100644 index 000000000000..812c3d9aa93b --- /dev/null +++ b/lib/datadog_api_client/v2/models/suppression_versions.rb @@ -0,0 +1,117 @@ +=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 suppression version with a list of updates. + class SuppressionVersions + include BaseGenericModel + + # A list of changes. + attr_accessor :changes + + # The attributes of the suppression rule. + attr_accessor :suppression + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'changes' => :'changes', + :'suppression' => :'suppression' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'changes' => :'Array', + :'suppression' => :'SecurityMonitoringSuppressionAttributes' + } + 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::SuppressionVersions` 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?(:'changes') + if (value = attributes[:'changes']).is_a?(Array) + self.changes = value + end + end + + if attributes.key?(:'suppression') + self.suppression = attributes[:'suppression'] + 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 && + changes == o.changes && + suppression == o.suppression && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [changes, suppression, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rule_version_update.rb b/lib/datadog_api_client/v2/models/version_history_update.rb similarity index 95% rename from lib/datadog_api_client/v2/models/rule_version_update.rb rename to lib/datadog_api_client/v2/models/version_history_update.rb index 5ab6a7ce5b35..ed2abcba8c34 100644 --- a/lib/datadog_api_client/v2/models/rule_version_update.rb +++ b/lib/datadog_api_client/v2/models/version_history_update.rb @@ -18,7 +18,7 @@ module DatadogAPIClient::V2 # A change in a rule version. - class RuleVersionUpdate + class VersionHistoryUpdate include BaseGenericModel # The new value of the field. @@ -48,7 +48,7 @@ def self.openapi_types { :'change' => :'String', :'field' => :'String', - :'type' => :'RuleVersionUpdateType' + :'type' => :'VersionHistoryUpdateType' } end @@ -57,7 +57,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RuleVersionUpdate` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::VersionHistoryUpdate` initialize method" end self.additional_properties = {} diff --git a/lib/datadog_api_client/v2/models/rule_version_update_type.rb b/lib/datadog_api_client/v2/models/version_history_update_type.rb similarity index 95% rename from lib/datadog_api_client/v2/models/rule_version_update_type.rb rename to lib/datadog_api_client/v2/models/version_history_update_type.rb index a109d358c7c5..ecb53f88ca21 100644 --- a/lib/datadog_api_client/v2/models/rule_version_update_type.rb +++ b/lib/datadog_api_client/v2/models/version_history_update_type.rb @@ -18,7 +18,7 @@ module DatadogAPIClient::V2 # The type of change. - class RuleVersionUpdateType + class VersionHistoryUpdateType include BaseEnumModel CREATE = "create".freeze