From e5b8af310a079d8e07d7358201a822f0d22e6847 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 29 Jul 2026 17:40:38 +0000 Subject: [PATCH] Regenerate client from commit da9d282 of spec repo --- .generator/schemas/v2/openapi.yaml | 232 ++++++++++++++++++ .../CreateHistoricalMetricsConfiguration.rb | 15 ++ .../DeleteHistoricalMetricsConfiguration.rb | 8 + .../GetHistoricalMetricsConfiguration.rb | 8 + features/scenarios_model_mapping.rb | 9 + features/v2/metrics.feature | 90 +++++++ features/v2/undo.json | 25 ++ lib/datadog_api_client/configuration.rb | 3 + lib/datadog_api_client/inflector.rb | 6 + lib/datadog_api_client/v2/api/metrics_api.rb | 222 +++++++++++++++++ ...orical_metrics_configuration_attributes.rb | 105 ++++++++ ...rical_metrics_configuration_create_data.rb | 144 +++++++++++ ...al_metrics_configuration_create_request.rb | 123 ++++++++++ .../historical_metrics_configuration_data.rb | 125 ++++++++++ ...storical_metrics_configuration_response.rb | 105 ++++++++ .../historical_metrics_configuration_type.rb | 26 ++ 16 files changed, 1246 insertions(+) create mode 100644 examples/v2/metrics/CreateHistoricalMetricsConfiguration.rb create mode 100644 examples/v2/metrics/DeleteHistoricalMetricsConfiguration.rb create mode 100644 examples/v2/metrics/GetHistoricalMetricsConfiguration.rb create mode 100644 lib/datadog_api_client/v2/models/historical_metrics_configuration_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/historical_metrics_configuration_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/historical_metrics_configuration_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/historical_metrics_configuration_data.rb create mode 100644 lib/datadog_api_client/v2/models/historical_metrics_configuration_response.rb create mode 100644 lib/datadog_api_client/v2/models/historical_metrics_configuration_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 528e531d42a7..5a96a0215851 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -44866,6 +44866,66 @@ components: type: $ref: "#/components/schemas/HistoricalJobDataType" type: object + HistoricalMetricsConfigurationAttributes: + description: Attributes of a historical metrics configuration. + properties: + created_at: + description: Timestamp when historical metrics ingestion was enabled for the metric. + example: "2024-01-15T12:00:00.000Z" + format: date-time + readOnly: true + type: string + type: object + HistoricalMetricsConfigurationCreateData: + description: Data object for enabling historical metrics ingestion for a metric. + properties: + id: + description: The metric name, used as the resource ID. + example: dd.test.metric + type: string + type: + $ref: "#/components/schemas/HistoricalMetricsConfigurationType" + required: + - id + - type + type: object + HistoricalMetricsConfigurationCreateRequest: + description: Request body for enabling historical metrics ingestion for a metric. + properties: + data: + $ref: "#/components/schemas/HistoricalMetricsConfigurationCreateData" + required: + - data + type: object + HistoricalMetricsConfigurationData: + description: >- + A historical metrics configuration resource object. Existence of this resource means historical metrics ingestion is enabled for the metric; there is no separate enabled attribute. + properties: + attributes: + $ref: "#/components/schemas/HistoricalMetricsConfigurationAttributes" + id: + description: The metric name, used as the resource ID. + example: dd.test.metric + type: string + type: + $ref: "#/components/schemas/HistoricalMetricsConfigurationType" + type: object + HistoricalMetricsConfigurationResponse: + description: Response containing a historical metrics configuration. + properties: + data: + $ref: "#/components/schemas/HistoricalMetricsConfigurationData" + readOnly: true + type: object + HistoricalMetricsConfigurationType: + default: historical_metrics_configurations + description: The historical metrics configuration resource type. + enum: + - historical_metrics_configurations + example: historical_metrics_configurations + type: string + x-enum-varnames: + - HISTORICAL_METRICS_CONFIGURATIONS HourlyUsage: description: Hourly usage for a product family for an org. properties: @@ -159552,6 +159612,178 @@ paths: permissions: - metric_tags_write x-sunset: "2027-01-01" + /api/v2/metrics/historical-metrics-configurations: + post: + description: |- + Enable historical metrics ingestion (late data ingestion) for a metric. Idempotent: + enabling an already-enabled metric returns 200 instead of 201. Not supported for + distribution metrics, metrics with an existing tag configuration, or most standard + (non-custom) metrics. + operationId: CreateHistoricalMetricsConfiguration + requestBody: + content: + application/json: + examples: + default: + value: + data: + id: dd.test.metric + type: historical_metrics_configurations + schema: + $ref: "#/components/schemas/HistoricalMetricsConfigurationCreateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + id: dd.test.metric + type: historical_metrics_configurations + schema: + $ref: "#/components/schemas/HistoricalMetricsConfigurationResponse" + description: OK + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + id: dd.test.metric + type: historical_metrics_configurations + schema: + $ref: "#/components/schemas/HistoricalMetricsConfigurationResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unprocessable Entity + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - late_metrics_config_write + summary: Enable historical metrics ingestion + tags: + - Metrics + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - late_metrics_config_write + 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/metrics/historical-metrics-configurations/{metric_name}: + delete: + description: |- + Disable historical metrics ingestion for a metric. Idempotent: always returns 204, + whether or not the configuration existed or the metric itself still exists, so that + Terraform destroy succeeds for a metric removed out-of-band. + operationId: DeleteHistoricalMetricsConfiguration + parameters: + - $ref: "#/components/parameters/MetricName" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - late_metrics_config_write + summary: Delete a historical metrics configuration + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - late_metrics_config_write + 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 historical metrics ingestion configuration for a metric. Existence of the + resource means historical metrics ingestion is enabled; returns 404 when it is not + enabled for the metric. + operationId: GetHistoricalMetricsConfiguration + parameters: + - $ref: "#/components/parameters/MetricName" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T12:00:00.000Z" + id: dd.test.metric + type: historical_metrics_configurations + schema: + $ref: "#/components/schemas/HistoricalMetricsConfigurationResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - metrics_read + summary: Get a historical metrics configuration + tags: + - Metrics + "x-permission": + operator: OR + permissions: + - metrics_read + 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/metrics/tag-indexing-rules: get: description: List tag indexing rules for an org, sorted by `rule_order`, with offset/limit pagination. diff --git a/examples/v2/metrics/CreateHistoricalMetricsConfiguration.rb b/examples/v2/metrics/CreateHistoricalMetricsConfiguration.rb new file mode 100644 index 000000000000..6e3d5c6d8cb7 --- /dev/null +++ b/examples/v2/metrics/CreateHistoricalMetricsConfiguration.rb @@ -0,0 +1,15 @@ +# Enable historical metrics ingestion returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_historical_metrics_configuration".to_sym] = true +end +api_instance = DatadogAPIClient::V2::MetricsAPI.new + +body = DatadogAPIClient::V2::HistoricalMetricsConfigurationCreateRequest.new({ + data: DatadogAPIClient::V2::HistoricalMetricsConfigurationCreateData.new({ + id: "dd.test.metric", + type: DatadogAPIClient::V2::HistoricalMetricsConfigurationType::HISTORICAL_METRICS_CONFIGURATIONS, + }), +}) +p api_instance.create_historical_metrics_configuration(body) diff --git a/examples/v2/metrics/DeleteHistoricalMetricsConfiguration.rb b/examples/v2/metrics/DeleteHistoricalMetricsConfiguration.rb new file mode 100644 index 000000000000..ab4271d9a5bf --- /dev/null +++ b/examples/v2/metrics/DeleteHistoricalMetricsConfiguration.rb @@ -0,0 +1,8 @@ +# Delete a historical metrics configuration returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_historical_metrics_configuration".to_sym] = true +end +api_instance = DatadogAPIClient::V2::MetricsAPI.new +api_instance.delete_historical_metrics_configuration("metric_name") diff --git a/examples/v2/metrics/GetHistoricalMetricsConfiguration.rb b/examples/v2/metrics/GetHistoricalMetricsConfiguration.rb new file mode 100644 index 000000000000..125d67c8b3a2 --- /dev/null +++ b/examples/v2/metrics/GetHistoricalMetricsConfiguration.rb @@ -0,0 +1,8 @@ +# Get a historical metrics configuration returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_historical_metrics_configuration".to_sym] = true +end +api_instance = DatadogAPIClient::V2::MetricsAPI.new +p api_instance.get_historical_metrics_configuration("metric_name") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 578f92989d3e..3b005829b144 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4239,6 +4239,15 @@ "v2.CreateBulkTagsMetricsConfiguration" => { "body" => "MetricBulkTagConfigCreateRequest", }, + "v2.CreateHistoricalMetricsConfiguration" => { + "body" => "HistoricalMetricsConfigurationCreateRequest", + }, + "v2.DeleteHistoricalMetricsConfiguration" => { + "metric_name" => "String", + }, + "v2.GetHistoricalMetricsConfiguration" => { + "metric_name" => "String", + }, "v2.ListTagIndexingRules" => { "page_limit" => "Integer", "page_offset" => "Integer", diff --git a/features/v2/metrics.feature b/features/v2/metrics.feature index d463aa4250b4..30517072c692 100644 --- a/features/v2/metrics.feature +++ b/features/v2/metrics.feature @@ -142,6 +142,24 @@ Feature: Metrics When the request is sent Then the response status is 400 Bad Request + @generated @skip @team:DataDog/metrics-experience + Scenario: Delete a historical metrics configuration returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "DeleteHistoricalMetricsConfiguration" enabled + And new "DeleteHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Delete a historical metrics configuration returns "No Content" response + Given a valid "appKeyAuth" key in the system + And operation "DeleteHistoricalMetricsConfiguration" enabled + And new "DeleteHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + @replay-only @skip-validation @team:DataDog/metrics-experience Scenario: Delete a tag configuration returns "No Content" response Given there is a valid "metric" in the system @@ -221,6 +239,78 @@ Feature: Metrics When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "Created" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "OK" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/metrics-experience + Scenario: Enable historical metrics ingestion returns "Unprocessable Entity" response + Given a valid "appKeyAuth" key in the system + And operation "CreateHistoricalMetricsConfiguration" enabled + And new "CreateHistoricalMetricsConfiguration" request + And body with value {"data": {"id": "dd.test.metric", "type": "historical_metrics_configurations"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a historical metrics configuration returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "GetHistoricalMetricsConfiguration" enabled + And new "GetHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a historical metrics configuration returns "Not Found" response + Given a valid "appKeyAuth" key in the system + And operation "GetHistoricalMetricsConfiguration" enabled + And new "GetHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/metrics-experience + Scenario: Get a historical metrics configuration returns "OK" response + Given a valid "appKeyAuth" key in the system + And operation "GetHistoricalMetricsConfiguration" enabled + And new "GetHistoricalMetricsConfiguration" request + And request contains "metric_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/metrics-experience Scenario: Get a list of metrics returns "Bad Request" response Given a valid "appKeyAuth" key in the system diff --git a/features/v2/undo.json b/features/v2/undo.json index 2a7fb64a0a90..f6d33436a51d 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5154,6 +5154,31 @@ "type": "unsafe" } }, + "CreateHistoricalMetricsConfiguration": { + "tag": "Metrics", + "undo": { + "operationId": "DeleteHistoricalMetricsConfiguration", + "parameters": [ + { + "name": "metric_name", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteHistoricalMetricsConfiguration": { + "tag": "Metrics", + "undo": { + "type": "idempotent" + } + }, + "GetHistoricalMetricsConfiguration": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, "ListTagIndexingRules": { "tag": "Metrics", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index f8efb320e7cf..163c7d2ae43f 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -552,10 +552,13 @@ def initialize "v2.remove_role_from_restriction_query": false, "v2.replace_restriction_query": false, "v2.update_restriction_query": false, + "v2.create_historical_metrics_configuration": false, "v2.create_tag_indexing_rule": false, "v2.create_tag_indexing_rule_exemption": false, + "v2.delete_historical_metrics_configuration": false, "v2.delete_tag_indexing_rule": false, "v2.delete_tag_indexing_rule_exemption": false, + "v2.get_historical_metrics_configuration": false, "v2.get_tag_indexing_rule": false, "v2.get_tag_indexing_rule_exemption": false, "v2.list_tag_indexing_rules": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b82d66d48920..fd554b7316b5 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3720,6 +3720,12 @@ def overrides "v2.historical_job_response" => "HistoricalJobResponse", "v2.historical_job_response_attributes" => "HistoricalJobResponseAttributes", "v2.historical_job_response_data" => "HistoricalJobResponseData", + "v2.historical_metrics_configuration_attributes" => "HistoricalMetricsConfigurationAttributes", + "v2.historical_metrics_configuration_create_data" => "HistoricalMetricsConfigurationCreateData", + "v2.historical_metrics_configuration_create_request" => "HistoricalMetricsConfigurationCreateRequest", + "v2.historical_metrics_configuration_data" => "HistoricalMetricsConfigurationData", + "v2.historical_metrics_configuration_response" => "HistoricalMetricsConfigurationResponse", + "v2.historical_metrics_configuration_type" => "HistoricalMetricsConfigurationType", "v2.hourly_usage" => "HourlyUsage", "v2.hourly_usage_attributes" => "HourlyUsageAttributes", "v2.hourly_usage_measurement" => "HourlyUsageMeasurement", diff --git a/lib/datadog_api_client/v2/api/metrics_api.rb b/lib/datadog_api_client/v2/api/metrics_api.rb index bfed3be17776..1b9d68b9c277 100644 --- a/lib/datadog_api_client/v2/api/metrics_api.rb +++ b/lib/datadog_api_client/v2/api/metrics_api.rb @@ -101,6 +101,82 @@ def create_bulk_tags_metrics_configuration_with_http_info(body, opts = {}) return data, status_code, headers end + # Enable historical metrics ingestion. + # + # @see #create_historical_metrics_configuration_with_http_info + def create_historical_metrics_configuration(body, opts = {}) + data, _status_code, _headers = create_historical_metrics_configuration_with_http_info(body, opts) + data + end + + # Enable historical metrics ingestion. + # + # Enable historical metrics ingestion (late data ingestion) for a metric. Idempotent: + # enabling an already-enabled metric returns 200 instead of 201. Not supported for + # distribution metrics, metrics with an existing tag configuration, or most standard + # (non-custom) metrics. + # + # @param body [HistoricalMetricsConfigurationCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(HistoricalMetricsConfigurationResponse, Integer, Hash)>] HistoricalMetricsConfigurationResponse data, response status code and response headers + def create_historical_metrics_configuration_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_historical_metrics_configuration".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_historical_metrics_configuration") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_historical_metrics_configuration")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.create_historical_metrics_configuration ...' + 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 MetricsAPI.create_historical_metrics_configuration" + end + # resource path + local_var_path = '/api/v2/metrics/historical-metrics-configurations' + + # 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] || 'HistoricalMetricsConfigurationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_historical_metrics_configuration, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#create_historical_metrics_configuration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create a tag configuration. # # @see #create_tag_configuration_with_http_info @@ -406,6 +482,79 @@ def delete_bulk_tags_metrics_configuration_with_http_info(body, opts = {}) return data, status_code, headers end + # Delete a historical metrics configuration. + # + # @see #delete_historical_metrics_configuration_with_http_info + def delete_historical_metrics_configuration(metric_name, opts = {}) + delete_historical_metrics_configuration_with_http_info(metric_name, opts) + nil + end + + # Delete a historical metrics configuration. + # + # Disable historical metrics ingestion for a metric. Idempotent: always returns 204, + # whether or not the configuration existed or the metric itself still exists, so that + # Terraform destroy succeeds for a metric removed out-of-band. + # + # @param metric_name [String] The name of the metric. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_historical_metrics_configuration_with_http_info(metric_name, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_historical_metrics_configuration".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_historical_metrics_configuration") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_historical_metrics_configuration")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.delete_historical_metrics_configuration ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.delete_historical_metrics_configuration" + end + # resource path + local_var_path = '/api/v2/metrics/historical-metrics-configurations/{metric_name}'.sub('{metric_name}', CGI.escape(metric_name.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(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_historical_metrics_configuration, + :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: MetricsAPI#delete_historical_metrics_configuration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete a tag configuration. # # @see #delete_tag_configuration_with_http_info @@ -706,6 +855,79 @@ def estimate_metrics_output_series_with_http_info(metric_name, opts = {}) return data, status_code, headers end + # Get a historical metrics configuration. + # + # @see #get_historical_metrics_configuration_with_http_info + def get_historical_metrics_configuration(metric_name, opts = {}) + data, _status_code, _headers = get_historical_metrics_configuration_with_http_info(metric_name, opts) + data + end + + # Get a historical metrics configuration. + # + # Get the historical metrics ingestion configuration for a metric. Existence of the + # resource means historical metrics ingestion is enabled; returns 404 when it is not + # enabled for the metric. + # + # @param metric_name [String] The name of the metric. + # @param opts [Hash] the optional parameters + # @return [Array<(HistoricalMetricsConfigurationResponse, Integer, Hash)>] HistoricalMetricsConfigurationResponse data, response status code and response headers + def get_historical_metrics_configuration_with_http_info(metric_name, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_historical_metrics_configuration".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_historical_metrics_configuration") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_historical_metrics_configuration")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.get_historical_metrics_configuration ...' + end + # verify the required parameter 'metric_name' is set + if @api_client.config.client_side_validation && metric_name.nil? + fail ArgumentError, "Missing the required parameter 'metric_name' when calling MetricsAPI.get_historical_metrics_configuration" + end + # resource path + local_var_path = '/api/v2/metrics/historical-metrics-configurations/{metric_name}'.sub('{metric_name}', CGI.escape(metric_name.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] || 'HistoricalMetricsConfigurationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_historical_metrics_configuration, + :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: MetricsAPI#get_historical_metrics_configuration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get tag key cardinality details. # # @see #get_metric_tag_cardinality_details_with_http_info diff --git a/lib/datadog_api_client/v2/models/historical_metrics_configuration_attributes.rb b/lib/datadog_api_client/v2/models/historical_metrics_configuration_attributes.rb new file mode 100644 index 000000000000..9f766717416b --- /dev/null +++ b/lib/datadog_api_client/v2/models/historical_metrics_configuration_attributes.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 + # Attributes of a historical metrics configuration. + class HistoricalMetricsConfigurationAttributes + include BaseGenericModel + + # Timestamp when historical metrics ingestion was enabled for the metric. + attr_accessor :created_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time' + } + 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::HistoricalMetricsConfigurationAttributes` 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?(:'created_at') + self.created_at = attributes[:'created_at'] + 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 && + created_at == o.created_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/historical_metrics_configuration_create_data.rb b/lib/datadog_api_client/v2/models/historical_metrics_configuration_create_data.rb new file mode 100644 index 000000000000..01b2a1aeb6a7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/historical_metrics_configuration_create_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 object for enabling historical metrics ingestion for a metric. + class HistoricalMetricsConfigurationCreateData + include BaseGenericModel + + # The metric name, used as the resource ID. + attr_reader :id + + # The historical metrics configuration resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'HistoricalMetricsConfigurationType' + } + 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::HistoricalMetricsConfigurationCreateData` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + 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 && + 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 + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/historical_metrics_configuration_create_request.rb b/lib/datadog_api_client/v2/models/historical_metrics_configuration_create_request.rb new file mode 100644 index 000000000000..0d37fff67d93 --- /dev/null +++ b/lib/datadog_api_client/v2/models/historical_metrics_configuration_create_request.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 + # Request body for enabling historical metrics ingestion for a metric. + class HistoricalMetricsConfigurationCreateRequest + include BaseGenericModel + + # Data object for enabling historical metrics ingestion for a metric. + 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' => :'HistoricalMetricsConfigurationCreateData' + } + 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::HistoricalMetricsConfigurationCreateRequest` 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/historical_metrics_configuration_data.rb b/lib/datadog_api_client/v2/models/historical_metrics_configuration_data.rb new file mode 100644 index 000000000000..74326a618e63 --- /dev/null +++ b/lib/datadog_api_client/v2/models/historical_metrics_configuration_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 + # A historical metrics configuration resource object. Existence of this resource means historical metrics ingestion is enabled for the metric; there is no separate enabled attribute. + class HistoricalMetricsConfigurationData + include BaseGenericModel + + # Attributes of a historical metrics configuration. + attr_accessor :attributes + + # The metric name, used as the resource ID. + attr_accessor :id + + # The historical metrics configuration resource type. + 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' => :'HistoricalMetricsConfigurationAttributes', + :'id' => :'String', + :'type' => :'HistoricalMetricsConfigurationType' + } + 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::HistoricalMetricsConfigurationData` 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/historical_metrics_configuration_response.rb b/lib/datadog_api_client/v2/models/historical_metrics_configuration_response.rb new file mode 100644 index 000000000000..b7ddef1f3ade --- /dev/null +++ b/lib/datadog_api_client/v2/models/historical_metrics_configuration_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 containing a historical metrics configuration. + class HistoricalMetricsConfigurationResponse + include BaseGenericModel + + # A historical metrics configuration resource object. Existence of this resource means historical metrics ingestion is enabled for the metric; there is no separate enabled attribute. + 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' => :'HistoricalMetricsConfigurationData' + } + 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::HistoricalMetricsConfigurationResponse` 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/historical_metrics_configuration_type.rb b/lib/datadog_api_client/v2/models/historical_metrics_configuration_type.rb new file mode 100644 index 000000000000..4986590652f1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/historical_metrics_configuration_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 historical metrics configuration resource type. + class HistoricalMetricsConfigurationType + include BaseEnumModel + + HISTORICAL_METRICS_CONFIGURATIONS = "historical_metrics_configurations".freeze + end +end