use clap::Parser;
use mogh_resolver::Resolve;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use crate::{
api::execute::KomodoExecuteRequest,
entities::{
docker::node::{NodeSpecAvailabilityEnum, NodeSpecRoleEnum},
update::Update,
},
};
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RemoveSwarmNodes",
description = "Remove swarm nodes.",
request_body(content = RemoveSwarmNodes),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn remove_swarm_nodes() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RemoveSwarmNodes {
pub swarm: String,
pub nodes: Vec<String>,
#[serde(default)]
#[arg(long, short, default_value_t = false)]
pub force: bool,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/UpdateSwarmNode",
description = "Update a swarm node's availability, labels, and role.",
request_body(content = UpdateSwarmNode),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn update_swarm_node() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct UpdateSwarmNode {
pub swarm: String,
pub node: String,
#[arg(long, short = 'a')]
pub availability: Option<NodeSpecAvailabilityEnum>,
#[arg(long, short = 'l')]
pub label_add: Option<Vec<String>>,
#[arg(long, alias = "lr")]
pub label_rm: Option<Vec<String>>,
#[arg(long, short = 'r')]
pub role: Option<NodeSpecRoleEnum>,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RemoveSwarmStacks",
description = "Remove swarm stacks.",
request_body(content = RemoveSwarmStacks),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn remove_swarm_stacks() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RemoveSwarmStacks {
pub swarm: String,
pub stacks: Vec<String>,
#[serde(default = "default_detach")]
#[arg(long, short, default_value_t = default_detach())]
pub detach: bool,
}
fn default_detach() -> bool {
true
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RemoveSwarmServices",
description = "Remove swarm services.",
request_body(content = RemoveSwarmServices),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn remove_swarm_services() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RemoveSwarmServices {
pub swarm: String,
pub services: Vec<String>,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CreateSwarmConfig",
description = "Create a swarm config.",
request_body(content = CreateSwarmConfig),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn create_swarm_config() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct CreateSwarmConfig {
pub swarm: String,
pub name: String,
pub data: String,
#[serde(default)]
pub labels: Vec<String>,
pub template_driver: Option<String>,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RotateSwarmConfig",
description = "Rotate a swarm config.",
request_body(content = RotateSwarmConfig),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn rotate_swarm_config() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RotateSwarmConfig {
pub swarm: String,
pub config: String,
pub data: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RemoveSwarmConfigs",
description = "Remove swarm configs.",
request_body(content = RemoveSwarmConfigs),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn remove_swarm_configs() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RemoveSwarmConfigs {
pub swarm: String,
pub configs: Vec<String>,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CreateSwarmSecret",
description = "Create a swarm secret.",
request_body(content = CreateSwarmSecret),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn create_swarm_secret() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct CreateSwarmSecret {
pub swarm: String,
pub name: String,
pub data: String,
pub driver: Option<String>,
#[serde(default)]
pub labels: Vec<String>,
pub template_driver: Option<String>,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RotateSwarmSecret",
description = "Rotate a swarm secret.",
request_body(content = RotateSwarmSecret),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn rotate_swarm_secret() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RotateSwarmSecret {
pub swarm: String,
pub secret: String,
pub data: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RemoveSwarmSecrets",
description = "Remove swarm secrets.",
request_body(content = RemoveSwarmSecrets),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn remove_swarm_secrets() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RemoveSwarmSecrets {
pub swarm: String,
pub secrets: Vec<String>,
}