bloat now has endpoints for removal
This commit is contained in:
8 files changed
+151
-6
No files matched your search
@@ -6,7 +6,7 @@ mod stats;
|
||||
|
||||
pub use devices::{
|
||||
attach_device_identifier, attach_observation_identifier, create_known_device,
|
||||
forget_known_device, list_known_devices, merge_known_device,
|
||||
detach_device_identifier, forget_known_device, list_known_devices, merge_known_device,
|
||||
};
|
||||
pub use enroll::{
|
||||
EnrollTokenStatus, IssueEnrollTokenResponse, RevokeAgentResponse, RevokeEnrollTokenResponse,
|
||||
|
||||
@@ -198,6 +198,32 @@ pub async fn attach_observation_identifier(
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn detach_device_identifier(
|
||||
State(state): State<AppState>,
|
||||
AxumPath((device_id, identifier_key)): AxumPath<(String, String)>,
|
||||
) -> Result<impl IntoResponse, (StatusCode, Json<serde_json::Value>)> {
|
||||
match state
|
||||
.store
|
||||
.detach_device_identifier(&device_id, &identifier_key)
|
||||
.await
|
||||
{
|
||||
Ok(Some(device)) => Ok((StatusCode::OK, Json(known_device_response(device)))),
|
||||
Ok(None) => Err(json_error(
|
||||
StatusCode::NOT_FOUND,
|
||||
"known_device_not_found",
|
||||
"known device not found",
|
||||
)),
|
||||
Err(err) => {
|
||||
warn!(error = %err, "failed to detach device identifier");
|
||||
Err(json_error(
|
||||
StatusCode::BAD_REQUEST,
|
||||
"detach_device_identifier_failed",
|
||||
&err.to_string(),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn merge_known_device(
|
||||
State(state): State<AppState>,
|
||||
AxumPath(device_id): AxumPath<String>,
|
||||
|
||||
@@ -12,11 +12,11 @@ pub use commands::{list_agents, run_command};
|
||||
pub use control::{
|
||||
EnrollTokenStatus, IssueEnrollTokenResponse, RevokeAgentResponse, RevokeEnrollTokenResponse,
|
||||
StateStatsResponse, attach_device_identifier, attach_observation_identifier,
|
||||
create_known_device, enroll, forget_known_device, healthz, issue_enroll_token,
|
||||
list_agent_observation_history, list_agent_observations, list_enroll_tokens,
|
||||
list_fleet_devices, list_known_devices, merge_known_device, refresh_fleet_devices,
|
||||
request_agent_observation_sync, revoke_agent, revoke_enroll_token, set_agent_nickname,
|
||||
state_stats, upload_agent_observations, wake_fleet_device,
|
||||
create_known_device, detach_device_identifier, enroll, forget_known_device, healthz,
|
||||
issue_enroll_token, list_agent_observation_history, list_agent_observations,
|
||||
list_enroll_tokens, list_fleet_devices, list_known_devices, merge_known_device,
|
||||
refresh_fleet_devices, request_agent_observation_sync, revoke_agent, revoke_enroll_token,
|
||||
set_agent_nickname, state_stats, upload_agent_observations, wake_fleet_device,
|
||||
};
|
||||
|
||||
pub fn json_error(
|
||||
|
||||
Reference in new issue
Block a user