33 lines
1.2 KiB
Rust
33 lines
1.2 KiB
Rust
use anyhow::Result;
|
|
use tracing::{info, warn};
|
|
|
|
/// 将来的な GitOps 連携を見据えた Deployer HTTP API との接続ポイント。
|
|
///
|
|
/// 現時点ではステータスの簡易チェックのみを行い、
|
|
/// API 形状が固まり次第ここから `apply` 相当を実装できるようにしておく。
|
|
pub async fn run_deployer_command(endpoint: &str, action: &str) -> Result<()> {
|
|
match action {
|
|
"status" => {
|
|
// プレースホルダ実装:
|
|
// - 将来的には /health や /api/v1/admin/nodes 等を叩く。
|
|
let url = format!("{}/health", endpoint.trim_end_matches('/'));
|
|
info!("checking deployer status at {}", url);
|
|
|
|
let response = reqwest::get(&url).await?;
|
|
if response.status().is_success() {
|
|
let body = response.text().await.unwrap_or_default();
|
|
println!("deployer status OK: {}", body);
|
|
} else {
|
|
warn!(
|
|
"deployer status not OK: HTTP {}",
|
|
response.status().as_u16()
|
|
);
|
|
}
|
|
}
|
|
other => {
|
|
warn!("unsupported deployer action: {}", other);
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|