Skip to content

Commit 5dabf86

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3584508 of spec repo
1 parent 7a3c840 commit 5dabf86

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
@@ -56843,6 +56843,40 @@ paths:
5684356843
tags:
5684456844
- DORA Metrics
5684556845
x-codegen-request-body-name: body
56846+
/api/v2/dora/deployment/{deployment_id}:
56847+
delete:
56848+
description: Use this API endpoint to delete a deployment event.
56849+
operationId: DeleteDORADeployment
56850+
parameters:
56851+
- description: The ID of the deployment event to delete.
56852+
in: path
56853+
name: deployment_id
56854+
required: true
56855+
schema:
56856+
type: string
56857+
responses:
56858+
'202':
56859+
description: Accepted
56860+
'400':
56861+
content:
56862+
application/json:
56863+
schema:
56864+
$ref: '#/components/schemas/JSONAPIErrorResponse'
56865+
description: Bad Request
56866+
'403':
56867+
$ref: '#/components/responses/NotAuthorizedResponse'
56868+
'429':
56869+
$ref: '#/components/responses/TooManyRequestsResponse'
56870+
security:
56871+
- apiKeyAuth: []
56872+
- appKeyAuth: []
56873+
summary: Delete a deployment event
56874+
tags:
56875+
- DORA Metrics
56876+
x-permission:
56877+
operator: OR
56878+
permissions:
56879+
- dora_metrics_write
5684656880
/api/v2/dora/deployments:
5684756881
post:
5684856882
description: Use this API endpoint to get a list of deployment events.
@@ -56966,6 +57000,40 @@ paths:
5696657000
tags:
5696757001
- DORA Metrics
5696857002
x-codegen-request-body-name: body
57003+
/api/v2/dora/failure/{failure_id}:
57004+
delete:
57005+
description: Use this API endpoint to delete a failure event.
57006+
operationId: DeleteDORAFailure
57007+
parameters:
57008+
- description: The ID of the failure event to delete.
57009+
in: path
57010+
name: failure_id
57011+
required: true
57012+
schema:
57013+
type: string
57014+
responses:
57015+
'202':
57016+
description: Accepted
57017+
'400':
57018+
content:
57019+
application/json:
57020+
schema:
57021+
$ref: '#/components/schemas/JSONAPIErrorResponse'
57022+
description: Bad Request
57023+
'403':
57024+
$ref: '#/components/responses/NotAuthorizedResponse'
57025+
'429':
57026+
$ref: '#/components/responses/TooManyRequestsResponse'
57027+
security:
57028+
- apiKeyAuth: []
57029+
- appKeyAuth: []
57030+
summary: Delete a failure event
57031+
tags:
57032+
- DORA Metrics
57033+
x-permission:
57034+
operator: OR
57035+
permissions:
57036+
- dora_metrics_write
5696957037
/api/v2/dora/failures:
5697057038
post:
5697157039
description: Use this API endpoint to get a list of failure events.
@@ -75655,8 +75723,8 @@ tags:
7565575723
See the [Container Monitoring page](https://docs.datadoghq.com/containers/) for
7565675724
more information.
7565775725
name: Containers
75658-
- description: 'Search or send events for DORA Metrics to measure and improve your
75659-
software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/)
75726+
- description: 'Search, send, or delete events for DORA Metrics to measure and improve
75727+
your software delivery performance. See the [DORA Metrics page](https://docs.datadoghq.com/dora_metrics/)
7566075728
for more information.
7566175729

7566275730

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)