Skip to content

Commit 37b448f

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3f0422a of spec repo
1 parent 30f93ef commit 37b448f

File tree

7 files changed

+398
-4
lines changed

7 files changed

+398
-4
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52524,6 +52524,39 @@ paths:
5252452524
permissions:
5252552525
- dora_metrics_read
5252652526
/api/v2/dora/deployments/{deployment_id}:
52527+
delete:
52528+
description: Use this API endpoint to delete a deployment event.
52529+
operationId: DeleteDORADeployment
52530+
parameters:
52531+
- description: The ID of the deployment event to delete.
52532+
in: path
52533+
name: deployment_id
52534+
required: true
52535+
schema:
52536+
type: string
52537+
responses:
52538+
'202':
52539+
description: Accepted
52540+
'400':
52541+
content:
52542+
application/json:
52543+
schema:
52544+
$ref: '#/components/schemas/JSONAPIErrorResponse'
52545+
description: Bad Request
52546+
'403':
52547+
$ref: '#/components/responses/NotAuthorizedResponse'
52548+
'429':
52549+
$ref: '#/components/responses/TooManyRequestsResponse'
52550+
security:
52551+
- apiKeyAuth: []
52552+
- appKeyAuth: []
52553+
summary: Delete a deployment event
52554+
tags:
52555+
- DORA Metrics
52556+
x-permission:
52557+
operator: OR
52558+
permissions:
52559+
- dora_metrics_write
5252752560
get:
5252852561
description: Use this API endpoint to get a deployment event.
5252952562
operationId: GetDORADeployment
@@ -52647,6 +52680,39 @@ paths:
5264752680
permissions:
5264852681
- dora_metrics_read
5264952682
/api/v2/dora/failures/{failure_id}:
52683+
delete:
52684+
description: Use this API endpoint to delete a failure event.
52685+
operationId: DeleteDORAFailure
52686+
parameters:
52687+
- description: The ID of the failure event to delete.
52688+
in: path
52689+
name: failure_id
52690+
required: true
52691+
schema:
52692+
type: string
52693+
responses:
52694+
'202':
52695+
description: Accepted
52696+
'400':
52697+
content:
52698+
application/json:
52699+
schema:
52700+
$ref: '#/components/schemas/JSONAPIErrorResponse'
52701+
description: Bad Request
52702+
'403':
52703+
$ref: '#/components/responses/NotAuthorizedResponse'
52704+
'429':
52705+
$ref: '#/components/responses/TooManyRequestsResponse'
52706+
security:
52707+
- apiKeyAuth: []
52708+
- appKeyAuth: []
52709+
summary: Delete a failure event
52710+
tags:
52711+
- DORA Metrics
52712+
x-permission:
52713+
operator: OR
52714+
permissions:
52715+
- dora_metrics_write
5265052716
get:
5265152717
description: Use this API endpoint to get a failure event.
5265252718
operationId: GetDORAFailure
@@ -70392,8 +70458,8 @@ tags:
7039270458
See the [Container Monitoring page](https://docs.datadoghq.com/containers/) for
7039370459
more information.
7039470460
name: Containers
70395-
- description: 'Search or send events for DORA Metrics to measure and improve your
70396-
software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/)
70461+
- description: 'Search, send or delete events for DORA Metrics to measure and improve
70462+
your software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/)
7039770463
for more information.
7039870464

7039970465

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Delete a deployment event returns "Accepted" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_dora_metrics::DORAMetricsAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = DORAMetricsAPI::with_config(configuration);
9+
let resp = api
10+
.delete_dora_deployment("deployment_id".to_string())
11+
.await;
12+
if let Ok(value) = resp {
13+
println!("{:#?}", value);
14+
} else {
15+
println!("{:#?}", resp.unwrap_err());
16+
}
17+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Delete a failure event returns "Accepted" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_dora_metrics::DORAMetricsAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let configuration = datadog::Configuration::new();
8+
let api = DORAMetricsAPI::with_config(configuration);
9+
let resp = api.delete_dora_failure("failure_id".to_string()).await;
10+
if let Ok(value) = resp {
11+
println!("{:#?}", value);
12+
} else {
13+
println!("{:#?}", resp.unwrap_err());
14+
}
15+
}

src/datadogV2/api/api_dora_metrics.rs

Lines changed: 198 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,24 @@ pub enum CreateDORAIncidentError {
3737
UnknownValue(serde_json::Value),
3838
}
3939

