twc_rs/cli/databases.rs
1// SPDX-FileCopyrightText: 2026 RAprogramm <andrey.rozanov.vl@gmail.com>
2// SPDX-License-Identifier: MIT
3
4//! Managed database subcommands.
5
6use clap::Subcommand;
7
8/// Database subcommands.
9#[derive(Subcommand, Debug)]
10pub enum DatabaseCommands {
11 /// List all databases.
12 List {
13 /// Maximum number of databases to return.
14 #[arg(long)]
15 limit: Option<i32>,
16
17 /// Number of databases to skip.
18 #[arg(long)]
19 offset: Option<i32>
20 },
21 /// Show detailed info for a database.
22 Info {
23 /// Database ID.
24 #[arg(long)]
25 id: i32
26 },
27 /// Create a new database.
28 Create {
29 /// Database name.
30 #[arg(long)]
31 name: String,
32
33 /// Database engine type (mysql, postgres, redis, mongodb, opensearch,
34 /// clickhouse, kafka, rabbitmq).
35 #[arg(long)]
36 type_: String,
37
38 /// Preset ID for the database.
39 #[arg(short = 'p', long)]
40 preset_id: i32
41 },
42 /// Delete a database by ID.
43 Delete {
44 /// Database ID.
45 #[arg(long)]
46 id: i32
47 },
48 /// Update database settings.
49 Update {
50 /// Database ID.
51 #[arg(long)]
52 id: i32,
53
54 /// New database name.
55 #[arg(long)]
56 name: Option<String>
57 },
58 /// List backups for a database.
59 BackupList {
60 /// Database ID.
61 #[arg(long)]
62 id: i32
63 },
64 /// Create a backup for a database.
65 BackupCreate {
66 /// Database ID.
67 #[arg(long)]
68 id: i32
69 },
70 /// List users for a database.
71 UserList {
72 /// Database ID.
73 #[arg(long)]
74 id: i32
75 },
76 /// Create a user for a database.
77 UserCreate {
78 /// Database ID.
79 #[arg(long)]
80 db_id: i32,
81
82 /// Database user login name.
83 #[arg(long)]
84 login: String,
85
86 /// Database user password.
87 #[arg(long)]
88 password: String
89 },
90 /// Delete a user from a database.
91 UserDelete {
92 /// Database ID.
93 #[arg(long)]
94 db_id: i32,
95
96 /// Database user login name.
97 #[arg(long)]
98 user_name: String
99 },
100 /// List available database presets.
101 PresetList,
102 /// List available database cluster types (engines and versions).
103 ListTypes,
104 /// List individual database instances within a cluster.
105 ListInstances {
106 /// Database cluster ID.
107 #[arg(long)]
108 id: i32
109 }
110}