use clap::Parser;
use mogh_resolver::Resolve;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use crate::entities::update::Update;
use super::KomodoExecuteRequest;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/ClearRepoCache",
description = "Clears all repos from the Core repo cache.",
request_body(content = ClearRepoCache),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn clear_repo_cache() {}
#[typeshare]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct ClearRepoCache {}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/BackupCoreDatabase",
description = "Backs up the Komodo Core database to compressed jsonl files.",
request_body(content = BackupCoreDatabase),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn backup_core_database() {}
#[typeshare]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct BackupCoreDatabase {}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/GlobalAutoUpdate",
description = "Trigger a global poll for image updates on Stacks and Deployments.",
request_body(content = GlobalAutoUpdate),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn global_auto_update() {}
#[typeshare]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct GlobalAutoUpdate {
#[serde(default)]
#[arg(long, short = 's', default_value_t = false)]
pub skip_auto_update: bool,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RotateAllServerKeys",
description = "Rotates all connected Server keys.",
request_body(content = RotateAllServerKeys),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn rotate_all_server_keys() {}
#[typeshare]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RotateAllServerKeys {}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RotateCoreKeys",
description = "Rotates the Core private key and all Server public keys.",
request_body(content = RotateCoreKeys),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn rotate_core_keys() {}
#[typeshare]
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, Resolve, Parser,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoExecuteRequest)]
#[response(Update)]
#[error(mogh_error::Error)]
pub struct RotateCoreKeys {
#[serde(default)]
#[clap(long, short, alias = "f", default_value_t = false)]
pub force: bool,
}