use mogh_resolver::Resolve;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use crate::entities::{
server::{_PartialServerConfig, Server},
update::Update,
};
use super::KomodoWriteRequest;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CreateServer",
description = "Create a server.",
request_body(content = CreateServer),
responses(
(status = 200, description = "The new server", body = crate::entities::server::ServerSchema),
),
)]
pub fn create_server() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Server)]
#[error(mogh_error::Error)]
pub struct CreateServer {
pub name: String,
#[serde(default)]
pub config: _PartialServerConfig,
pub public_key: Option<String>,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CopyServer",
description = "Copy a server.",
request_body(content = CopyServer),
responses(
(status = 200, description = "The new server", body = crate::entities::server::ServerSchema),
),
)]
pub fn copy_server() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Server)]
#[error(mogh_error::Error)]
pub struct CopyServer {
pub name: String,
pub id: String,
pub public_key: Option<String>,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/DeleteServer",
description = "Delete a server.",
request_body(content = DeleteServer),
responses(
(status = 200, description = "The deleted server", body = crate::entities::server::ServerSchema),
),
)]
pub fn delete_server() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Server)]
#[error(mogh_error::Error)]
pub struct DeleteServer {
pub id: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/UpdateServer",
description = "Update a server.",
request_body(content = UpdateServer),
responses(
(status = 200, description = "The updated server", body = crate::entities::server::ServerSchema),
),
)]
pub fn update_server() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Server)]
#[error(mogh_error::Error)]
pub struct UpdateServer {
pub id: String,
pub config: _PartialServerConfig,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RenameServer",
description = "Rename a server.",
request_body(content = RenameServer),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn rename_server() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RenameServer {
pub id: String,
pub name: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CreateNetwork",
description = "Create a docker network on the server.",
request_body(content = CreateNetwork),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn create_network() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct CreateNetwork {
pub server: String,
pub name: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/UpdateServerPublicKey",
description = "Updates the Server with an explicit Public Key.",
request_body(content = UpdateServerPublicKey),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn update_server_public_key() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct UpdateServerPublicKey {
pub server: String,
pub public_key: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RotateServerKeys",
description = "Rotate server keys.",
request_body(content = RotateServerKeys),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn rotate_server_keys() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RotateServerKeys {
pub server: String,
}