renamed docker detect dto
All checks were successful
Rust Cross-Platform Build / Detect Rust Project (push) Successful in 4s
Rust Cross-Platform Build / Run Tests (push) Successful in 1m6s
Rust Cross-Platform Build / Build (x86_64-unknown-linux-gnu) (push) Successful in 2m53s
Rust Cross-Platform Build / Build (x86_64-pc-windows-gnu) (push) Successful in 3m41s
Rust Cross-Platform Build / Set Tag Name (push) Successful in 3s
Rust Cross-Platform Build / Build and Push Docker Image (push) Successful in 2m5s
Rust Cross-Platform Build / Workflow Summary (push) Successful in 2s
Rust Cross-Platform Build / Create Tag (push) Successful in 5s
All checks were successful
Rust Cross-Platform Build / Detect Rust Project (push) Successful in 4s
Rust Cross-Platform Build / Run Tests (push) Successful in 1m6s
Rust Cross-Platform Build / Build (x86_64-unknown-linux-gnu) (push) Successful in 2m53s
Rust Cross-Platform Build / Build (x86_64-pc-windows-gnu) (push) Successful in 3m41s
Rust Cross-Platform Build / Set Tag Name (push) Successful in 3s
Rust Cross-Platform Build / Build and Push Docker Image (push) Successful in 2m5s
Rust Cross-Platform Build / Workflow Summary (push) Successful in 2s
Rust Cross-Platform Build / Create Tag (push) Successful in 5s
This commit is contained in:
@@ -15,7 +15,7 @@ use std::time::Duration;
|
|||||||
use crate::docker::serverclientcomm::handle_server_message;
|
use crate::docker::serverclientcomm::handle_server_message;
|
||||||
use crate::hardware::HardwareInfo;
|
use crate::hardware::HardwareInfo;
|
||||||
use crate::models::{
|
use crate::models::{
|
||||||
Acknowledgment, DockerMetricDto, DockerRegistrationDto, HeartbeatDto,
|
Acknowledgment, DockerMetricDto, DockerServiceDto, HeartbeatDto,
|
||||||
IdResponse, MetricDto, RegistrationDto, ServerMessage,
|
IdResponse, MetricDto, RegistrationDto, ServerMessage,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ async fn get_server_id_by_ip(
|
|||||||
pub async fn broadcast_docker_containers(
|
pub async fn broadcast_docker_containers(
|
||||||
base_url: &str,
|
base_url: &str,
|
||||||
server_id: u16,
|
server_id: u16,
|
||||||
container_dto: &DockerRegistrationDto,
|
container_dto: &DockerServiceDto,
|
||||||
) -> Result<(), Box<dyn Error + Send + Sync>> {
|
) -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||||
// First get local IP
|
// First get local IP
|
||||||
println!("Preparing to broadcast docker containers...");
|
println!("Preparing to broadcast docker containers...");
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pub mod stats;
|
|||||||
|
|
||||||
use crate::models::{
|
use crate::models::{
|
||||||
DockerCollectMetricDto, DockerContainer, DockerContainerCpuDto, DockerContainerInfo,
|
DockerCollectMetricDto, DockerContainer, DockerContainerCpuDto, DockerContainerInfo,
|
||||||
DockerContainerNetworkDto, DockerContainerRamDto, DockerMetricDto, DockerRegistrationDto,
|
DockerContainerNetworkDto, DockerContainerRamDto, DockerMetricDto, DockerServiceDto,
|
||||||
DockerContainerStatusDto
|
DockerContainerStatusDto
|
||||||
};
|
};
|
||||||
use bollard::Docker;
|
use bollard::Docker;
|
||||||
@@ -305,12 +305,12 @@ impl DockerManager {
|
|||||||
|
|
||||||
pub async fn create_registration_dto(
|
pub async fn create_registration_dto(
|
||||||
&self,
|
&self,
|
||||||
) -> Result<DockerRegistrationDto, Box<dyn Error + Send + Sync>> {
|
) -> Result<DockerServiceDto, Box<dyn Error + Send + Sync>> {
|
||||||
let containers = self.get_containers().await?;
|
let containers = self.get_containers().await?;
|
||||||
|
|
||||||
let container_string = serde_json::to_value(&containers)?;
|
let container_string = serde_json::to_value(&containers)?;
|
||||||
|
|
||||||
let dto = DockerRegistrationDto {
|
let dto = DockerServiceDto {
|
||||||
server_id: 0, // This will be set by the caller
|
server_id: 0, // This will be set by the caller
|
||||||
containers: container_string,
|
containers: container_string,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|||||||
docker_manager.create_registration_dto().await?
|
docker_manager.create_registration_dto().await?
|
||||||
} else {
|
} else {
|
||||||
println!("Fallback for failing registration");
|
println!("Fallback for failing registration");
|
||||||
models::DockerRegistrationDto {
|
models::DockerServiceDto {
|
||||||
server_id: 0,
|
server_id: 0,
|
||||||
//container_count: 0, --- IGNORE ---
|
//container_count: 0, --- IGNORE ---
|
||||||
containers: serde_json::to_value(&"")?,
|
containers: serde_json::to_value(&"")?,
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ pub struct Acknowledgment {
|
|||||||
/// - `Name`: Container name (string)
|
/// - `Name`: Container name (string)
|
||||||
/// - `Status`: Container status ("running", "stopped", etc.)
|
/// - `Status`: Container status ("running", "stopped", etc.)
|
||||||
#[derive(Debug, Serialize, Clone)]
|
#[derive(Debug, Serialize, Clone)]
|
||||||
pub struct DockerRegistrationDto {
|
pub struct DockerServiceDto {
|
||||||
/// Unique server identifier (integer)
|
/// Unique server identifier (integer)
|
||||||
#[serde(rename = "Server_id")]
|
#[serde(rename = "Server_id")]
|
||||||
pub server_id: u16,
|
pub server_id: u16,
|
||||||
|
|||||||
Reference in New Issue
Block a user