From 5dabf86d4406071c736ef61f89172ba78be27832 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 19 Sep 2025 09:53:47 +0000 Subject: [PATCH] Regenerate client from commit 3584508 of spec repo --- .generator/schemas/v2/openapi.yaml | 72 ++++++- .../v2_dora-metrics_DeleteDORADeployment.rs | 15 ++ examples/v2_dora-metrics_DeleteDORAFailure.rs | 15 ++ src/datadogV2/api/api_dora_metrics.rs | 199 +++++++++++++++++- .../features/v2/dora_metrics.feature | 35 ++- tests/scenarios/features/v2/undo.json | 12 ++ tests/scenarios/function_mappings.rs | 59 ++++++ 7 files changed, 402 insertions(+), 5 deletions(-) create mode 100644 examples/v2_dora-metrics_DeleteDORADeployment.rs create mode 100644 examples/v2_dora-metrics_DeleteDORAFailure.rs diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5f50db2f7..d3d603bec 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -56843,6 +56843,40 @@ paths: tags: - DORA Metrics x-codegen-request-body-name: body + /api/v2/dora/deployment/{deployment_id}: + delete: + description: Use this API endpoint to delete a deployment event. + operationId: DeleteDORADeployment + parameters: + - description: The ID of the deployment event to delete. + in: path + name: deployment_id + required: true + schema: + type: string + responses: + '202': + description: Accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + - appKeyAuth: [] + summary: Delete a deployment event + tags: + - DORA Metrics + x-permission: + operator: OR + permissions: + - dora_metrics_write /api/v2/dora/deployments: post: description: Use this API endpoint to get a list of deployment events. @@ -56966,6 +57000,40 @@ paths: tags: - DORA Metrics x-codegen-request-body-name: body + /api/v2/dora/failure/{failure_id}: + delete: + description: Use this API endpoint to delete a failure event. + operationId: DeleteDORAFailure + parameters: + - description: The ID of the failure event to delete. + in: path + name: failure_id + required: true + schema: + type: string + responses: + '202': + description: Accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + - appKeyAuth: [] + summary: Delete a failure event + tags: + - DORA Metrics + x-permission: + operator: OR + permissions: + - dora_metrics_write /api/v2/dora/failures: post: description: Use this API endpoint to get a list of failure events. @@ -75655,8 +75723,8 @@ tags: See the [Container Monitoring page](https://docs.datadoghq.com/containers/) for more information. name: Containers -- description: 'Search or send events for DORA Metrics to measure and improve your - software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/) +- description: 'Search, send, or delete events for DORA Metrics to measure and improve + your software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/) for more information. diff --git a/examples/v2_dora-metrics_DeleteDORADeployment.rs b/examples/v2_dora-metrics_DeleteDORADeployment.rs new file mode 100644 index 000000000..b435ac206 --- /dev/null +++ b/examples/v2_dora-metrics_DeleteDORADeployment.rs @@ -0,0 +1,15 @@ +// Delete a deployment event returns "Accepted" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_dora_metrics::DORAMetricsAPI; + +#[tokio::main] +async fn main() { + let configuration = datadog::Configuration::new(); + let api = DORAMetricsAPI::with_config(configuration); + let resp = api.delete_dora_deployment("NO_VALUE".to_string()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_dora-metrics_DeleteDORAFailure.rs b/examples/v2_dora-metrics_DeleteDORAFailure.rs new file mode 100644 index 000000000..b61d17712 --- /dev/null +++ b/examples/v2_dora-metrics_DeleteDORAFailure.rs @@ -0,0 +1,15 @@ +// Delete a failure event returns "Accepted" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_dora_metrics::DORAMetricsAPI; + +#[tokio::main] +async fn main() { + let configuration = datadog::Configuration::new(); + let api = DORAMetricsAPI::with_config(configuration); + let resp = api.delete_dora_failure("NO_VALUE".to_string()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadogV2/api/api_dora_metrics.rs b/src/datadogV2/api/api_dora_metrics.rs index 3df096c96..92840c82e 100644 --- a/src/datadogV2/api/api_dora_metrics.rs +++ b/src/datadogV2/api/api_dora_metrics.rs @@ -37,6 +37,24 @@ pub enum CreateDORAIncidentError { UnknownValue(serde_json::Value), } +/// DeleteDORADeploymentError is a struct for typed errors of method [`DORAMetricsAPI::delete_dora_deployment`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteDORADeploymentError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteDORAFailureError is a struct for typed errors of method [`DORAMetricsAPI::delete_dora_failure`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteDORAFailureError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// GetDORADeploymentError is a struct for typed errors of method [`DORAMetricsAPI::get_dora_deployment`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -73,7 +91,7 @@ pub enum ListDORAFailuresError { UnknownValue(serde_json::Value), } -/// Search or send events for DORA Metrics to measure and improve your software delivery performance. See the [DORA Metrics page]() for more information. +/// Search, send, or delete events for DORA Metrics to measure and improve your software delivery performance. See the [DORA Metrics page]() for more information. /// /// **Note**: DORA Metrics are not available in the US1-FED site. #[derive(Debug, Clone)] @@ -607,6 +625,185 @@ impl DORAMetricsAPI { } } + /// Use this API endpoint to delete a deployment event. + pub async fn delete_dora_deployment( + &self, + deployment_id: String, + ) -> Result<(), datadog::Error> { + match self + .delete_dora_deployment_with_http_info(deployment_id) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Use this API endpoint to delete a deployment event. + pub async fn delete_dora_deployment_with_http_info( + &self, + deployment_id: String, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.delete_dora_deployment"; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/dora/deployment/{deployment_id}", + local_configuration.get_operation_host(operation_id), + deployment_id = datadog::urlencode(deployment_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Use this API endpoint to delete a failure event. + pub async fn delete_dora_failure( + &self, + failure_id: String, + ) -> Result<(), datadog::Error> { + match self.delete_dora_failure_with_http_info(failure_id).await { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Use this API endpoint to delete a failure event. + pub async fn delete_dora_failure_with_http_info( + &self, + failure_id: String, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.delete_dora_failure"; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/dora/failure/{failure_id}", + local_configuration.get_operation_host(operation_id), + failure_id = datadog::urlencode(failure_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + /// Use this API endpoint to get a deployment event. pub async fn get_dora_deployment( &self, diff --git a/tests/scenarios/features/v2/dora_metrics.feature b/tests/scenarios/features/v2/dora_metrics.feature index acc8230e3..e34092056 100644 --- a/tests/scenarios/features/v2/dora_metrics.feature +++ b/tests/scenarios/features/v2/dora_metrics.feature @@ -1,7 +1,7 @@ @endpoint(dora-metrics) @endpoint(dora-metrics-v2) Feature: DORA Metrics - Search or send events for DORA Metrics to measure and improve your - software delivery performance. See the [DORA Metrics + Search, send, or delete events for DORA Metrics to measure and improve + your software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/) for more information. **Note**: DORA Metrics are not available in the US1-FED site. @@ -9,6 +9,37 @@ Feature: DORA Metrics Given a valid "apiKeyAuth" key in the system And an instance of "DORAMetrics" API + @skip @team:DataDog/ci-app-backend + Scenario: Delete a deployment event returns "Accepted" response + Given new "DeleteDORADeployment" request + And a valid "appKeyAuth" key in the system + And request contains "deployment_id" parameter with value "NO_VALUE" + When the request is sent + Then the response status is 202 Accepted + + @skip @team:DataDog/ci-app-backend + Scenario: Delete a deployment event returns "Bad Request" response + Given new "DeleteDORADeployment" request + And request contains "deployment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Delete a failure event returns "Accepted" response + Given new "DeleteDORAFailure" request + And a valid "appKeyAuth" key in the system + And request contains "failure_id" parameter with value "NO_VALUE" + When the request is sent + Then the response status is 202 Accepted + + @skip @team:DataDog/ci-app-backend + Scenario: Delete a failure event returns "Bad Request" response + Given new "DeleteDORAFailure" request + And a valid "appKeyAuth" key in the system + And request contains "failure_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:DataDog/ci-app-backend Scenario: Get a deployment event returns "Bad Request" response Given new "GetDORADeployment" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 7f8336d49..d864e99bb 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -1064,6 +1064,12 @@ "type": "idempotent" } }, + "DeleteDORADeployment": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "ListDORADeployments": { "tag": "DORA Metrics", "undo": { @@ -1082,6 +1088,12 @@ "type": "idempotent" } }, + "DeleteDORAFailure": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "ListDORAFailures": { "tag": "DORA Metrics", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index ab7ce3897..80722e6ea 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -2644,6 +2644,10 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.CreateDORADeployment".into(), test_v2_create_dora_deployment, ); + world.function_mappings.insert( + "v2.DeleteDORADeployment".into(), + test_v2_delete_dora_deployment, + ); world.function_mappings.insert( "v2.ListDORADeployments".into(), test_v2_list_dora_deployments, @@ -2654,6 +2658,9 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.CreateDORAFailure".into(), test_v2_create_dora_failure); + world + .function_mappings + .insert("v2.DeleteDORAFailure".into(), test_v2_delete_dora_failure); world .function_mappings .insert("v2.ListDORAFailures".into(), test_v2_list_dora_failures); @@ -19529,6 +19536,32 @@ fn test_v2_create_dora_deployment(world: &mut DatadogWorld, _parameters: &HashMa world.response.code = response.status.as_u16(); } +fn test_v2_delete_dora_deployment(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_dora_metrics + .as_ref() + .expect("api instance not found"); + let deployment_id = + serde_json::from_value(_parameters.get("deployment_id").unwrap().clone()).unwrap(); + let response = match block_on(api.delete_dora_deployment_with_http_info(deployment_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_dora_deployments(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances @@ -19605,6 +19638,32 @@ fn test_v2_create_dora_failure(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_dora_metrics + .as_ref() + .expect("api instance not found"); + let failure_id = + serde_json::from_value(_parameters.get("failure_id").unwrap().clone()).unwrap(); + let response = match block_on(api.delete_dora_failure_with_http_info(failure_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_dora_failures(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances