@@ -97,6 +97,14 @@ pub enum DeleteFleetScheduleError {
9797 UnknownValue ( serde_json:: Value ) ,
9898}
9999
100+ /// GetFleetAgentInfoError is a struct for typed errors of method [`FleetAutomationAPI::get_fleet_agent_info`]
101+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
102+ #[ serde( untagged) ]
103+ pub enum GetFleetAgentInfoError {
104+ APIErrorResponse ( crate :: datadogV2:: model:: APIErrorResponse ) ,
105+ UnknownValue ( serde_json:: Value ) ,
106+ }
107+
100108/// GetFleetDeploymentError is a struct for typed errors of method [`FleetAutomationAPI::get_fleet_deployment`]
101109#[ derive( Debug , Clone , Serialize , Deserialize ) ]
102110#[ serde( untagged) ]
@@ -1002,6 +1010,133 @@ impl FleetAutomationAPI {
10021010 }
10031011 }
10041012
1013+ /// Retrieve detailed information about a specific Datadog Agent.
1014+ /// This endpoint returns comprehensive information about an agent including:
1015+ /// - Agent details and metadata
1016+ /// - Configured integrations organized by status (working, warning, error, missing)
1017+ /// - Detected integrations
1018+ /// - Configuration files and layers
1019+ pub async fn get_fleet_agent_info (
1020+ & self ,
1021+ agent_key : String ,
1022+ ) -> Result <
1023+ crate :: datadogV2:: model:: FleetAgentInfoResponse ,
1024+ datadog:: Error < GetFleetAgentInfoError > ,
1025+ > {
1026+ match self . get_fleet_agent_info_with_http_info ( agent_key) . await {
1027+ Ok ( response_content) => {
1028+ if let Some ( e) = response_content. entity {
1029+ Ok ( e)
1030+ } else {
1031+ Err ( datadog:: Error :: Serde ( serde:: de:: Error :: custom (
1032+ "response content was None" ,
1033+ ) ) )
1034+ }
1035+ }
1036+ Err ( err) => Err ( err) ,
1037+ }
1038+ }
1039+
1040+ /// Retrieve detailed information about a specific Datadog Agent.
1041+ /// This endpoint returns comprehensive information about an agent including:
1042+ /// - Agent details and metadata
1043+ /// - Configured integrations organized by status (working, warning, error, missing)
1044+ /// - Detected integrations
1045+ /// - Configuration files and layers
1046+ pub async fn get_fleet_agent_info_with_http_info (
1047+ & self ,
1048+ agent_key : String ,
1049+ ) -> Result <
1050+ datadog:: ResponseContent < crate :: datadogV2:: model:: FleetAgentInfoResponse > ,
1051+ datadog:: Error < GetFleetAgentInfoError > ,
1052+ > {
1053+ let local_configuration = & self . config ;
1054+ let operation_id = "v2.get_fleet_agent_info" ;
1055+ if local_configuration. is_unstable_operation_enabled ( operation_id) {
1056+ warn ! ( "Using unstable operation {operation_id}" ) ;
1057+ } else {
1058+ let local_error = datadog:: UnstableOperationDisabledError {
1059+ msg : "Operation 'v2.get_fleet_agent_info' is not enabled" . to_string ( ) ,
1060+ } ;
1061+ return Err ( datadog:: Error :: UnstableOperationDisabledError ( local_error) ) ;
1062+ }
1063+
1064+ let local_client = & self . client ;
1065+
1066+ let local_uri_str = format ! (
1067+ "{}/api/unstable/fleet/agents/{agent_key}" ,
1068+ local_configuration. get_operation_host( operation_id) ,
1069+ agent_key = datadog:: urlencode( agent_key)
1070+ ) ;
1071+ let mut local_req_builder =
1072+ local_client. request ( reqwest:: Method :: GET , local_uri_str. as_str ( ) ) ;
1073+
1074+ // build headers
1075+ let mut headers = HeaderMap :: new ( ) ;
1076+ headers. insert ( "Accept" , HeaderValue :: from_static ( "application/json" ) ) ;
1077+
1078+ // build user agent
1079+ match HeaderValue :: from_str ( local_configuration. user_agent . as_str ( ) ) {
1080+ Ok ( user_agent) => headers. insert ( reqwest:: header:: USER_AGENT , user_agent) ,
1081+ Err ( e) => {
1082+ log:: warn!( "Failed to parse user agent header: {e}, falling back to default" ) ;
1083+ headers. insert (
1084+ reqwest:: header:: USER_AGENT ,
1085+ HeaderValue :: from_static ( datadog:: DEFAULT_USER_AGENT . as_str ( ) ) ,
1086+ )
1087+ }
1088+ } ;
1089+
1090+ // build auth
1091+ if let Some ( local_key) = local_configuration. auth_keys . get ( "apiKeyAuth" ) {
1092+ headers. insert (
1093+ "DD-API-KEY" ,
1094+ HeaderValue :: from_str ( local_key. key . as_str ( ) )
1095+ . expect ( "failed to parse DD-API-KEY header" ) ,
1096+ ) ;
1097+ } ;
1098+ if let Some ( local_key) = local_configuration. auth_keys . get ( "appKeyAuth" ) {
1099+ headers. insert (
1100+ "DD-APPLICATION-KEY" ,
1101+ HeaderValue :: from_str ( local_key. key . as_str ( ) )
1102+ . expect ( "failed to parse DD-APPLICATION-KEY header" ) ,
1103+ ) ;
1104+ } ;
1105+
1106+ local_req_builder = local_req_builder. headers ( headers) ;
1107+ let local_req = local_req_builder. build ( ) ?;
1108+ log:: debug!( "request content: {:?}" , local_req. body( ) ) ;
1109+ let local_resp = local_client. execute ( local_req) . await ?;
1110+
1111+ let local_status = local_resp. status ( ) ;
1112+ let local_content = local_resp. text ( ) . await ?;
1113+ log:: debug!( "response content: {}" , local_content) ;
1114+
1115+ if !local_status. is_client_error ( ) && !local_status. is_server_error ( ) {
1116+ match serde_json:: from_str :: < crate :: datadogV2:: model:: FleetAgentInfoResponse > (
1117+ & local_content,
1118+ ) {
1119+ Ok ( e) => {
1120+ return Ok ( datadog:: ResponseContent {
1121+ status : local_status,
1122+ content : local_content,
1123+ entity : Some ( e) ,
1124+ } )
1125+ }
1126+ Err ( e) => return Err ( datadog:: Error :: Serde ( e) ) ,
1127+ } ;
1128+ } else {
1129+ let local_entity: Option < GetFleetAgentInfoError > =
1130+ serde_json:: from_str ( & local_content) . ok ( ) ;
1131+ let local_error = datadog:: ResponseContent {
1132+ status : local_status,
1133+ content : local_content,
1134+ entity : local_entity,
1135+ } ;
1136+ Err ( datadog:: Error :: ResponseError ( local_error) )
1137+ }
1138+ }
1139+
10051140 /// Retrieve detailed information about a specific deployment using its unique identifier.
10061141 /// This endpoint returns comprehensive information about a deployment, including:
10071142 /// - Deployment metadata (ID, type, filter query)
0 commit comments