use mogh_resolver::{HasResponse, Resolve};
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
mod action;
mod alert;
mod alerter;
mod build;
mod builder;
mod deployment;
mod docker;
mod onboarding_key;
mod permission;
mod procedure;
mod provider;
mod repo;
mod schedule;
mod server;
mod stack;
mod swarm;
mod sync;
mod tag;
mod terminal;
mod toml;
mod update;
mod user;
mod user_group;
mod variable;
pub use action::*;
pub use alert::*;
pub use alerter::*;
pub use build::*;
pub use builder::*;
pub use deployment::*;
pub use docker::*;
pub use onboarding_key::*;
pub use permission::*;
pub use procedure::*;
pub use provider::*;
pub use repo::*;
pub use schedule::*;
pub use server::*;
pub use stack::*;
pub use swarm::*;
pub use sync::*;
pub use tag::*;
pub use terminal::*;
pub use toml::*;
pub use update::*;
pub use user::*;
pub use user_group::*;
pub use variable::*;
use crate::entities::{
ResourceTarget, Timelength,
config::{DockerRegistry, GitProvider},
};
#[cfg(feature = "utoipa")]
pub mod openapi;
pub trait KomodoReadRequest: HasResponse {}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/GetVersion",
description = "Get the version of the Komodo Core API.",
request_body(content = GetVersion),
responses(
(status = 200, description = "Komodo Core version", body = GetVersionResponse),
),
)]
pub fn get_version() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(GetVersionResponse)]
#[error(mogh_error::Error)]
pub struct GetVersion {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct GetVersionResponse {
pub version: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/GetCoreInfo",
description = "Get information about the Komodo Core API configuration.",
request_body(content = GetCoreInfo),
responses(
(status = 200, description = "Komodo Core info", body = GetCoreInfoResponse),
),
)]
pub fn get_core_info() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(GetCoreInfoResponse)]
#[error(mogh_error::Error)]
pub struct GetCoreInfo {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct GetCoreInfoResponse {
pub title: String,
pub monitoring_interval: Timelength,
pub webhook_base_url: String,
pub transparent_mode: bool,
pub ui_write_disabled: bool,
pub disable_non_admin_create: bool,
pub disable_confirm_dialog: bool,
pub disable_websocket_reconnect: bool,
pub enable_fancy_toml: bool,
pub timezone: String,
pub public_key: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/ListGitProvidersFromConfig",
description = "List the git providers available in Core / Periphery config files.",
request_body(content = ListGitProvidersFromConfig),
responses(
(status = 200, description = "The available git providers", body = ListGitProvidersFromConfigResponse),
(status = 400, description = "Target must be `Server` or `Builder`", body = mogh_error::Serror),
(status = 500, description = "Failed", body = mogh_error::Serror),
),
)]
pub fn list_git_providers_from_config() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(ListGitProvidersFromConfigResponse)]
#[error(mogh_error::Error)]
pub struct ListGitProvidersFromConfig {
pub target: Option<ResourceTarget>,
}
#[typeshare]
pub type ListGitProvidersFromConfigResponse = Vec<GitProvider>;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/ListDockerRegistriesFromConfig",
description = "List the docker registry providers available in Core / Periphery config files.",
request_body(content = ListDockerRegistriesFromConfig),
responses(
(status = 200, description = "The available docker registries", body = ListDockerRegistriesFromConfigResponse),
(status = 400, description = "Target must be `Server` or `Builder`", body = mogh_error::Serror),
(status = 500, description = "Failed", body = mogh_error::Serror),
),
)]
pub fn list_docker_registries_from_config() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(ListDockerRegistriesFromConfigResponse)]
#[error(mogh_error::Error)]
pub struct ListDockerRegistriesFromConfig {
pub target: Option<ResourceTarget>,
}
#[typeshare]
pub type ListDockerRegistriesFromConfigResponse = Vec<DockerRegistry>;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/ListSecrets",
description = "List the secret keys (not values) in the core configuration file.",
request_body(content = ListSecrets),
responses(
(status = 200, description = "The available secret keys", body = ListSecretsResponse),
(status = 400, description = "Target must be `Server` or `Builder`", body = mogh_error::Serror),
(status = 500, description = "Failed", body = mogh_error::Serror),
),
)]
pub fn list_secrets() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(ListSecretsResponse)]
#[error(mogh_error::Error)]
pub struct ListSecrets {
pub target: Option<ResourceTarget>,
}
#[typeshare]
pub type ListSecretsResponse = Vec<String>;