Skip to content

Commit 088d5b0

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit f9ece58 of spec repo
1 parent dffc362 commit 088d5b0

File tree

7 files changed

+402
-5
lines changed

7 files changed

+402
-5
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54470,6 +54470,40 @@ paths:
5447054470
tags:
5447154471
- DORA Metrics
5447254472
x-codegen-request-body-name: body
54473+
/api/v2/dora/deployment/{deployment_id}:
54474+
delete:
54475+
description: Use this API endpoint to delete a deployment event.
54476+
operationId: DeleteDORADeployment
54477+
parameters:
54478+
- description: The ID of the deployment event to delete.
54479+
in: path
54480+
name: deployment_id
54481+
required: true
54482+
schema:
54483+
type: string
54484+
responses:
54485+
'202':
54486+
description: Accepted
54487+
'400':
54488+
content:
54489+
application/json:
54490+
schema:
54491+
$ref: '#/components/schemas/JSONAPIErrorResponse'
54492+
description: Bad Request
54493+
'403':
54494+
$ref: '#/components/responses/NotAuthorizedResponse'
54495+
'429':
54496+
$ref: '#/components/responses/TooManyRequestsResponse'
54497+
security:
54498+
- apiKeyAuth: []
54499+
- appKeyAuth: []
54500+
summary: Delete a deployment event
54501+
tags:
54502+
- DORA Metrics
54503+
x-permission:
54504+
operator: OR
54505+
permissions:
54506+
- dora_metrics_write
5447354507
/api/v2/dora/deployments:
5447454508
post:
5447554509
description: Use this API endpoint to get a list of deployment events.
@@ -54593,6 +54627,40 @@ paths:
5459354627
tags:
5459454628
- DORA Metrics
5459554629
x-codegen-request-body-name: body
54630+
/api/v2/dora/failure/{failure_id}:
54631+
delete:
54632+
description: Use this API endpoint to delete a failure event.
54633+
operationId: DeleteDORAFailure
54634+
parameters:
54635+
- description: The ID of the failure event to delete.
54636+
in: path
54637+
name: failure_id
54638+
required: true
54639+
schema:
54640+
type: string
54641+
responses:
54642+
'202':
54643+
description: Accepted
54644+
'400':
54645+
content:
54646+
application/json:
54647+
schema:
54648+
$ref: '#/components/schemas/JSONAPIErrorResponse'
54649+
description: Bad Request
54650+
'403':
54651+
$ref: '#/components/responses/NotAuthorizedResponse'
54652+
'429':
54653+
$ref: '#/components/responses/TooManyRequestsResponse'
54654+
security:
54655+
- apiKeyAuth: []
54656+
- appKeyAuth: []
54657+
summary: Delete a failure event
54658+
tags:
54659+
- DORA Metrics
54660+
x-permission:
54661+
operator: OR
54662+
permissions:
54663+
- dora_metrics_write
5459654664
/api/v2/dora/failures:
5459754665
post:
5459854666
description: Use this API endpoint to get a list of failure events.
@@ -72976,8 +73044,8 @@ tags:
7297673044
See the [Container Monitoring page](https://docs.datadoghq.com/containers/) for
7297773045
more information.
7297873046
name: Containers
72979-
- description: 'Search or send events for DORA Metrics to measure and improve your
72980-
software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/)
73047+
- description: 'Search, send, or delete events for DORA Metrics to measure and improve
73048+
your software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/)
7298173049
for more information.
7298273050

7298373051

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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.delete_dora_deployment("NO_VALUE".to_string()).await;
10+
if let Ok(value) = resp {
11+
println!("{:#?}", value);
12+
} else {
13+
println!("{:#?}", resp.unwrap_err());
14+
}
15+
}
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("NO_VALUE".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/deployment/{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/failure/{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: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
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
4-
software delivery performance. See the [DORA Metrics
3+
Search, send, or delete events for DORA Metrics to measure and improve
4+
your 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.
77

88
Background:
99
Given a valid "apiKeyAuth" key in the system
1010
And an instance of "DORAMetrics" API
1111

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

0 commit comments

Comments
 (0)