twc_rs/cli/network.rs
1// SPDX-FileCopyrightText: 2026 RAprogramm <andrey.rozanov.vl@gmail.com>
2// SPDX-License-Identifier: MIT
3
4//! Floating IP and VPC subcommands.
5
6use clap::Subcommand;
7
8/// Floating IP subcommands.
9#[derive(Subcommand, Debug)]
10pub enum IpCommands {
11 /// List all floating IPs.
12 List,
13 /// Show detailed info about a floating IP.
14 Info {
15 /// Floating IP ID.
16 #[arg(long)]
17 id: String
18 },
19 /// Create a new floating IP in an availability zone.
20 Create {
21 /// Availability zone (e.g. spb-1, msk-1, ams-1).
22 #[arg(long)]
23 availability_zone: String
24 },
25 /// Attach a floating IP to a resource.
26 Attach {
27 /// Floating IP ID.
28 #[arg(long)]
29 id: String,
30 /// Resource ID to bind to.
31 #[arg(long)]
32 resource_id: i32
33 },
34 /// Detach a floating IP from its resource.
35 Detach {
36 /// Floating IP ID.
37 #[arg(long)]
38 id: String
39 },
40 /// Update a floating IP's comment.
41 Set {
42 /// Floating IP ID.
43 #[arg(long)]
44 id: String,
45 /// New comment.
46 #[arg(long)]
47 comment: Option<String>
48 },
49 /// Delete a floating IP by ID.
50 Delete {
51 /// Floating IP ID.
52 #[arg(long)]
53 id: String
54 }
55}
56
57/// VPC subcommands.
58#[derive(Subcommand, Debug)]
59pub enum VpcCommands {
60 /// List all virtual networks.
61 List,
62 /// Show detailed information about a VPC.
63 Info {
64 /// VPC ID.
65 #[arg(long)]
66 id: String
67 },
68 /// Create a new VPC.
69 Create {
70 /// VPC name.
71 #[arg(long)]
72 name: String,
73 /// IPv4 subnet mask (e.g. 192.168.0.0/24).
74 #[arg(long)]
75 subnet_v4: String,
76 /// Location (e.g. ru-1).
77 #[arg(long)]
78 location: String
79 },
80 /// Update a VPC's name and/or description.
81 Set {
82 /// VPC ID.
83 #[arg(long)]
84 id: String,
85 /// New name.
86 #[arg(long)]
87 name: Option<String>,
88 /// New description.
89 #[arg(long)]
90 description: Option<String>
91 },
92 /// List network ports of a VPC.
93 Ports {
94 /// VPC ID.
95 #[arg(long)]
96 id: String
97 },
98 /// Delete a VPC by ID.
99 Delete {
100 /// VPC ID.
101 #[arg(long)]
102 id: String
103 }
104}