40+
/// DeleteDORADeploymentError is a struct for typed errors of method [`DORAMetricsAPI::delete_dora_deployment`]
41+
#[derive(Debug, Clone, Serialize, Deserialize)]
42+
#[serde(untagged)]
43+
pub enum DeleteDORADeploymentError {
44+
JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse),
45+
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
46+
UnknownValue(serde_json::Value),
47+
}
48+
49+
/// DeleteDORAFailureError is a struct for typed errors of method [`DORAMetricsAPI::delete_dora_failure`]
50+
#[derive(Debug, Clone, Serialize, Deserialize)]
51+
#[serde(untagged)]
52+
pub enum DeleteDORAFailureError {
53+
JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse),
54+
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
55+
UnknownValue(serde_json::Value),
56+
}
57+
4058
/// GetDORADeploymentError is a struct for typed errors of method [`DORAMetricsAPI::get_dora_deployment`]
4159
#[derive(Debug, Clone, Serialize, Deserialize)]
4260
#[serde(untagged)]
@@ -73,7 +91,7 @@ pub enum ListDORAFailuresError {
7391
UnknownValue(serde_json::Value),
7492
}
7593

76-
/// 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/>) for more information.
94+
/// 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.
7795
///
7896
/// **Note**: DORA Metrics are not available in the US1-FED site.
7997
#[derive(Debug, Clone)]
@@ -607,6 +625,185 @@ impl DORAMetricsAPI {
607625
}
608626
}
609627

