From 4193eb3fe3d0f51afe6ab54a7dad36dd3b1ec98a Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 19:05:34 +0000 Subject: [PATCH 1/3] Widgets API - add complete create/update example for cloud_cost_summary (#3286) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 67 ++++++++++++++++++-- lib/datadog_api_client/v2/api/widgets_api.rb | 4 +- 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 95a832b986b5..47f19e6b4c42 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -134587,16 +134587,45 @@ paths: application/json: examples: default: + summary: CCM cost summary widget value: data: attributes: definition: - title: My Widget - type: bar_chart + graph_options: + - type: query_value + view: total + - type: query_value + view: change + - display_type: bars + type: timeseries + - type: cloud_cost_table + view: summary + requests: + - formulas: + - formula: query1 + queries: + - data_source: cloud_cost + name: query1 + query: sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily) + response_format: timeseries + time: + type: live + unit: day + value: 30 + title: AWS spend by service (last 30 days) + type: cloud_cost_summary + tags: ["finops", "aws"] type: widgets schema: $ref: "#/components/schemas/CreateOrUpdateWidgetRequest" - description: Widget request body. + description: |- + Widget request body. The `definition` object's required fields vary + by `widget.definition.type`: every type requires `requests`, and + some types require additional fields (e.g. `cloud_cost_summary` + requires `graph_options`, `geomap` requires `style` and `view`). + The example below shows a complete `cloud_cost_summary` payload + for the `ccm_reports` experience type. required: true responses: "200": @@ -134766,16 +134795,42 @@ paths: application/json: examples: default: + summary: CCM cost summary widget value: data: attributes: definition: - title: My Widget - type: bar_chart + graph_options: + - type: query_value + view: total + - type: query_value + view: change + - display_type: bars + type: timeseries + - type: cloud_cost_table + view: summary + requests: + - formulas: + - formula: query1 + queries: + - data_source: cloud_cost + name: query1 + query: sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily) + response_format: timeseries + time: + type: live + unit: day + value: 30 + title: AWS spend by service (last 30 days) + type: cloud_cost_summary + tags: ["finops", "aws"] type: widgets schema: $ref: "#/components/schemas/CreateOrUpdateWidgetRequest" - description: Widget request body. + description: |- + Widget request body. The `definition` object's required fields vary + by `widget.definition.type`; see `CreateWidget` above for a complete + worked payload. Update is a full replacement of the widget definition. required: true responses: "200": diff --git a/lib/datadog_api_client/v2/api/widgets_api.rb b/lib/datadog_api_client/v2/api/widgets_api.rb index 14c104504fa5..f049f04773fd 100644 --- a/lib/datadog_api_client/v2/api/widgets_api.rb +++ b/lib/datadog_api_client/v2/api/widgets_api.rb @@ -36,7 +36,7 @@ def create_widget(experience_type, body, opts = {}) # Create a new widget for a given experience type. # # @param experience_type [WidgetExperienceType] The experience type for the widget. - # @param body [CreateOrUpdateWidgetRequest] Widget request body. + # @param body [CreateOrUpdateWidgetRequest] Widget request body. The `definition` object's required fields vary by `widget.definition.type`: every type requires `requests`, and some types require additional fields (e.g. `cloud_cost_summary` requires `graph_options`, `geomap` requires `style` and `view`). The example below shows a complete `cloud_cost_summary` payload for the `ccm_reports` experience type. # @param opts [Hash] the optional parameters # @return [Array<(WidgetResponse, Integer, Hash)>] WidgetResponse data, response status code and response headers def create_widget_with_http_info(experience_type, body, opts = {}) @@ -360,7 +360,7 @@ def update_widget(experience_type, uuid, body, opts = {}) # # @param experience_type [WidgetExperienceType] The experience type for the widget. # @param uuid [UUID] The UUID of the widget. - # @param body [CreateOrUpdateWidgetRequest] Widget request body. + # @param body [CreateOrUpdateWidgetRequest] Widget request body. The `definition` object's required fields vary by `widget.definition.type`; see `CreateWidget` above for a complete worked payload. Update is a full replacement of the widget definition. # @param opts [Hash] the optional parameters # @return [Array<(WidgetResponse, Integer, Hash)>] WidgetResponse data, response status code and response headers def update_widget_with_http_info(experience_type, uuid, body, opts = {}) From 1290aae08f9bbd4f77b162965a0f05cc690964d0 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 19:23:55 +0000 Subject: [PATCH 2/3] Document bulk delete security monitoring rules endpoint (#3260) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 104 +++++++++++++ .../BulkDeleteSecurityMonitoringRules.rb | 17 +++ features/scenarios_model_mapping.rb | 3 + features/v2/security_monitoring.feature | 21 +++ features/v2/undo.json | 6 + lib/datadog_api_client/inflector.rb | 5 + .../v2/api/security_monitoring_api.rb | 67 ++++++++ ..._monitoring_rule_bulk_delete_attributes.rb | 129 ++++++++++++++++ ...curity_monitoring_rule_bulk_delete_data.rb | 144 ++++++++++++++++++ ...ity_monitoring_rule_bulk_delete_payload.rb | 123 +++++++++++++++ ...ring_rule_bulk_delete_request_data_type.rb | 26 ++++ ...ty_monitoring_rule_bulk_delete_response.rb | 119 +++++++++++++++ 12 files changed, 764 insertions(+) create mode 100644 examples/v2/security-monitoring/BulkDeleteSecurityMonitoringRules.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_data.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_payload.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_request_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_response.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 47f19e6b4c42..de3d3a707998 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -64151,6 +64151,63 @@ components: - TWO_DAYS - ONE_WEEK - TWO_WEEKS + SecurityMonitoringRuleBulkDeleteAttributes: + description: Attributes for bulk deleting security monitoring rules. + properties: + ruleIds: + description: List of rule IDs to delete. + example: + - abc-000-u7q + - abc-000-7dd + items: + description: A rule ID to delete. + type: string + minItems: 1 + type: array + required: + - ruleIds + type: object + SecurityMonitoringRuleBulkDeleteData: + description: Data for bulk deleting security monitoring rules. + properties: + attributes: + $ref: "#/components/schemas/SecurityMonitoringRuleBulkDeleteAttributes" + type: + $ref: "#/components/schemas/SecurityMonitoringRuleBulkDeleteRequestDataType" + required: + - attributes + - type + type: object + SecurityMonitoringRuleBulkDeletePayload: + description: Payload for bulk deleting security monitoring rules. + properties: + data: + $ref: "#/components/schemas/SecurityMonitoringRuleBulkDeleteData" + required: + - data + type: object + SecurityMonitoringRuleBulkDeleteRequestDataType: + description: The resource type for a bulk delete request. + enum: + - bulk_delete_rules + example: bulk_delete_rules + type: string + x-enum-varnames: + - BULK_DELETE_RULES + SecurityMonitoringRuleBulkDeleteResponse: + description: Response for bulk deleting security monitoring rules. + properties: + deletedRules: + description: List of successfully deleted rule IDs. + items: + type: string + type: array + failedRules: + description: List of rule IDs that could not be deleted. + items: + type: string + type: array + type: object SecurityMonitoringRuleBulkExportAttributes: description: Attributes for bulk exporting security monitoring rules. properties: @@ -123130,6 +123187,53 @@ paths: operator: OR permissions: - security_monitoring_rules_write + /api/v2/security_monitoring/rules/bulk_delete: + delete: + description: |- + Delete multiple security monitoring rules in a single request. Default rules cannot be deleted. + operationId: BulkDeleteSecurityMonitoringRules + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + ruleIds: + - abc-000-u7q + - abc-000-7dd + type: bulk_delete_rules + schema: + $ref: "#/components/schemas/SecurityMonitoringRuleBulkDeletePayload" + required: true + responses: + "200": + content: + "application/json": + schema: + $ref: "#/components/schemas/SecurityMonitoringRuleBulkDeleteResponse" + 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_write + summary: Bulk delete security monitoring rules + tags: ["Security Monitoring"] + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_rules_write /api/v2/security_monitoring/rules/bulk_export: post: description: |- diff --git a/examples/v2/security-monitoring/BulkDeleteSecurityMonitoringRules.rb b/examples/v2/security-monitoring/BulkDeleteSecurityMonitoringRules.rb new file mode 100644 index 000000000000..8c242e8faf5d --- /dev/null +++ b/examples/v2/security-monitoring/BulkDeleteSecurityMonitoringRules.rb @@ -0,0 +1,17 @@ +# Bulk delete security monitoring rules returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::SecurityMonitoringRuleBulkDeletePayload.new({ + data: DatadogAPIClient::V2::SecurityMonitoringRuleBulkDeleteData.new({ + attributes: DatadogAPIClient::V2::SecurityMonitoringRuleBulkDeleteAttributes.new({ + rule_ids: [ + "abc-000-u7q", + "abc-000-7dd", + ], + }), + type: DatadogAPIClient::V2::SecurityMonitoringRuleBulkDeleteRequestDataType::BULK_DELETE_RULES, + }), +}) +p api_instance.bulk_delete_security_monitoring_rules(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index b65548d5207d..f88a3c3f133f 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1934,6 +1934,9 @@ "v2.CreateSecurityMonitoringRule" => { "body" => "SecurityMonitoringRuleCreatePayload", }, + "v2.BulkDeleteSecurityMonitoringRules" => { + "body" => "SecurityMonitoringRuleBulkDeletePayload", + }, "v2.BulkExportSecurityMonitoringRules" => { "body" => "SecurityMonitoringRuleBulkExportPayload", }, diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index 820747b79b7b..48a978cc2158 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -99,6 +99,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 delete security monitoring rules returns "Bad Request" response + Given new "BulkDeleteSecurityMonitoringRules" request + And body with value {"data": {"attributes": {"ruleIds": ["abc-000-u7q", "abc-000-7dd"]}, "type": "bulk_delete_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-siem + Scenario: Bulk delete security monitoring rules returns "Not Found" response + Given new "BulkDeleteSecurityMonitoringRules" request + And body with value {"data": {"attributes": {"ruleIds": ["abc-000-u7q", "abc-000-7dd"]}, "type": "bulk_delete_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-cloud-siem + Scenario: Bulk delete security monitoring rules returns "OK" response + Given new "BulkDeleteSecurityMonitoringRules" request + And body with value {"data": {"attributes": {"ruleIds": ["abc-000-u7q", "abc-000-7dd"]}, "type": "bulk_delete_rules"}} + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/k9-cloud-siem Scenario: Bulk export security monitoring rules returns "Bad Request" response Given new "BulkExportSecurityMonitoringRules" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 21d7896f03bd..d5a8323e2702 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5675,6 +5675,12 @@ "type": "unsafe" } }, + "BulkDeleteSecurityMonitoringRules": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "BulkExportSecurityMonitoringRules": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 8d3dc51e5100..79c15e6cf5e6 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5149,6 +5149,11 @@ def overrides "v2.security_monitoring_rule_anomaly_detection_options_bucket_duration" => "SecurityMonitoringRuleAnomalyDetectionOptionsBucketDuration", "v2.security_monitoring_rule_anomaly_detection_options_detection_tolerance" => "SecurityMonitoringRuleAnomalyDetectionOptionsDetectionTolerance", "v2.security_monitoring_rule_anomaly_detection_options_learning_duration" => "SecurityMonitoringRuleAnomalyDetectionOptionsLearningDuration", + "v2.security_monitoring_rule_bulk_delete_attributes" => "SecurityMonitoringRuleBulkDeleteAttributes", + "v2.security_monitoring_rule_bulk_delete_data" => "SecurityMonitoringRuleBulkDeleteData", + "v2.security_monitoring_rule_bulk_delete_payload" => "SecurityMonitoringRuleBulkDeletePayload", + "v2.security_monitoring_rule_bulk_delete_request_data_type" => "SecurityMonitoringRuleBulkDeleteRequestDataType", + "v2.security_monitoring_rule_bulk_delete_response" => "SecurityMonitoringRuleBulkDeleteResponse", "v2.security_monitoring_rule_bulk_export_attributes" => "SecurityMonitoringRuleBulkExportAttributes", "v2.security_monitoring_rule_bulk_export_data" => "SecurityMonitoringRuleBulkExportData", "v2.security_monitoring_rule_bulk_export_data_type" => "SecurityMonitoringRuleBulkExportDataType", 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 2778e33ab649..e14aa320f3f3 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -237,6 +237,73 @@ def attach_jira_issue_with_http_info(body, opts = {}) return data, status_code, headers end + # Bulk delete security monitoring rules. + # + # @see #bulk_delete_security_monitoring_rules_with_http_info + def bulk_delete_security_monitoring_rules(body, opts = {}) + data, _status_code, _headers = bulk_delete_security_monitoring_rules_with_http_info(body, opts) + data + end + + # Bulk delete security monitoring rules. + # + # Delete multiple security monitoring rules in a single request. Default rules cannot be deleted. + # + # @param body [SecurityMonitoringRuleBulkDeletePayload] + # @param opts [Hash] the optional parameters + # @return [Array<(SecurityMonitoringRuleBulkDeleteResponse, Integer, Hash)>] SecurityMonitoringRuleBulkDeleteResponse data, response status code and response headers + def bulk_delete_security_monitoring_rules_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.bulk_delete_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_delete_security_monitoring_rules" + end + # resource path + local_var_path = '/api/v2/security_monitoring/rules/bulk_delete' + + # 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/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] || 'SecurityMonitoringRuleBulkDeleteResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :bulk_delete_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::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#bulk_delete_security_monitoring_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Bulk update security signals. # # @see #bulk_edit_security_monitoring_signals_with_http_info diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_attributes.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_attributes.rb new file mode 100644 index 000000000000..8e981d6c81b8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_attributes.rb @@ -0,0 +1,129 @@ +=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 deleting security monitoring rules. + class SecurityMonitoringRuleBulkDeleteAttributes + include BaseGenericModel + + # List of rule IDs to delete. + 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::SecurityMonitoringRuleBulkDeleteAttributes` 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_bulk_delete_data.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_data.rb new file mode 100644 index 000000000000..1bd965db0c27 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_data.rb @@ -0,0 +1,144 @@ +=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 deleting security monitoring rules. + class SecurityMonitoringRuleBulkDeleteData + include BaseGenericModel + + # Attributes for bulk deleting security monitoring rules. + attr_reader :attributes + + # The resource type for a bulk delete request. + 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', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SecurityMonitoringRuleBulkDeleteAttributes', + :'type' => :'SecurityMonitoringRuleBulkDeleteRequestDataType' + } + 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::SecurityMonitoringRuleBulkDeleteData` 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?(:'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 && + 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, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_payload.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_payload.rb new file mode 100644 index 000000000000..82168ddaed4f --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_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 deleting security monitoring rules. + class SecurityMonitoringRuleBulkDeletePayload + include BaseGenericModel + + # Data for bulk deleting security monitoring rules. + 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' => :'SecurityMonitoringRuleBulkDeleteData' + } + 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::SecurityMonitoringRuleBulkDeletePayload` 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 diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_request_data_type.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_request_data_type.rb new file mode 100644 index 000000000000..2e58b01bfeaa --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_request_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 resource type for a bulk delete request. + class SecurityMonitoringRuleBulkDeleteRequestDataType + include BaseEnumModel + + BULK_DELETE_RULES = "bulk_delete_rules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_response.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_response.rb new file mode 100644 index 000000000000..98ea6cb4c2a9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_bulk_delete_response.rb @@ -0,0 +1,119 @@ +=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 bulk deleting security monitoring rules. + class SecurityMonitoringRuleBulkDeleteResponse + include BaseGenericModel + + # List of successfully deleted rule IDs. + attr_accessor :deleted_rules + + # List of rule IDs that could not be deleted. + attr_accessor :failed_rules + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'deleted_rules' => :'deletedRules', + :'failed_rules' => :'failedRules' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'deleted_rules' => :'Array', + :'failed_rules' => :'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::SecurityMonitoringRuleBulkDeleteResponse` 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?(:'deleted_rules') + if (value = attributes[:'deleted_rules']).is_a?(Array) + self.deleted_rules = value + end + end + + if attributes.key?(:'failed_rules') + if (value = attributes[:'failed_rules']).is_a?(Array) + self.failed_rules = value + end + 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 && + deleted_rules == o.deleted_rules && + failed_rules == o.failed_rules && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [deleted_rules, failed_rules, additional_properties].hash + end + end +end From b4c60d7e6911f92834cc85cf1ceacb966b4ead31 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 19:58:23 +0000 Subject: [PATCH 3/3] Clarify metrics API query strings (#3269) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 12 ++++++++---- lib/datadog_api_client/v2/api/metrics_api.rb | 10 ++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index de3d3a707998..df325279eec0 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -107944,6 +107944,8 @@ paths: get: description: |- Get a list of actively reporting metrics for your organization. Pagination is optional using the `page[cursor]` and `page[size]` query parameters. + + Query parameters use bracket notation (for example, `filter[tags]`, `filter[queried][window][seconds]`). Pass them as standard URL query strings, URL-encoding the brackets if your client does not handle them. For example: `GET /api/v2/metrics?filter[tags]=env:prod&window[seconds]=86400&page[size]=500`. operationId: ListTagConfigurations parameters: - description: Only return custom metrics that have been configured with Metrics Without Limits. @@ -107983,7 +107985,7 @@ paths: schema: type: boolean - description: |- - Only return metrics that have been queried or not queried in the specified window. Dependent on being sent with `filter[queried]`. The default value is 2,592,000 seconds (30 days), the maximum value is 15,552,000 seconds (180 days), and the minimum value is 1 second. + This parameter has no effect unless `filter[queried]` is also set. Only return metrics that have been queried or not queried in the specified window. The default value is 2,592,000 seconds (30 days), the maximum value is 15,552,000 seconds (180 days), and the minimum value is 1 second. For example: `filter[queried]=true&filter[queried][window][seconds]=604800`. example: 15552000 in: query name: filter[queried][window][seconds] @@ -107995,7 +107997,7 @@ paths: minimum: 1 type: integer - description: |- - Only return metrics that were submitted with tags matching this expression. You can use AND, OR, IN, and wildcards (for example, service:web*). + Only return metrics that were submitted with tags matching this expression. You can use AND, OR, IN, and wildcards. For example: `filter[tags]=env IN (staging,test) AND service:web*`. example: "env IN (staging,test) AND service:web*" in: query name: filter[tags] @@ -108022,7 +108024,8 @@ paths: maximum: 2592000 minimum: 1 type: integer - - description: Maximum number of results per page. Use with `page[cursor]` for pagination. The default value is 10000, the maximum value is 10000, and the minimum value is 1. + - description: |- + Maximum number of results per page. Send `page[size]` on the first request to opt in to pagination. On each subsequent request, send `page[cursor]` set to the value of `meta.pagination.next_cursor` from the previous response. The default value is 10000, the maximum value is 10000, and the minimum value is 1. in: query name: page[size] required: false @@ -108426,7 +108429,8 @@ paths: operationId: EstimateMetricsOutputSeries parameters: - $ref: "#/components/parameters/MetricName" - - description: Filtered tag keys that the metric is configured to query with. + - description: |- + Comma-separated list of tag keys that the metric is configured to query with. For example: `filter[groups]=app,host`. example: "app,host" in: query name: filter[groups] diff --git a/lib/datadog_api_client/v2/api/metrics_api.rb b/lib/datadog_api_client/v2/api/metrics_api.rb index 654be940dd91..f77368485a7d 100644 --- a/lib/datadog_api_client/v2/api/metrics_api.rb +++ b/lib/datadog_api_client/v2/api/metrics_api.rb @@ -323,7 +323,7 @@ def estimate_metrics_output_series(metric_name, opts = {}) # # @param metric_name [String] The name of the metric. # @param opts [Hash] the optional parameters - # @option opts [String] :filter_groups Filtered tag keys that the metric is configured to query with. + # @option opts [String] :filter_groups Comma-separated list of tag keys that the metric is configured to query with. For example: `filter[groups]=app,host`. # @option opts [Integer] :filter_hours_ago The number of hours of look back (from now) to estimate cardinality with. If unspecified, it defaults to 0 hours. # @option opts [Integer] :filter_num_aggregations Deprecated. Number of aggregations has no impact on volume. # @option opts [Boolean] :filter_pct A boolean, for distribution metrics only, to estimate cardinality if the metric includes additional percentile aggregators. @@ -670,17 +670,19 @@ def list_tag_configurations(opts = {}) # # Get a list of actively reporting metrics for your organization. Pagination is optional using the `page[cursor]` and `page[size]` query parameters. # + # Query parameters use bracket notation (for example, `filter[tags]`, `filter[queried][window][seconds]`). Pass them as standard URL query strings, URL-encoding the brackets if your client does not handle them. For example: `GET /api/v2/metrics?filter[tags]=env:prod&window[seconds]=86400&page[size]=500`. + # # @param opts [Hash] the optional parameters # @option opts [Boolean] :filter_configured Only return custom metrics that have been configured with Metrics Without Limits. # @option opts [String] :filter_tags_configured Only return metrics that have the given tag key(s) in their Metrics Without Limits configuration (included or excluded). # @option opts [MetricTagConfigurationMetricTypeCategory] :filter_metric_type Only return metrics of the given metric type. # @option opts [Boolean] :filter_include_percentiles Only return distribution metrics that have percentile aggregations enabled (true) or disabled (false). # @option opts [Boolean] :filter_queried Only return metrics that have been queried (true) or not queried (false) in the look back window. Set the window with `filter[queried][window][seconds]`; if omitted, a default window is used. - # @option opts [Integer] :filter_queried_window_seconds Only return metrics that have been queried or not queried in the specified window. Dependent on being sent with `filter[queried]`. The default value is 2,592,000 seconds (30 days), the maximum value is 15,552,000 seconds (180 days), and the minimum value is 1 second. - # @option opts [String] :filter_tags Only return metrics that were submitted with tags matching this expression. You can use AND, OR, IN, and wildcards (for example, service:web*). + # @option opts [Integer] :filter_queried_window_seconds This parameter has no effect unless `filter[queried]` is also set. Only return metrics that have been queried or not queried in the specified window. The default value is 2,592,000 seconds (30 days), the maximum value is 15,552,000 seconds (180 days), and the minimum value is 1 second. For example: `filter[queried]=true&filter[queried][window][seconds]=604800`. + # @option opts [String] :filter_tags Only return metrics that were submitted with tags matching this expression. You can use AND, OR, IN, and wildcards. For example: `filter[tags]=env IN (staging,test) AND service:web*`. # @option opts [Boolean] :filter_related_assets Only return metrics that are used in at least one dashboard, monitor, notebook, or SLO. # @option opts [Integer] :window_seconds Only return metrics that have been actively reporting in the specified window. The default value is 3600 seconds (1 hour), the maximum value is 2,592,000 seconds (30 days), and the minimum value is 1 second. - # @option opts [Integer] :page_size Maximum number of results per page. Use with `page[cursor]` for pagination. The default value is 10000, the maximum value is 10000, and the minimum value is 1. + # @option opts [Integer] :page_size Maximum number of results per page. Send `page[size]` on the first request to opt in to pagination. On each subsequent request, send `page[cursor]` set to the value of `meta.pagination.next_cursor` from the previous response. The default value is 10000, the maximum value is 10000, and the minimum value is 1. # @option opts [String] :page_cursor Cursor for pagination. Use `page[size]` to opt-in to pagination and get the first page; for subsequent pages, use the value from `meta.pagination.next_cursor` in the response. Pagination is complete when `next_cursor` is null. # @return [Array<(MetricsAndMetricTagConfigurationsResponse, Integer, Hash)>] MetricsAndMetricTagConfigurationsResponse data, response status code and response headers def list_tag_configurations_with_http_info(opts = {})