Backend: - migrations/003_jobs_scheduling.sql: retry_next_at/last_error columns, pg_notify trigger for immediate job dispatch, retry index - pm-agent-client: ApplyPatchesRequest/Response, AgentJobStatus, RollbackResponse types; apply_patches/job_status/rollback_job client methods + generic POST helper - pm-core/models: JobStatus, JobKind, PatchJob, PatchJobHost, CreateJobRequest, PatchJobSummary - pm-web/routes/jobs.rs: POST/GET /api/v1/jobs, GET /jobs/:id, POST /jobs/:id/cancel, POST /jobs/:id/rollback - pm-worker/job_executor.rs: NOTIFY listener, periodic scanner, execute_host_job, poll_running_jobs, handle_host_failure (3-retry exponential backoff 1m/5m/30m), sync_job_status, retry_pending_jobs - pm-worker/main.rs: spawn job_executor Frontend: - types/index.ts: PatchInfo, PatchJobHost, PatchJob, PatchJobSummary, CreateJobRequest interfaces - api/client.ts: jobsApi (list/get/create/cancel/rollback), patchesApi (getHostPatches) - pages/PatchDeploymentPage.tsx: 3-step MUI Stepper (host select → configure → result) - pages/JobsPage.tsx: job list table, expandable per-host detail, cancel/rollback actions with confirm dialog, load-more pagination - App.tsx: /jobs and /deployment routes wired to real pages cargo check: 0 errors | vite build: 0 errors
47 lines
1.4 KiB
Rust
47 lines
1.4 KiB
Rust
//! `pm-agent-client` — mTLS HTTP client for Linux Patch API agent communication.
|
|
//!
|
|
//! This crate provides [`client::AgentClient`], an async HTTP client that
|
|
//! establishes mutual-TLS connections (TLS 1.3) to `linux_patch_api` agents
|
|
//! running on managed hosts.
|
|
//!
|
|
//! # Quick start
|
|
//!
|
|
//! ```no_run
|
|
//! use pm_agent_client::AgentClient;
|
|
//!
|
|
//! # async fn run() -> Result<(), pm_agent_client::AgentClientError> {
|
|
//! let client = AgentClient::new(
|
|
//! "10.0.1.5",
|
|
//! 12443,
|
|
//! include_bytes!("../certs/client.crt"),
|
|
//! include_bytes!("../certs/client.key"),
|
|
//! include_bytes!("../certs/ca.crt"),
|
|
//! )?;
|
|
//!
|
|
//! let health = client.health().await?;
|
|
//! println!("Agent {}: {}", health.status, health.version);
|
|
//! # Ok(())
|
|
//! # }
|
|
//! ```
|
|
|
|
pub mod client;
|
|
pub mod error;
|
|
pub mod types;
|
|
|
|
// ── Convenience re-exports ──────────────────────────────────────────────────
|
|
|
|
/// Primary client — re-exported from [`client::AgentClient`].
|
|
pub use client::{AgentClient, DEFAULT_AGENT_PORT};
|
|
|
|
/// Error type — re-exported from [`error::AgentClientError`].
|
|
pub use error::AgentClientError;
|
|
|
|
/// Response envelope and all data types.
|
|
pub use types::{
|
|
AgentEnvelope, AgentErrorBody,
|
|
HealthData,
|
|
Package, PackagesData,
|
|
Patch, PatchesData,
|
|
SystemInfoData,
|
|
};
|