From 5a53c366e6260a0420a19c98bdc2e0fa1b8506f8 Mon Sep 17 00:00:00 2001 From: prplV Date: Tue, 18 Feb 2025 13:15:11 +0300 Subject: [PATCH] setup --- src/endpoints.rs | 4 +- src/metrics.rs | 3 +- src/structs.rs | 259 +---------------------------------------------- 3 files changed, 7 insertions(+), 259 deletions(-) diff --git a/src/endpoints.rs b/src/endpoints.rs index dd8f455..513fea4 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -3,8 +3,8 @@ use axum::{ response::IntoResponse, http }; -use crate::structs -use integr_structs::api::v3::PrometheusMetrics; +use crate::structs::v3::PrometheusMetrics; +// use integr_structs::api::v3::PrometheusMetrics; use prometheus::{Encoder, Registry, TextEncoder, Gauge}; use std::sync::{Arc, MutexGuard}; use crate::AppState; diff --git a/src/metrics.rs b/src/metrics.rs index 5b94562..7f73859 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -1,5 +1,4 @@ -// use serde_json::; -use integr_structs::api::v3::MetricOutput; +use crate::structs::v3::MetricOutput; use serde_json::{Map, Value}; use prometheus::Gauge; use tracing::error; diff --git a/src/structs.rs b/src/structs.rs index 4a824f0..3f56f4a 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -1,237 +1,11 @@ -use core::sync; -use std::collections::HashMap; +// use std::collections::HashMap; use serde::{Serialize, Deserialize}; -use serde_json::{ to_string_pretty, Value }; -use anyhow::Result; -use std::sync::Arc; - - -#[derive(Serialize, Deserialize, Debug)] -pub struct ApiConfig { - #[serde(default)] - pub endpoints : Vec, - pub delay : u32, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ApiEndpoint { - pub url : String, - pub method : String, -} - -impl Default for ApiConfig { - fn default() -> Self { - ApiConfig { - endpoints : vec![], - delay : 0, - } - } -} - -// v2 -#[derive(Serialize, Deserialize, Debug, PartialEq)] -pub struct ApiConfigV2 { - pub id : u64, - #[serde(default)] - pub template : Vec