diff --git a/.apigentools-info b/.apigentools-info index 08eb6e2c907c..e21359b6ae44 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-03-06 18:30:10.435668", - "spec_repo_commit": "fb234cde" + "regenerated": "2025-03-06 19:05:43.111831", + "spec_repo_commit": "b892dbfc" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-03-06 18:30:10.454101", - "spec_repo_commit": "fb234cde" + "regenerated": "2025-03-06 19:05:43.127161", + "spec_repo_commit": "b892dbfc" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 9e744b27dca2..e3844da6d04f 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -28758,6 +28758,47 @@ paths: permissions: - logs_modify_indexes /api/v1/logs/config/indexes/{name}: + delete: + description: 'Delete an existing index from your organization. Index deletions + are permanent and cannot be reverted. + + You cannot recreate an index with the same name as deleted ones.' + operationId: DeleteLogsIndex + parameters: + - description: Name of the log index. + in: path + name: name + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/LogsIndex' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/LogsAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete an index + tags: + - Logs Indexes + x-permission: + operator: OR + permissions: + - logs_modify_indexes get: description: Get one log index from your organization. This endpoint takes no JSON arguments. diff --git a/examples/v1/logs-indexes/DeleteLogsIndex.rb b/examples/v1/logs-indexes/DeleteLogsIndex.rb new file mode 100644 index 000000000000..ef0db6f29900 --- /dev/null +++ b/examples/v1/logs-indexes/DeleteLogsIndex.rb @@ -0,0 +1,5 @@ +# Delete an index returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::LogsIndexesAPI.new +p api_instance.delete_logs_index("name") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 8822ab3f55a1..fc7cc64f12bb 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -500,6 +500,9 @@ "v1.CreateLogsIndex" => { "body" => "LogsIndex", }, + "v1.DeleteLogsIndex" => { + "name" => "String", + }, "v1.GetLogsIndex" => { "name" => "String", }, diff --git a/features/v1/logs_indexes.feature b/features/v1/logs_indexes.feature index e346777d32d5..635c2399c5bf 100644 --- a/features/v1/logs_indexes.feature +++ b/features/v1/logs_indexes.feature @@ -22,6 +22,20 @@ Feature: Logs Indexes When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core + Scenario: Delete an index returns "Not Found" response + Given new "DeleteLogsIndex" request + And request contains "name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core + Scenario: Delete an index returns "OK" response + Given new "DeleteLogsIndex" request + And request contains "name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core Scenario: Get all indexes returns "OK" response Given new "ListLogIndexes" request diff --git a/features/v1/undo.json b/features/v1/undo.json index 85e17f2caf45..f2bfacfa4860 100644 --- a/features/v1/undo.json +++ b/features/v1/undo.json @@ -694,6 +694,12 @@ "type": "unsafe" } }, + "DeleteLogsIndex": { + "tag": "Logs Indexes", + "undo": { + "type": "idempotent" + } + }, "GetLogsIndex": { "tag": "Logs Indexes", "undo": { diff --git a/lib/datadog_api_client/v1/api/logs_indexes_api.rb b/lib/datadog_api_client/v1/api/logs_indexes_api.rb index 3bed7ce1a7c9..4981ea9aa5b3 100644 --- a/lib/datadog_api_client/v1/api/logs_indexes_api.rb +++ b/lib/datadog_api_client/v1/api/logs_indexes_api.rb @@ -90,6 +90,72 @@ def create_logs_index_with_http_info(body, opts = {}) return data, status_code, headers end + # Delete an index. + # + # @see #delete_logs_index_with_http_info + def delete_logs_index(name, opts = {}) + data, _status_code, _headers = delete_logs_index_with_http_info(name, opts) + data + end + + # Delete an index. + # + # Delete an existing index from your organization. Index deletions are permanent and cannot be reverted. + # You cannot recreate an index with the same name as deleted ones. + # + # @param name [String] Name of the log index. + # @param opts [Hash] the optional parameters + # @return [Array<(LogsIndex, Integer, Hash)>] LogsIndex data, response status code and response headers + def delete_logs_index_with_http_info(name, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogsIndexesAPI.delete_logs_index ...' + end + # verify the required parameter 'name' is set + if @api_client.config.client_side_validation && name.nil? + fail ArgumentError, "Missing the required parameter 'name' when calling LogsIndexesAPI.delete_logs_index" + end + # resource path + local_var_path = '/api/v1/logs/config/indexes/{name}'.sub('{name}', CGI.escape(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] || 'LogsIndex' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_logs_index, + :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 => "V1" + ) + + 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: LogsIndexesAPI#delete_logs_index\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get an index. # # @see #get_logs_index_with_http_info