1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
pub mod service;
pub mod config;
pub mod gateway;
pub mod trace;
pub mod health;
pub mod init;
pub mod dev;
#[derive(clap::Subcommand)]
pub enum ServiceCommands {
/// List all services
List {
/// Filter by status
#[arg(short, long)]
status: Option<String>,
/// Output format (table, json, yaml)
#[arg(short, long, default_value = "table")]
format: String,
},
/// Register a new service
Register {
/// Service name
name: String,
/// Service address
#[arg(short, long)]
address: String,
/// Service port
#[arg(short, long)]
port: u16,
/// Service tags
#[arg(short, long)]
tags: Vec<String>,
},
/// Deregister a service
Deregister {
/// Service ID
id: String,
},
/// Get service details
Info {
/// Service name or ID
name: String,
},
/// Check service health
Check {
/// Service name or ID
name: String,
},
}
#[derive(clap::Subcommand)]
pub enum ConfigCommands {
/// Get configuration value
Get {
/// Configuration key
key: String,
},
/// Set configuration value
Set {
/// Configuration key
key: String,
/// Configuration value
value: String,
},
/// Delete configuration
Delete {
/// Configuration key
key: String,
},
/// List configuration keys
List {
/// Key prefix
#[arg(short, long)]
prefix: Option<String>,
},
/// Watch configuration changes
Watch {
/// Configuration key
key: String,
},
/// Export configuration
Export {
/// Output file
#[arg(short, long)]
output: Option<String>,
/// Export format (json, yaml, toml)
#[arg(short, long, default_value = "yaml")]
format: String,
},
/// Import configuration
Import {
/// Input file
file: String,
/// Import format (json, yaml, toml)
#[arg(short, long)]
format: Option<String>,
},
}
#[derive(clap::Subcommand)]
pub enum GatewayCommands {
/// List gateway routes
Routes {
/// Filter by service
#[arg(short, long)]
service: Option<String>,
},
/// Add a new route
AddRoute {
/// Route path
path: String,
/// Target service
service: String,
/// HTTP methods
#[arg(short, long)]
methods: Vec<String>,
},
/// Remove a route
RemoveRoute {
/// Route ID or path
id: String,
},
/// Show gateway statistics
Stats {
/// Service filter
#[arg(short, long)]
service: Option<String>,
},
/// Test gateway configuration
Test {
/// Configuration file
#[arg(short, long)]
config: Option<String>,
},
}
#[derive(clap::Subcommand)]
pub enum TraceCommands {
/// List recent traces
List {
/// Service filter
#[arg(short, long)]
service: Option<String>,
/// Time range (e.g., "1h", "30m")
#[arg(short, long, default_value = "1h")]
range: String,
/// Maximum number of traces
#[arg(short, long, default_value = "100")]
limit: usize,
},
/// Get trace details
Get {
/// Trace ID
trace_id: String,
},
/// Search traces
Search {
/// Search query
query: String,
/// Time range
#[arg(short, long, default_value = "1h")]
range: String,
},
/// Export traces
Export {
/// Output file
output: String,
/// Export format
#[arg(short, long, default_value = "json")]
format: String,
/// Time range
#[arg(short, long, default_value = "1h")]
range: String,
},
}
#[derive(clap::Subcommand)]
pub enum HealthCommands {
/// Check overall system health
Check {
/// Include detailed information
#[arg(short, long)]
detailed: bool,
},
/// Check specific service health
Service {
/// Service name
name: String,
},
/// Monitor health status
Monitor {
/// Update interval in seconds
#[arg(short, long, default_value = "5")]
interval: u64,
/// Services to monitor
#[arg(short, long)]
services: Vec<String>,
},
}