Skip to content

Commit

Permalink
Regenerate client from commit 46d42ec0 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Dec 11, 2024
1 parent eced6dc commit e4af703
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
9 changes: 9 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion examples/v2_data-deletion_CancelDataDeletionRequest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
3 changes: 2 additions & 1 deletion examples/v2_data-deletion_CreateDataDeletionRequest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion examples/v2_data-deletion_GetDataDeletionRequests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
3 changes: 3 additions & 0 deletions src/datadog/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
25 changes: 25 additions & 0 deletions src/datadogV2/api/api_data_deletion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
24 changes: 16 additions & 8 deletions tests/scenarios/features/v2/data_deletion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,22 +32,25 @@ 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
Then the response status is 400 Bad Request

@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
Expand All @@ -56,21 +61,24 @@ 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
Then the response status is 412 Precondition failed error

@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

0 comments on commit e4af703

Please sign in to comment.