use fundamentum_edge_proto::com::fundamentum::edge::v1::{ provisioning_server::{Provisioning, ProvisioningServer}, ProvisionRequest, ProvisionResponse, }; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use tonic::transport::Server; use tonic::{Request, Response, Status}; #[derive(Default)] pub struct ProvisioningService {} impl ProvisioningService { pub fn new() -> Self { Self {} } } #[tonic::async_trait] impl Provisioning for ProvisioningService { async fn provision( &self, request: Request, ) -> Result, Status> { let req = request.into_inner(); println!("Received: {:?}", req); Ok(Response::new(ProvisionResponse::default())) } } #[tokio::main] async fn main() -> Result<(), Box> { let socket_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080); let provisioning_svc = ProvisioningService::new(); let router = Server::builder().add_service(ProvisioningServer::new(provisioning_svc)); router.serve(socket_addr).await?; Ok(()) }