628+
/// Use this API endpoint to delete a deployment event.
629+
pub async fn delete_dora_deployment(
630+
&self,
631+
deployment_id: String,
632+
) -> Result<(), datadog::Error<DeleteDORADeploymentError>> {
633+
match self
634+
.delete_dora_deployment_with_http_info(deployment_id)
635+
.await
636+
{
637+
Ok(_) => Ok(()),
638+
Err(err) => Err(err),
639+
}
640+
}
641+
642+
/// Use this API endpoint to delete a deployment event.
643+
pub async fn delete_dora_deployment_with_http_info(
644+
&self,
645+
deployment_id: String,
646+
) -> Result<datadog::ResponseContent<()>, datadog::Error<DeleteDORADeploymentError>> {
647+
let local_configuration = &self.config;
648+
let operation_id = "v2.delete_dora_deployment";
649+
650+
let local_client = &self.client;
651+
652+
let local_uri_str = format!(
653+
"{}/api/v2/dora/deployments/{deployment_id}",
654+
local_configuration.get_operation_host(operation_id),
655+
deployment_id = datadog::urlencode(deployment_id)
656+
);
657+
let mut local_req_builder =
658+
local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
659+
660+
// build headers
661+
let mut headers = HeaderMap::new();
662+
headers.insert("Accept", HeaderValue::from_static("*/*"));
663+
664+
// build user agent
665+
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
666+
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
667+
Err(e) => {
668+
log::warn!("Failed to parse user agent header: {e}, falling back to default");
669+
headers.insert(
670+
reqwest::header::USER_AGENT,
671+
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
672+
)
673+
}
674+
};
675+
676+
// build auth
677+
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
678+
headers.insert(
679+
"DD-API-KEY",
680+
HeaderValue::from_str(local_key.key.as_str())
681+
.expect("failed to parse DD-API-KEY header"),
682+
);
683+
};
684+
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
685+
headers.insert(
686+
"DD-APPLICATION-KEY",
687+
HeaderValue::from_str(local_key.key.as_str())
688+
.expect("failed to parse DD-APPLICATION-KEY header"),
689+
);
690+
};
691+
692+
local_req_builder = local_req_builder.headers(headers);
693+
let local_req = local_req_builder.build()?;
694+
log::debug!("request content: {:?}", local_req.body());
695+
let local_resp = local_client.execute(local_req).await?;
696+
697+
let local_status = local_resp.status();
698+
let local_content = local_resp.text().await?;
699+
log::debug!("response content: {}", local_content);
700+
701+
if !local_status.is_client_error() && !local_status.is_server_error() {
702+
Ok(datadog::ResponseContent {
703+
status: local_status,
704+
content: local_content,
705+
entity: None,
706+
})
707+
} else {
708+
let local_entity: Option<DeleteDORADeploymentError> =
709+
serde_json::from_str(&local_content).ok();
710+
let local_error = datadog::ResponseContent {
711+
status: local_status,
712+
content: local_content,
713+
entity: local_entity,
714+
};
715+
Err(datadog::Error::ResponseError(local_error))
716+
}
717+
}
718+
719+
/// Use this API endpoint to delete a failure event.
720+
pub async fn delete_dora_failure(
721+
&self,
722+
failure_id: String,
723+
) -> Result<(), datadog::Error<DeleteDORAFailureError>> {
724+
match self.delete_dora_failure_with_http_info(failure_id).await {
725+
Ok(_) => Ok(()),
726+
Err(err) => Err(err),
727+
}
728+
}
729+
730+
/// Use this API endpoint to delete a failure event.
731+
pub async fn delete_dora_failure_with_http_info(
732+
&self,
733+
failure_id: String,
734+
) -> Result<datadog::ResponseContent<()>, datadog::Error<DeleteDORAFailureError>> {
735+
let local_configuration = &self.config;
736+
let operation_id = "v2.delete_dora_failure";
737+
738+
let local_client = &self.client;
739+
740+
let local_uri_str = format!(
741+
"{}/api/v2/dora/failures/{failure_id}",
742+
local_configuration.get_operation_host(operation_id),
743+
failure_id = datadog::urlencode(failure_id)
744+
);
745+
let mut local_req_builder =
746+
local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
747+
748+
// build headers
749+
let mut headers = HeaderMap::new();
750+
headers.insert("Accept", HeaderValue::from_static("*/*"));
751+
752+
// build user agent
753+
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
754+
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
755+
Err(e) => {
756+
log::warn!("Failed to parse user agent header: {e}, falling back to default");
757+
headers.insert(
758+
reqwest::header::USER_AGENT,
759+
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
760+
)
761+
}
762+
};
763+
764+
// build auth
765+
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
766+
headers.insert(
767+
"DD-API-KEY",
768+
HeaderValue::from_str(local_key.key.as_str())
769+
.expect("failed to parse DD-API-KEY header"),
770+
);
771+
};
772+
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
773+
headers.insert(
774+
"DD-APPLICATION-KEY",
775+
HeaderValue::from_str(local_key.key.as_str())
776+
.expect("failed to parse DD-APPLICATION-KEY header"),
777+
);
778+
};
779+
780+
local_req_builder = local_req_builder.headers(headers);
781+
let local_req = local_req_builder.build()?;
782+
log::debug!("request content: {:?}", local_req.body());
783+
let local_resp = local_client.execute(local_req).await?;
784+
785+
let local_status = local_resp.status();
786+
let local_content = local_resp.text().await?;
787+
log::debug!("response content: {}", local_content);
788+
789+
if !local_status.is_client_error() && !local_status.is_server_error() {
790+
Ok(datadog::ResponseContent {
791+
status: local_status,
792+
content: local_content,
793+
entity: None,
794+
})
795+
} else {
796+
let local_entity: Option<DeleteDORAFailureError> =
797+
serde_json::from_str(&local_content).ok();
798+
let local_error = datadog::ResponseContent {
799+
status: local_status,
800+
content: local_content,
801+
entity: local_entity,
802+
};
803+
Err(datadog::Error::ResponseError(local_error))
804+
}
805+
}
806+
610807
/// Use this API endpoint to get a deployment event.
611808
pub async fn get_dora_deployment(
612809
&self,

tests/scenarios/features/v2/dora_metrics.feature

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@endpoint(dora-metrics) @endpoint(dora-metrics-v2)
22
Feature: DORA Metrics
3-
Search or send events for DORA Metrics to measure and improve your
3+
Search, send or delete events for DORA Metrics to measure and improve your
44
software delivery performance. See the [DORA Metrics
55
page](https://docs.datadoghq.com/dora_metrics/) for more information.
66
**Note**: DORA Metrics are not available in the US1-FED site.
@@ -9,6 +9,34 @@ Feature: DORA Metrics
99
Given a valid "apiKeyAuth" key in the system
1010
And an instance of "DORAMetrics" API
1111

12+
@generated @skip @team:DataDog/ci-app-backend
13+
Scenario: Delete a deployment event returns "Accepted" response
14+
Given new "DeleteDORADeployment" request
15+
And request contains "deployment_id" parameter from "REPLACE.ME"
16+
When the request is sent
17+
Then the response status is 202 Accepted
18+
19+
@generated @skip @team:DataDog/ci-app-backend
20+
Scenario: Delete a deployment event returns "Bad Request" response
21+
Given new "DeleteDORADeployment" request
22+
And request contains "deployment_id" parameter from "REPLACE.ME"
23+
When the request is sent
24+
Then the response status is 400 Bad Request
25+
26+
@generated @skip @team:DataDog/ci-app-backend
27+
Scenario: Delete a failure event returns "Accepted" response
28+
Given new "DeleteDORAFailure" request
29+
And request contains "failure_id" parameter from "REPLACE.ME"
30+
When the request is sent
31+
Then the response status is 202 Accepted
32+
33+
@generated @skip @team:DataDog/ci-app-backend
34+
Scenario: Delete a failure event returns "Bad Request" response
35+
Given new "DeleteDORAFailure" request
36+
And request contains "failure_id" parameter from "REPLACE.ME"
37+
When the request is sent
38+
Then the response status is 400 Bad Request
39+
1240
@generated @skip @team:DataDog/ci-app-backend
1341
Scenario: Get a deployment event returns "Bad Request" response
1442
Given new "GetDORADeployment" request

0 commit comments

Comments
 (0)