diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 49e923cae4cb..578d401e9906 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -70492,6 +70492,8 @@ components: $ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorPerMetricLimit" maxItems: 100 type: array + tracking_mode: + $ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorTrackingMode" type: $ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorType" value_limit: @@ -70506,6 +70508,7 @@ components: - type - include - limit_exceeded_action + - tracking_mode - value_limit - enabled type: object @@ -70520,6 +70523,16 @@ components: x-enum-varnames: - DROP_TAG - DROP_EVENT + ObservabilityPipelineTagCardinalityLimitProcessorOverrideType: + description: How the override is applied. `limit_override` enforces a custom limit; `excluded` omits the metric or tag from cardinality tracking. + enum: + - limit_override + - excluded + example: limit_override + type: string + x-enum-varnames: + - LIMIT_OVERRIDE + - EXCLUDED ObservabilityPipelineTagCardinalityLimitProcessorPerMetricLimit: description: A cardinality override applied to a specific metric. properties: @@ -70529,16 +70542,16 @@ components: description: The name of the metric this override applies to. example: "system.cpu.user" type: string - mode: - $ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorPerMetricMode" + override_type: + $ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorOverrideType" per_tag_limits: - description: A list of per-tag cardinality overrides that apply within this metric. Must be omitted when `mode` is `excluded`. + description: A list of per-tag cardinality overrides that apply within this metric. Must be omitted when `override_type` is `excluded`. items: $ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorPerTagLimit" maxItems: 50 type: array value_limit: - description: The maximum number of distinct tag value combinations allowed for this metric. Required when `mode` is `tracked`. Must be omitted when `mode` is `excluded`. + description: The maximum number of distinct tag value combinations allowed for this metric. Required when `override_type` is `limit_override`. Must be omitted when `override_type` is `excluded`. example: 10000 format: int64 maximum: 1000000 @@ -70546,29 +70559,19 @@ components: type: integer required: - metric_name - - mode + - override_type type: object - ObservabilityPipelineTagCardinalityLimitProcessorPerMetricMode: - description: How the per-metric override is applied. `tracked` enforces a custom limit; `excluded` skips the metric entirely. - enum: - - tracked - - excluded - example: tracked - type: string - x-enum-varnames: - - TRACKED - - EXCLUDED ObservabilityPipelineTagCardinalityLimitProcessorPerTagLimit: description: A cardinality override for a specific tag key within a per-metric limit. properties: - mode: - $ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorPerTagMode" + override_type: + $ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorOverrideType" tag_key: description: The tag key this override applies to. example: "host" type: string value_limit: - description: The maximum number of distinct values allowed for this tag. Required when `mode` is `limit_override`. Must be omitted when `mode` is `excluded`. + description: The maximum number of distinct values allowed for this tag. Required when `override_type` is `limit_override`. Must be omitted when `override_type` is `excluded`. example: 5000 format: int64 maximum: 1000000 @@ -70576,18 +70579,26 @@ components: type: integer required: - tag_key + - override_type + type: object + ObservabilityPipelineTagCardinalityLimitProcessorTrackingMode: + description: Controls whether the processor uses exact or probabilistic tag tracking. + properties: + mode: + $ref: "#/components/schemas/ObservabilityPipelineTagCardinalityLimitProcessorTrackingModeMode" + required: - mode type: object - ObservabilityPipelineTagCardinalityLimitProcessorPerTagMode: - description: How the per-tag override is applied. `limit_override` enforces a custom limit on the tag; `excluded` skips the tag from cardinality tracking. + ObservabilityPipelineTagCardinalityLimitProcessorTrackingModeMode: + description: The cardinality tracking algorithm to use. enum: - - limit_override - - excluded - example: limit_override + - exact_fingerprint + - probabilistic + example: exact_fingerprint type: string x-enum-varnames: - - LIMIT_OVERRIDE - - EXCLUDED + - EXACT_FINGERPRINT + - PROBABILISTIC ObservabilityPipelineTagCardinalityLimitProcessorType: default: tag_cardinality_limit description: The processor type. The value must be `tag_cardinality_limit`. @@ -127284,6 +127295,56 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get the custom forecast for a budget. + operationId: GetCustomForecast + parameters: + - $ref: "#/components/parameters/BudgetID" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + budget_uid: 00000000-0000-0000-0000-000000000001 + created_at: 1738258683590 + created_by: 00000000-0a0a-0a0a-aaa0-00000000000a + entries: + - amount: 400 + month: 202501 + tag_filters: + - tag_key: service + tag_value: ec2 + - amount: 450 + month: 202502 + tag_filters: + - tag_key: service + tag_value: ec2 + updated_at: 1738258683590 + updated_by: 00000000-0a0a-0a0a-aaa0-00000000000a + id: 11111111-1111-1111-1111-111111111111 + type: custom_forecast + schema: + $ref: "#/components/schemas/CustomForecastResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a budget's custom forecast + tags: + - Cloud Cost Management + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/cost/budgets: get: description: List budgets. diff --git a/examples/v2/cloud-cost-management/GetCustomForecast.rb b/examples/v2/cloud-cost-management/GetCustomForecast.rb new file mode 100644 index 000000000000..cb1ca9159ea3 --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCustomForecast.rb @@ -0,0 +1,8 @@ +# Get a budget's custom forecast returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_custom_forecast".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new +p api_instance.get_custom_forecast("budget_id") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 8726846681a9..b5d8247ed73d 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2741,6 +2741,9 @@ "v2.DeleteCustomForecast" => { "budget_id" => "String", }, + "v2.GetCustomForecast" => { + "budget_id" => "String", + }, "v2.GetCommitmentsCommitmentList" => { "provider" => "CommitmentsProvider", "product" => "String", diff --git a/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index 258f3468a9f7..028864461382 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/cloud_cost_management.feature @@ -375,6 +375,30 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get a budget's custom forecast returns "Bad Request" response + Given operation "GetCustomForecast" enabled + And new "GetCustomForecast" request + And request contains "budget_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get a budget's custom forecast returns "Not Found" response + Given operation "GetCustomForecast" enabled + And new "GetCustomForecast" request + And request contains "budget_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: Get a budget's custom forecast returns "OK" response + Given operation "GetCustomForecast" enabled + And new "GetCustomForecast" request + And request contains "budget_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @replay-only @team:DataDog/cloud-cost-management Scenario: Get a tag pipeline ruleset returns "OK" response Given new "GetTagPipelinesRuleset" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 22089f0ecea4..0718c335cf9f 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1785,6 +1785,12 @@ "type": "idempotent" } }, + "GetCustomForecast": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "ListBudgets": { "tag": "Cloud Cost Management", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index d01dd48cae74..af5982f11e59 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -432,6 +432,7 @@ def initialize "v2.get_commitments_utilization_timeseries": false, "v2.get_cost_anomaly": false, "v2.get_cost_tag_metadata_currency": false, + "v2.get_custom_forecast": false, "v2.list_cost_anomalies": false, "v2.list_cost_tag_key_sources": false, "v2.list_cost_tag_metadata": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 26d9c514205b..1ad1bf8a9ffa 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5305,10 +5305,11 @@ def overrides "v2.observability_pipeline_syslog_source_mode" => "ObservabilityPipelineSyslogSourceMode", "v2.observability_pipeline_tag_cardinality_limit_processor" => "ObservabilityPipelineTagCardinalityLimitProcessor", "v2.observability_pipeline_tag_cardinality_limit_processor_action" => "ObservabilityPipelineTagCardinalityLimitProcessorAction", + "v2.observability_pipeline_tag_cardinality_limit_processor_override_type" => "ObservabilityPipelineTagCardinalityLimitProcessorOverrideType", "v2.observability_pipeline_tag_cardinality_limit_processor_per_metric_limit" => "ObservabilityPipelineTagCardinalityLimitProcessorPerMetricLimit", - "v2.observability_pipeline_tag_cardinality_limit_processor_per_metric_mode" => "ObservabilityPipelineTagCardinalityLimitProcessorPerMetricMode", "v2.observability_pipeline_tag_cardinality_limit_processor_per_tag_limit" => "ObservabilityPipelineTagCardinalityLimitProcessorPerTagLimit", - "v2.observability_pipeline_tag_cardinality_limit_processor_per_tag_mode" => "ObservabilityPipelineTagCardinalityLimitProcessorPerTagMode", + "v2.observability_pipeline_tag_cardinality_limit_processor_tracking_mode" => "ObservabilityPipelineTagCardinalityLimitProcessorTrackingMode", + "v2.observability_pipeline_tag_cardinality_limit_processor_tracking_mode_mode" => "ObservabilityPipelineTagCardinalityLimitProcessorTrackingModeMode", "v2.observability_pipeline_tag_cardinality_limit_processor_type" => "ObservabilityPipelineTagCardinalityLimitProcessorType", "v2.observability_pipeline_throttle_processor" => "ObservabilityPipelineThrottleProcessor", "v2.observability_pipeline_throttle_processor_type" => "ObservabilityPipelineThrottleProcessorType", diff --git a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb index 2bd7fc3c2de9..09671f6dee33 100644 --- a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb +++ b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb @@ -2504,6 +2504,77 @@ def get_custom_costs_file_with_http_info(file_id, opts = {}) return data, status_code, headers end + # Get a budget's custom forecast. + # + # @see #get_custom_forecast_with_http_info + def get_custom_forecast(budget_id, opts = {}) + data, _status_code, _headers = get_custom_forecast_with_http_info(budget_id, opts) + data + end + + # Get a budget's custom forecast. + # + # Get the custom forecast for a budget. + # + # @param budget_id [String] Budget id. + # @param opts [Hash] the optional parameters + # @return [Array<(CustomForecastResponse, Integer, Hash)>] CustomForecastResponse data, response status code and response headers + def get_custom_forecast_with_http_info(budget_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_custom_forecast".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_custom_forecast") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_custom_forecast")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.get_custom_forecast ...' + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling CloudCostManagementAPI.get_custom_forecast" + end + # resource path + local_var_path = '/api/v2/cost/budget/{budget_id}/custom-forecast'.sub('{budget_id}', CGI.escape(budget_id.to_s).gsub('%2F', '/')) + + # 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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CustomForecastResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_custom_forecast, + :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: CloudCostManagementAPI#get_custom_forecast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a tag pipeline ruleset. # # @see #get_tag_pipelines_ruleset_with_http_info diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor.rb b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor.rb index 1b38d76515bb..859f84e4b397 100644 --- a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor.rb +++ b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor.rb @@ -41,6 +41,9 @@ class ObservabilityPipelineTagCardinalityLimitProcessor # A list of per-metric cardinality overrides that take precedence over the default `value_limit`. attr_reader :per_metric_limits + # Controls whether the processor uses exact or probabilistic tag tracking. + attr_reader :tracking_mode + # The processor type. The value must be `tag_cardinality_limit`. attr_reader :type @@ -59,6 +62,7 @@ def self.attribute_map :'include' => :'include', :'limit_exceeded_action' => :'limit_exceeded_action', :'per_metric_limits' => :'per_metric_limits', + :'tracking_mode' => :'tracking_mode', :'type' => :'type', :'value_limit' => :'value_limit' } @@ -74,6 +78,7 @@ def self.openapi_types :'include' => :'String', :'limit_exceeded_action' => :'ObservabilityPipelineTagCardinalityLimitProcessorAction', :'per_metric_limits' => :'Array', + :'tracking_mode' => :'ObservabilityPipelineTagCardinalityLimitProcessorTrackingMode', :'type' => :'ObservabilityPipelineTagCardinalityLimitProcessorType', :'value_limit' => :'Integer' } @@ -123,6 +128,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'tracking_mode') + self.tracking_mode = attributes[:'tracking_mode'] + end + if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -141,6 +150,7 @@ def valid? return false if @include.nil? return false if @limit_exceeded_action.nil? return false if !@per_metric_limits.nil? && @per_metric_limits.length > 100 + return false if @tracking_mode.nil? return false if @type.nil? return false if @value_limit.nil? return false if @value_limit > 1000000 @@ -198,6 +208,16 @@ def per_metric_limits=(per_metric_limits) @per_metric_limits = per_metric_limits end + # Custom attribute writer method with validation + # @param tracking_mode [Object] Object to be assigned + # @!visibility private + def tracking_mode=(tracking_mode) + if tracking_mode.nil? + fail ArgumentError, 'invalid value for "tracking_mode", tracking_mode cannot be nil.' + end + @tracking_mode = tracking_mode + end + # Custom attribute writer method with validation # @param type [Object] Object to be assigned # @!visibility private @@ -256,6 +276,7 @@ def ==(o) include == o.include && limit_exceeded_action == o.limit_exceeded_action && per_metric_limits == o.per_metric_limits && + tracking_mode == o.tracking_mode && type == o.type && value_limit == o.value_limit && additional_properties == o.additional_properties @@ -265,7 +286,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [display_name, enabled, id, include, limit_exceeded_action, per_metric_limits, type, value_limit, additional_properties].hash + [display_name, enabled, id, include, limit_exceeded_action, per_metric_limits, tracking_mode, type, value_limit, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_tag_mode.rb b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_override_type.rb similarity index 75% rename from lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_tag_mode.rb rename to lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_override_type.rb index 4e2dd13f7af9..55367089f583 100644 --- a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_tag_mode.rb +++ b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_override_type.rb @@ -17,8 +17,8 @@ require 'time' module DatadogAPIClient::V2 - # How the per-tag override is applied. `limit_override` enforces a custom limit on the tag; `excluded` skips the tag from cardinality tracking. - class ObservabilityPipelineTagCardinalityLimitProcessorPerTagMode + # How the override is applied. `limit_override` enforces a custom limit; `excluded` omits the metric or tag from cardinality tracking. + class ObservabilityPipelineTagCardinalityLimitProcessorOverrideType include BaseEnumModel LIMIT_OVERRIDE = "limit_override".freeze diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_metric_limit.rb b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_metric_limit.rb index d6147df8b675..dafd776060ca 100644 --- a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_metric_limit.rb +++ b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_metric_limit.rb @@ -27,13 +27,13 @@ class ObservabilityPipelineTagCardinalityLimitProcessorPerMetricLimit # The name of the metric this override applies to. attr_reader :metric_name - # How the per-metric override is applied. `tracked` enforces a custom limit; `excluded` skips the metric entirely. - attr_reader :mode + # How the override is applied. `limit_override` enforces a custom limit; `excluded` omits the metric or tag from cardinality tracking. + attr_reader :override_type - # A list of per-tag cardinality overrides that apply within this metric. Must be omitted when `mode` is `excluded`. + # A list of per-tag cardinality overrides that apply within this metric. Must be omitted when `override_type` is `excluded`. attr_reader :per_tag_limits - # The maximum number of distinct tag value combinations allowed for this metric. Required when `mode` is `tracked`. Must be omitted when `mode` is `excluded`. + # The maximum number of distinct tag value combinations allowed for this metric. Required when `override_type` is `limit_override`. Must be omitted when `override_type` is `excluded`. attr_reader :value_limit attr_accessor :additional_properties @@ -44,7 +44,7 @@ def self.attribute_map { :'limit_exceeded_action' => :'limit_exceeded_action', :'metric_name' => :'metric_name', - :'mode' => :'mode', + :'override_type' => :'override_type', :'per_tag_limits' => :'per_tag_limits', :'value_limit' => :'value_limit' } @@ -56,7 +56,7 @@ def self.openapi_types { :'limit_exceeded_action' => :'ObservabilityPipelineTagCardinalityLimitProcessorAction', :'metric_name' => :'String', - :'mode' => :'ObservabilityPipelineTagCardinalityLimitProcessorPerMetricMode', + :'override_type' => :'ObservabilityPipelineTagCardinalityLimitProcessorOverrideType', :'per_tag_limits' => :'Array', :'value_limit' => :'Integer' } @@ -88,8 +88,8 @@ def initialize(attributes = {}) self.metric_name = attributes[:'metric_name'] end - if attributes.key?(:'mode') - self.mode = attributes[:'mode'] + if attributes.key?(:'override_type') + self.override_type = attributes[:'override_type'] end if attributes.key?(:'per_tag_limits') @@ -108,7 +108,7 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @metric_name.nil? - return false if @mode.nil? + return false if @override_type.nil? return false if !@per_tag_limits.nil? && @per_tag_limits.length > 50 return false if !@value_limit.nil? && @value_limit > 1000000 return false if !@value_limit.nil? && @value_limit < 0 @@ -126,13 +126,13 @@ def metric_name=(metric_name) end # Custom attribute writer method with validation - # @param mode [Object] Object to be assigned + # @param override_type [Object] Object to be assigned # @!visibility private - def mode=(mode) - if mode.nil? - fail ArgumentError, 'invalid value for "mode", mode cannot be nil.' + def override_type=(override_type) + if override_type.nil? + fail ArgumentError, 'invalid value for "override_type", override_type cannot be nil.' end - @mode = mode + @override_type = override_type end # Custom attribute writer method with validation @@ -186,7 +186,7 @@ def ==(o) self.class == o.class && limit_exceeded_action == o.limit_exceeded_action && metric_name == o.metric_name && - mode == o.mode && + override_type == o.override_type && per_tag_limits == o.per_tag_limits && value_limit == o.value_limit && additional_properties == o.additional_properties @@ -196,7 +196,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [limit_exceeded_action, metric_name, mode, per_tag_limits, value_limit, additional_properties].hash + [limit_exceeded_action, metric_name, override_type, per_tag_limits, value_limit, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_tag_limit.rb b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_tag_limit.rb index 32ac13afa297..1ebcd5a8355d 100644 --- a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_tag_limit.rb +++ b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_tag_limit.rb @@ -21,13 +21,13 @@ module DatadogAPIClient::V2 class ObservabilityPipelineTagCardinalityLimitProcessorPerTagLimit include BaseGenericModel - # How the per-tag override is applied. `limit_override` enforces a custom limit on the tag; `excluded` skips the tag from cardinality tracking. - attr_reader :mode + # How the override is applied. `limit_override` enforces a custom limit; `excluded` omits the metric or tag from cardinality tracking. + attr_reader :override_type # The tag key this override applies to. attr_reader :tag_key - # The maximum number of distinct values allowed for this tag. Required when `mode` is `limit_override`. Must be omitted when `mode` is `excluded`. + # The maximum number of distinct values allowed for this tag. Required when `override_type` is `limit_override`. Must be omitted when `override_type` is `excluded`. attr_reader :value_limit attr_accessor :additional_properties @@ -36,7 +36,7 @@ class ObservabilityPipelineTagCardinalityLimitProcessorPerTagLimit # @!visibility private def self.attribute_map { - :'mode' => :'mode', + :'override_type' => :'override_type', :'tag_key' => :'tag_key', :'value_limit' => :'value_limit' } @@ -46,7 +46,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'mode' => :'ObservabilityPipelineTagCardinalityLimitProcessorPerTagMode', + :'override_type' => :'ObservabilityPipelineTagCardinalityLimitProcessorOverrideType', :'tag_key' => :'String', :'value_limit' => :'Integer' } @@ -70,8 +70,8 @@ def initialize(attributes = {}) end } - if attributes.key?(:'mode') - self.mode = attributes[:'mode'] + if attributes.key?(:'override_type') + self.override_type = attributes[:'override_type'] end if attributes.key?(:'tag_key') @@ -87,7 +87,7 @@ def initialize(attributes = {}) # @return true if the model is valid # @!visibility private def valid? - return false if @mode.nil? + return false if @override_type.nil? return false if @tag_key.nil? return false if !@value_limit.nil? && @value_limit > 1000000 return false if !@value_limit.nil? && @value_limit < 0 @@ -95,13 +95,13 @@ def valid? end # Custom attribute writer method with validation - # @param mode [Object] Object to be assigned + # @param override_type [Object] Object to be assigned # @!visibility private - def mode=(mode) - if mode.nil? - fail ArgumentError, 'invalid value for "mode", mode cannot be nil.' + def override_type=(override_type) + if override_type.nil? + fail ArgumentError, 'invalid value for "override_type", override_type cannot be nil.' end - @mode = mode + @override_type = override_type end # Custom attribute writer method with validation @@ -153,7 +153,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && - mode == o.mode && + override_type == o.override_type && tag_key == o.tag_key && value_limit == o.value_limit && additional_properties == o.additional_properties @@ -163,7 +163,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [mode, tag_key, value_limit, additional_properties].hash + [override_type, tag_key, value_limit, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_tracking_mode.rb b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_tracking_mode.rb new file mode 100644 index 000000000000..581c57222e44 --- /dev/null +++ b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_tracking_mode.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 + # Controls whether the processor uses exact or probabilistic tag tracking. + class ObservabilityPipelineTagCardinalityLimitProcessorTrackingMode + include BaseGenericModel + + # The cardinality tracking algorithm to use. + attr_reader :mode + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'mode' => :'mode' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'mode' => :'ObservabilityPipelineTagCardinalityLimitProcessorTrackingModeMode' + } + 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::ObservabilityPipelineTagCardinalityLimitProcessorTrackingMode` 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?(:'mode') + self.mode = attributes[:'mode'] + 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 @mode.nil? + true + end + + # Custom attribute writer method with validation + # @param mode [Object] Object to be assigned + # @!visibility private + def mode=(mode) + if mode.nil? + fail ArgumentError, 'invalid value for "mode", mode cannot be nil.' + end + @mode = mode + 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 && + mode == o.mode && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [mode, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_metric_mode.rb b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_tracking_mode_mode.rb similarity index 69% rename from lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_metric_mode.rb rename to lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_tracking_mode_mode.rb index 0a73d35dbc7e..2fb713adf9e6 100644 --- a/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_per_metric_mode.rb +++ b/lib/datadog_api_client/v2/models/observability_pipeline_tag_cardinality_limit_processor_tracking_mode_mode.rb @@ -17,11 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # How the per-metric override is applied. `tracked` enforces a custom limit; `excluded` skips the metric entirely. - class ObservabilityPipelineTagCardinalityLimitProcessorPerMetricMode + # The cardinality tracking algorithm to use. + class ObservabilityPipelineTagCardinalityLimitProcessorTrackingModeMode include BaseEnumModel - TRACKED = "tracked".freeze - EXCLUDED = "excluded".freeze + EXACT_FINGERPRINT = "exact_fingerprint".freeze + PROBABILISTIC = "probabilistic".freeze end end