From e4af703ed03727e30f2184961c7dcb5a4a80c92d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 11 Dec 2024 14:55:02 +0000 Subject: [PATCH] Regenerate client from commit 46d42ec0 of spec repo --- .apigentools-info | 8 +++--- .generator/schemas/v2/openapi.yaml | 9 +++++++ ...data-deletion_CancelDataDeletionRequest.rs | 3 ++- ...data-deletion_CreateDataDeletionRequest.rs | 3 ++- ...2_data-deletion_GetDataDeletionRequests.rs | 3 ++- src/datadog/configuration.rs | 3 +++ src/datadogV2/api/api_data_deletion.rs | 25 +++++++++++++++++++ .../features/v2/data_deletion.feature | 24 ++++++++++++------ 8 files changed, 63 insertions(+), 15 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index e6ae45335..13a2e6289 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-10 21:05:04.906060", - "spec_repo_commit": "1c4c91d4" + "regenerated": "2024-12-11 14:49:38.220364", + "spec_repo_commit": "46d42ec0" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-10 21:05:04.924927", - "spec_repo_commit": "1c4c91d4" + "regenerated": "2024-12-11 14:49:38.238952", + "spec_repo_commit": "46d42ec0" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d765d01bf..c2b1ddb17 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -31239,6 +31239,9 @@ paths: permissions: - rum_delete_data - logs_delete_data + x-unstable: '**Note: This endpoint is in preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' /api/v2/deletion/requests: get: description: Gets a list of data deletion requests based on several filter parameters. @@ -31314,6 +31317,9 @@ paths: permissions: - rum_delete_data - logs_delete_data + x-unstable: '**Note: This endpoint is in preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' /api/v2/deletion/requests/{id}/cancel: put: description: Cancels a data deletion request by providing its ID. @@ -31356,6 +31362,9 @@ paths: permissions: - rum_delete_data - logs_delete_data + x-unstable: '**Note: This endpoint is in preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' /api/v2/domain_allowlist: get: description: Get the domain allowlist for an organization. diff --git a/examples/v2_data-deletion_CancelDataDeletionRequest.rs b/examples/v2_data-deletion_CancelDataDeletionRequest.rs index fc883042a..0617e31ae 100644 --- a/examples/v2_data-deletion_CancelDataDeletionRequest.rs +++ b/examples/v2_data-deletion_CancelDataDeletionRequest.rs @@ -6,7 +6,8 @@ use datadog_api_client::datadogV2::api_data_deletion::DataDeletionAPI; async fn main() { // there is a valid "deletion_request" in the system let deletion_request_data_id = std::env::var("DELETION_REQUEST_DATA_ID").unwrap(); - let configuration = datadog::Configuration::new(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CancelDataDeletionRequest", true); let api = DataDeletionAPI::with_config(configuration); let resp = api .cancel_data_deletion_request(deletion_request_data_id.clone()) diff --git a/examples/v2_data-deletion_CreateDataDeletionRequest.rs b/examples/v2_data-deletion_CreateDataDeletionRequest.rs index b669dcf2c..9088ff0fe 100644 --- a/examples/v2_data-deletion_CreateDataDeletionRequest.rs +++ b/examples/v2_data-deletion_CreateDataDeletionRequest.rs @@ -19,7 +19,8 @@ async fn main() { ) .indexes(vec!["test-index".to_string(), "test-index-2".to_string()]), )); - let configuration = datadog::Configuration::new(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateDataDeletionRequest", true); let api = DataDeletionAPI::with_config(configuration); let resp = api .create_data_deletion_request("logs".to_string(), body) diff --git a/examples/v2_data-deletion_GetDataDeletionRequests.rs b/examples/v2_data-deletion_GetDataDeletionRequests.rs index 86715d91b..f400d668c 100644 --- a/examples/v2_data-deletion_GetDataDeletionRequests.rs +++ b/examples/v2_data-deletion_GetDataDeletionRequests.rs @@ -5,7 +5,8 @@ use datadog_api_client::datadogV2::api_data_deletion::GetDataDeletionRequestsOpt #[tokio::main] async fn main() { - let configuration = datadog::Configuration::new(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetDataDeletionRequests", true); let api = DataDeletionAPI::with_config(configuration); let resp = api .get_data_deletion_requests(GetDataDeletionRequestsOptionalParams::default()) diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index 2672d6143..fd4e835fe 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -137,6 +137,9 @@ impl Default for Configuration { ("v2.get_active_billing_dimensions".to_owned(), false), ("v2.get_billing_dimension_mapping".to_owned(), false), ("v2.get_monthly_cost_attribution".to_owned(), false), + ("v2.cancel_data_deletion_request".to_owned(), false), + ("v2.create_data_deletion_request".to_owned(), false), + ("v2.get_data_deletion_requests".to_owned(), false), ("v2.create_dora_deployment".to_owned(), false), ("v2.create_dora_incident".to_owned(), false), ("v2.create_incident".to_owned(), false), diff --git a/src/datadogV2/api/api_data_deletion.rs b/src/datadogV2/api/api_data_deletion.rs index 232d73f44..24f52fa26 100644 --- a/src/datadogV2/api/api_data_deletion.rs +++ b/src/datadogV2/api/api_data_deletion.rs @@ -6,6 +6,7 @@ use flate2::{ write::{GzEncoder, ZlibEncoder}, Compression, }; +use log::warn; use reqwest::header::{HeaderMap, HeaderValue}; use serde::{Deserialize, Serialize}; use std::io::Write; @@ -175,6 +176,14 @@ impl DataDeletionAPI { > { let local_configuration = &self.config; let operation_id = "v2.cancel_data_deletion_request"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.cancel_data_deletion_request' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; @@ -289,6 +298,14 @@ impl DataDeletionAPI { > { let local_configuration = &self.config; let operation_id = "v2.create_data_deletion_request"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_data_deletion_request' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } let local_client = &self.client; @@ -444,6 +461,14 @@ impl DataDeletionAPI { > { let local_configuration = &self.config; let operation_id = "v2.get_data_deletion_requests"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_data_deletion_requests' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } // unbox and build optional parameters let next_page = params.next_page; diff --git a/tests/scenarios/features/v2/data_deletion.feature b/tests/scenarios/features/v2/data_deletion.feature index 995dd9c0c..fa8a94e55 100644 --- a/tests/scenarios/features/v2/data_deletion.feature +++ b/tests/scenarios/features/v2/data_deletion.feature @@ -11,14 +11,16 @@ Feature: Data Deletion @replay-only @team:DataDog/supportability-engineering Scenario: Cancels a data deletion request returns "Bad Request" response - Given new "CancelDataDeletionRequest" request + Given operation "CancelDataDeletionRequest" enabled + And new "CancelDataDeletionRequest" request And request contains "id" parameter with value "id-1" When the request is sent Then the response status is 400 Bad Request @team:DataDog/supportability-engineering Scenario: Cancels a data deletion request returns "OK" response - Given there is a valid "deletion_request" in the system + Given operation "CancelDataDeletionRequest" enabled + And there is a valid "deletion_request" in the system And new "CancelDataDeletionRequest" request And request contains "id" parameter from "deletion_request.data.id" When the request is sent @@ -30,14 +32,16 @@ Feature: Data Deletion @replay-only @team:DataDog/supportability-engineering Scenario: Cancels a data deletion request returns "Precondition failed error" response - Given new "CancelDataDeletionRequest" request + Given operation "CancelDataDeletionRequest" enabled + And new "CancelDataDeletionRequest" request And request contains "id" parameter with value "-1" When the request is sent Then the response status is 412 Precondition failed error @generated @skip @team:DataDog/supportability-engineering Scenario: Creates a data deletion request returns "Bad Request" response - Given new "CreateDataDeletionRequest" request + Given operation "CreateDataDeletionRequest" enabled + And new "CreateDataDeletionRequest" request And request contains "product" parameter from "REPLACE.ME" And body with value {"data": {"attributes": {"from": 1672527600000, "indexes": ["test-index", "test-index-2"], "query": {"host": "abc", "service": "xyz"}, "to": 1704063600000}}} When the request is sent @@ -45,7 +49,8 @@ Feature: Data Deletion @team:DataDog/supportability-engineering Scenario: Creates a data deletion request returns "OK" response - Given new "CreateDataDeletionRequest" request + Given operation "CreateDataDeletionRequest" enabled + And new "CreateDataDeletionRequest" request And request contains "product" parameter with value "logs" And body with value {"data": {"attributes": {"from": 1672527600000, "indexes": ["test-index", "test-index-2"], "query": {"host": "abc", "service": "xyz"}, "to": 1704063600000}}} When the request is sent @@ -56,7 +61,8 @@ Feature: Data Deletion @replay-only @team:DataDog/supportability-engineering Scenario: Creates a data deletion request returns "Precondition failed error" response - Given new "CreateDataDeletionRequest" request + Given operation "CreateDataDeletionRequest" enabled + And new "CreateDataDeletionRequest" request And request contains "product" parameter with value "logs" And body with value {"data": {"attributes": {"from": 1672527600000, "indexes": ["test-index", "test-index-2"], "query": {}, "to": 1704063600000}}} When the request is sent @@ -64,13 +70,15 @@ Feature: Data Deletion @generated @skip @team:DataDog/supportability-engineering Scenario: Gets a list of data deletion requests returns "Bad Request" response - Given new "GetDataDeletionRequests" request + Given operation "GetDataDeletionRequests" enabled + And new "GetDataDeletionRequests" request When the request is sent Then the response status is 400 Bad Request @team:DataDog/supportability-engineering Scenario: Gets a list of data deletion requests returns "OK" response - Given there is a valid "deletion_request" in the system + Given operation "GetDataDeletionRequests" enabled + And there is a valid "deletion_request" in the system And new "GetDataDeletionRequests" request When the request is sent Then the response status is 200 OK