@@ -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 ,
0 commit comments