use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use super::*;
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmInspectInfo {
#[serde(rename = "ID")]
pub id: Option<String>,
#[serde(rename = "Version")]
pub version: Option<ObjectVersion>,
#[serde(rename = "CreatedAt")]
pub created_at: Option<String>,
#[serde(rename = "UpdatedAt")]
pub updated_at: Option<String>,
#[serde(rename = "Spec")]
pub spec: Option<SwarmSpec>,
#[serde(rename = "TLSInfo")]
pub tls_info: Option<TlsInfo>,
#[serde(rename = "RootRotationInProgress")]
pub root_rotation_in_progress: Option<bool>,
#[serde(rename = "DataPathPort")]
pub data_path_port: Option<u32>,
#[serde(rename = "DefaultAddrPool")]
pub default_addr_pool: Option<Vec<String>>,
#[serde(rename = "SubnetSize")]
pub subnet_size: Option<u32>,
#[serde(rename = "JoinTokens")]
pub join_tokens: Option<JoinTokens>,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmSpec {
#[serde(rename = "Name")]
pub name: Option<String>,
#[serde(rename = "Labels")]
pub labels: Option<HashMap<String, String>>,
#[serde(rename = "Orchestration")]
pub orchestration: Option<SwarmSpecOrchestration>,
#[serde(rename = "Raft")]
pub raft: Option<SwarmSpecRaft>,
#[serde(rename = "Dispatcher")]
pub dispatcher: Option<SwarmSpecDispatcher>,
#[serde(rename = "CAConfig")]
pub ca_config: Option<SwarmSpecCaConfig>,
#[serde(rename = "EncryptionConfig")]
pub encryption_config: Option<SwarmSpecEncryptionConfig>,
#[serde(rename = "TaskDefaults")]
pub task_defaults: Option<SwarmSpecTaskDefaults>,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmSpecOrchestration {
#[serde(rename = "TaskHistoryRetentionLimit")]
pub task_history_retention_limit: Option<I64>,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmSpecRaft {
#[serde(rename = "SnapshotInterval")]
pub snapshot_interval: Option<U64>,
#[serde(rename = "KeepOldSnapshots")]
pub keep_old_snapshots: Option<U64>,
#[serde(rename = "LogEntriesForSlowFollowers")]
pub log_entries_for_slow_followers: Option<U64>,
#[serde(rename = "ElectionTick")]
pub election_tick: Option<I64>,
#[serde(rename = "HeartbeatTick")]
pub heartbeat_tick: Option<I64>,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmSpecDispatcher {
#[serde(rename = "HeartbeatPeriod")]
pub heartbeat_period: Option<I64>,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmSpecCaConfig {
#[serde(rename = "NodeCertExpiry")]
pub node_cert_expiry: Option<I64>,
#[serde(rename = "ExternalCAs")]
pub external_cas: Option<Vec<SwarmSpecCaConfigExternalCas>>,
#[serde(rename = "SigningCACert")]
pub signing_ca_cert: Option<String>,
#[serde(rename = "SigningCAKey")]
pub signing_ca_key: Option<String>,
#[serde(rename = "ForceRotate")]
pub force_rotate: Option<U64>,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmSpecCaConfigExternalCas {
#[serde(rename = "Protocol")]
pub protocol: Option<SwarmSpecCaConfigExternalCasProtocolEnum>,
#[serde(rename = "URL")]
pub url: Option<String>,
#[serde(rename = "Options")]
pub options: Option<HashMap<String, String>>,
#[serde(rename = "CACert")]
pub ca_cert: Option<String>,
}
#[typeshare]
#[derive(
Debug,
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Default,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub enum SwarmSpecCaConfigExternalCasProtocolEnum {
#[default]
#[serde(rename = "")]
EMPTY,
#[serde(rename = "cfssl")]
CFSSL,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmSpecEncryptionConfig {
#[serde(rename = "AutoLockManagers")]
pub auto_lock_managers: Option<bool>,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmSpecTaskDefaults {
#[serde(rename = "LogDriver")]
pub log_driver: Option<SwarmSpecTaskDefaultsLogDriver>,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct SwarmSpecTaskDefaultsLogDriver {
#[serde(rename = "Name")]
pub name: Option<String>,
#[serde(rename = "Options")]
pub options: Option<HashMap<String, String>>,
}
#[typeshare]
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct JoinTokens {
#[serde(rename = "Worker")]
pub worker: Option<String>,
#[serde(rename = "Manager")]
pub manager: Option<String>,
}