Skip to main content

twc_rs/cli/
balancers.rs

1// SPDX-FileCopyrightText: 2026 RAprogramm <andrey.rozanov.vl@gmail.com>
2// SPDX-License-Identifier: MIT
3
4//! Load balancer subcommands.
5
6use clap::Subcommand;
7
8/// Balancer subcommands.
9#[derive(Subcommand, Debug)]
10pub enum BalancerCommands {
11    /// List all balancers.
12    List {
13        /// Maximum number of balancers to return.
14        #[arg(long)]
15        limit: Option<i32>,
16
17        /// Number of balancers to skip.
18        #[arg(long)]
19        offset: Option<i32>
20    },
21    /// Show detailed info for a balancer.
22    Info {
23        /// Balancer ID.
24        #[arg(long)]
25        id: i32
26    },
27    /// Create a new balancer.
28    Create {
29        /// Balancer name.
30        #[arg(long)]
31        name: String
32    },
33    /// Delete a balancer by ID.
34    Delete {
35        /// Balancer ID.
36        #[arg(long)]
37        id: i32
38    },
39    /// Update balancer settings.
40    Update {
41        /// Balancer ID.
42        #[arg(long)]
43        id: i32,
44
45        /// New balancer name.
46        #[arg(long)]
47        name: Option<String>
48    },
49    /// List rules for a balancer.
50    RuleList {
51        /// Balancer ID.
52        #[arg(long)]
53        id: i32
54    },
55    /// Create a rule for a balancer.
56    RuleCreate {
57        /// Balancer ID.
58        #[arg(long)]
59        id: i32
60    },
61    /// Delete a rule from a balancer.
62    RuleDelete {
63        /// Balancer ID.
64        #[arg(long)]
65        id: i32,
66
67        /// Rule ID to delete.
68        #[arg(long)]
69        rule_id: i32
70    },
71    /// List IPs for a balancer.
72    IpList {
73        /// Balancer ID.
74        #[arg(long)]
75        id: i32
76    },
77    /// Add an IP to a balancer.
78    IpAdd {
79        /// Balancer ID.
80        #[arg(long)]
81        id: i32,
82
83        /// IP address to add.
84        #[arg(long)]
85        ip: String
86    },
87    /// Remove an IP from a balancer.
88    IpRemove {
89        /// Balancer ID.
90        #[arg(long)]
91        id: i32,
92
93        /// IP address to remove.
94        #[arg(long)]
95        ip: String
96    },
97    /// List available balancer presets.
98    PresetList
99}