use clap::{Args, Subcommand};
use serde::{Deserialize, Serialize};
use super::{CancelWorkerArgs, DeleteArtifactArgs, DeleteAttachmentArgs};
#[derive(Serialize, Debug, Deserialize, Args, derive_more::From, Clone)]
pub struct AdminArgs {
#[command(subcommand)]
pub command: AdminCommands,
}
#[derive(Subcommand, Serialize, Debug, Deserialize, derive_more::From, Clone)]
pub enum AdminCommands {
Users(AdminUsersArgs),
Shutdown(ShutdownArgs),
Groups(AdminGroupsArgs),
Tasks(AdminTasksArgs),
Workers(AdminWorkersArgs),
}
#[derive(Serialize, Debug, Deserialize, Args, derive_more::From, Clone)]
pub struct AdminUsersArgs {
#[command(subcommand)]
pub command: AdminUsersCommands,
}
#[derive(Subcommand, Serialize, Debug, Deserialize, derive_more::From, Clone)]
pub enum AdminUsersCommands {
Create(AdminCreateUserArgs),
Delete(AdminDeleteUserArgs),
ChangePassword(ChangePasswordArgs),
GroupQuota(AdminUpdateUserGroupQuotaArgs),
}
#[derive(Serialize, Debug, Deserialize, Args, Clone)]
pub struct AdminCreateUserArgs {
pub username: Option<String>,
pub password: Option<String>,
#[arg(long)]
pub admin: bool,
}
#[derive(Serialize, Debug, Deserialize, Args, Clone)]
pub struct AdminDeleteUserArgs {
pub username: String,
}
#[derive(Serialize, Debug, Deserialize, Args, Clone)]
pub struct ChangePasswordArgs {
pub username: Option<String>,
pub new_password: Option<String>,
}
#[derive(Serialize, Debug, Deserialize, Args, derive_more::From, Clone)]
pub struct ShutdownArgs {
pub secret: String,
}
#[derive(Serialize, Debug, Deserialize, Args, derive_more::From, Clone)]
pub struct AdminGroupsArgs {
#[command(subcommand)]
pub command: AdminGroupsCommands,
}
#[derive(Subcommand, Serialize, Debug, Deserialize, derive_more::From, Clone)]
pub enum AdminGroupsCommands {
StorageQuota(AdminUpdateGroupStorageQuotaArgs),
Attachments(AdminAttachmentsArgs),
}
#[derive(Serialize, Debug, Deserialize, Args, Clone)]
pub struct AdminUpdateGroupStorageQuotaArgs {
pub group_name: String,
pub storage_quota: String,
}
#[derive(Serialize, Debug, Deserialize, Args, Clone)]
pub struct AdminUpdateUserGroupQuotaArgs {
pub username: String,
pub group_quota: String,
}
#[derive(Serialize, Debug, Deserialize, Args, derive_more::From, Clone)]
pub struct AdminAttachmentsArgs {
#[command(subcommand)]
pub command: AdminAttachmentsCommands,
}
#[derive(Subcommand, Serialize, Debug, Deserialize, derive_more::From, Clone)]
pub enum AdminAttachmentsCommands {
Delete(DeleteAttachmentArgs),
}
#[derive(Serialize, Debug, Deserialize, Args, derive_more::From, Clone)]
pub struct AdminTasksArgs {
#[command(subcommand)]
pub command: AdminTasksCommands,
}
#[derive(Subcommand, Serialize, Debug, Deserialize, derive_more::From, Clone)]
pub enum AdminTasksCommands {
Artifacts(AdminArtifactsArgs),
}
#[derive(Serialize, Debug, Deserialize, Args, derive_more::From, Clone)]
pub struct AdminArtifactsArgs {
#[command(subcommand)]
pub command: AdminArtifactsCommands,
}
#[derive(Subcommand, Serialize, Debug, Deserialize, derive_more::From, Clone)]
pub enum AdminArtifactsCommands {
Delete(DeleteArtifactArgs),
}
#[derive(Serialize, Debug, Deserialize, Args, derive_more::From, Clone)]
pub struct AdminWorkersArgs {
#[command(subcommand)]
pub command: AdminWorkersCommands,
}
#[derive(Subcommand, Serialize, Debug, Deserialize, derive_more::From, Clone)]
pub enum AdminWorkersCommands {
Cancel(CancelWorkerArgs),
}