1use anyhow::Result;
4use std::path::PathBuf;
5use tracing::info;
6
7pub struct Daemon {
8 watch_paths: Vec<PathBuf>,
9 output_dir: PathBuf,
10}
11
12impl Daemon {
13 pub fn new(output_dir: PathBuf) -> Self {
14 Self {
15 watch_paths: Vec::new(),
16 output_dir,
17 }
18 }
19
20 pub fn add_watch_path(&mut self, path: PathBuf) {
21 self.watch_paths.push(path);
22 }
23
24 pub async fn run(&self) -> Result<()> {
25 info!("Starting amalgam daemon");
26 info!("Watching paths: {:?}", self.watch_paths);
27 info!("Output directory: {:?}", self.output_dir);
28
29 Ok(())
34 }
35}
36
37#[cfg(feature = "kubernetes")]
38pub mod k8s {
39 use super::*;
40 use kube::{Client, Api};
41 use k8s_openapi::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition;
42
43 pub struct K8sWatcher {
44 client: Client,
45 }
46
47 impl K8sWatcher {
48 pub async fn new() -> Result<Self> {
49 let client = Client::try_default().await?;
50 Ok(Self { client })
51 }
52
53 pub async fn watch_crds(&self) -> Result<()> {
54 let crds: Api<CustomResourceDefinition> = Api::all(self.client.clone());
55
56 Ok(())
60 }
61 }
62}