use std::sync::Arc;
#[derive(Debug)]
pub struct SecurityAndComplianceProject {
config: Arc<crate::models::SecurityConfig>,
v1: SecurityAndComplianceV1Service,
v2: SecurityAndComplianceV2Service,
}
impl SecurityAndComplianceProject {
pub fn new(config: Arc<crate::models::SecurityConfig>) -> Self {
Self {
v1: SecurityAndComplianceV1Service::new(config.clone()),
v2: SecurityAndComplianceV2Service::new(config.clone()),
config,
}
}
pub fn v1(&self) -> &SecurityAndComplianceV1Service {
&self.v1
}
pub fn v2(&self) -> &SecurityAndComplianceV2Service {
&self.v2
}
pub fn config(&self) -> &crate::models::SecurityConfig {
&self.config
}
}
#[derive(Debug)]
pub struct SecurityAndComplianceV1Service {
#[allow(dead_code)]
config: Arc<crate::models::SecurityConfig>,
openapi_logs: crate::security::security_and_compliance::v1::openapi_logs::OpenApiLogsService,
}
impl SecurityAndComplianceV1Service {
pub fn new(config: Arc<crate::models::SecurityConfig>) -> Self {
Self {
openapi_logs:
crate::security::security_and_compliance::v1::openapi_logs::OpenApiLogsService::new(
config.clone(),
),
config,
}
}
pub fn openapi_logs(
&self,
) -> &crate::security::security_and_compliance::v1::openapi_logs::OpenApiLogsService {
&self.openapi_logs
}
}
#[derive(Debug)]
pub struct SecurityAndComplianceV2Service {
#[allow(dead_code)]
config: Arc<crate::models::SecurityConfig>,
device_records: crate::security::security_and_compliance::v2::device_records::DeviceRecordsService,
device_apply_records:
crate::security::security_and_compliance::v2::device_apply_records::DeviceApplyRecordsService,
}
impl SecurityAndComplianceV2Service {
pub fn new(config: Arc<crate::models::SecurityConfig>) -> Self {
Self {
device_records: crate::security::security_and_compliance::v2::device_records::DeviceRecordsService::new(config.clone()),
device_apply_records: crate::security::security_and_compliance::v2::device_apply_records::DeviceApplyRecordsService::new(config.clone()),
config,
}
}
pub fn device_records(
&self,
) -> &crate::security::security_and_compliance::v2::device_records::DeviceRecordsService {
&self.device_records
}
pub fn device_apply_records(
&self,
) -> &crate::security::security_and_compliance::v2::device_apply_records::DeviceApplyRecordsService{
&self.device_apply_records
}
}
pub mod v1;
pub mod v2;
#[cfg(test)]
mod tests {
use serde_json;
#[test]
fn test_serialization_roundtrip() {
let json = r#"{"test": "value"}"#;
assert!(serde_json::from_str::<serde_json::Value>(json).is_ok());
}
#[test]
fn test_deserialization_from_json() {
let json = r#"{"field": "data"}"#;
let value: serde_json::Value = serde_json::from_str(json).expect("JSON 反序列化失败");
assert_eq!(value["field"], "data");
}
}