use mogh_resolver::Resolve;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use crate::entities::{
deployment::{_PartialDeploymentConfig, Deployment},
update::Update,
};
use super::KomodoWriteRequest;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CreateDeployment",
description = "Create a deployment.",
request_body(content = CreateDeployment),
responses(
(status = 200, description = "The new deployment", body = crate::entities::deployment::DeploymentSchema),
),
)]
pub fn create_deployment() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Deployment)]
#[error(mogh_error::Error)]
pub struct CreateDeployment {
pub name: String,
#[serde(default)]
pub config: _PartialDeploymentConfig,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CopyDeployment",
description = "Copy a deployment.",
request_body(content = CopyDeployment),
responses(
(status = 200, description = "The new deployment", body = crate::entities::deployment::DeploymentSchema),
),
)]
pub fn copy_deployment() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Deployment)]
#[error(mogh_error::Error)]
pub struct CopyDeployment {
pub name: String,
pub id: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CreateDeploymentFromContainer",
description = "Create a Deployment from an existing container.",
request_body(content = CreateDeploymentFromContainer),
responses(
(status = 200, description = "The new deployment", body = crate::entities::deployment::DeploymentSchema),
),
)]
pub fn create_deployment_from_container() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Deployment)]
#[error(mogh_error::Error)]
pub struct CreateDeploymentFromContainer {
pub name: String,
pub server: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/DeleteDeployment",
description = "Delete a deployment.",
request_body(content = DeleteDeployment),
responses(
(status = 200, description = "The deleted deployment", body = crate::entities::deployment::DeploymentSchema),
),
)]
pub fn delete_deployment() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Deployment)]
#[error(mogh_error::Error)]
pub struct DeleteDeployment {
pub id: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/UpdateDeployment",
description = "Update a deployment.",
request_body(content = UpdateDeployment),
responses(
(status = 200, description = "The updated deployment", body = crate::entities::deployment::DeploymentSchema),
),
)]
pub fn update_deployment() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(Deployment)]
#[error(mogh_error::Error)]
pub struct UpdateDeployment {
pub id: String,
pub config: _PartialDeploymentConfig,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/RenameDeployment",
description = "Rename a deployment.",
request_body(content = RenameDeployment),
responses(
(status = 200, description = "The update", body = Update),
),
)]
pub fn rename_deployment() {}
#[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 RenameDeployment {
pub id: String,
pub name: String,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CheckDeploymentForUpdate",
description = "Checks for newer image than what is deployed.",
request_body(content = CheckDeploymentForUpdate),
responses(
(status = 200, description = "Checked for update", body = CheckDeploymentForUpdateResponse),
),
)]
pub fn check_deployment_for_update() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(CheckDeploymentForUpdateResponse)]
#[error(mogh_error::Error)]
pub struct CheckDeploymentForUpdate {
pub deployment: String,
#[serde(default)]
pub skip_auto_update: bool,
#[serde(default)]
pub wait_for_auto_update: bool,
}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct CheckDeploymentForUpdateResponse {
pub deployment: String,
pub update_available: bool,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/BatchCheckDeploymentForUpdate",
description = "Checks for newer image than what is deployed.",
request_body(content = BatchCheckDeploymentForUpdate),
responses(
(status = 200, description = "Per deployment result", body = BatchCheckDeploymentForUpdateResponse),
),
)]
pub fn batch_check_deployment_for_update() {}
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Resolve,
)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(BatchCheckDeploymentForUpdateResponse)]
#[error(mogh_error::Error)]
pub struct BatchCheckDeploymentForUpdate {
pub pattern: String,
#[serde(default)]
pub skip_auto_update: bool,
#[serde(default)]
pub wait_for_auto_update: bool,
}
#[typeshare]
pub type BatchCheckDeploymentForUpdateResponse =
Vec<CheckDeploymentForUpdateResponse>;