Skip to main content

openstack_cli_compute/v2/
server.rs

1// Licensed under the Apache License, Version 2.0 (the "License");
2// you may not use this file except in compliance with the License.
3// You may obtain a copy of the License at
4//
5//     http://www.apache.org/licenses/LICENSE-2.0
6//
7// Unless required by applicable law or agreed to in writing, software
8// distributed under the License is distributed on an "AS IS" BASIS,
9// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10// See the License for the specific language governing permissions and
11// limitations under the License.
12//
13// SPDX-License-Identifier: Apache-2.0
14
15//! Compute Server commands
16
17use clap::{Parser, Subcommand};
18
19use openstack_sdk::AsyncOpenStack;
20
21use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
22
23pub mod add_fixed_ip_21;
24pub mod add_floating_ip_21;
25pub mod add_security_group;
26pub mod change_password;
27pub mod confirm_resize;
28// mod create_20;
29pub mod create_21;
30pub mod create_219;
31pub mod create_232;
32pub mod create_233;
33pub mod create_237;
34pub mod create_242;
35pub mod create_252;
36pub mod create_257;
37pub mod create_263;
38pub mod create_267;
39pub mod create_274;
40pub mod create_290;
41pub mod create_294;
42pub mod create_backup_21;
43pub mod create_image_21;
44pub mod delete;
45/// Server diagnostics
46pub mod diagnostic {
47    pub mod get;
48}
49pub mod evacuate_214;
50pub mod evacuate_229;
51pub mod evacuate_268;
52pub mod evacuate_295;
53pub mod force_delete;
54pub mod inject_network_info;
55pub mod instance_action;
56pub mod interface;
57pub mod ip;
58pub mod list;
59pub mod lock_273;
60pub mod metadata;
61pub mod migrate_256;
62pub mod migration;
63pub mod os_get_console_output;
64// Comment out deprecated APIs
65// mod os_get_rdpconsole_21;
66// mod os_get_serial_console_21;
67// mod os_get_spiceconsole_21;
68// mod os_get_vncconsole_21;
69pub mod os_migrate_live_20;
70pub mod os_migrate_live_225;
71pub mod os_migrate_live_230;
72pub mod os_migrate_live_268;
73pub mod os_reset_state;
74pub mod os_start;
75pub mod os_stop;
76pub mod pause;
77pub mod reboot;
78pub mod rebuild_21;
79pub mod rebuild_219;
80pub mod rebuild_254;
81pub mod rebuild_257;
82pub mod rebuild_263;
83pub mod rebuild_290;
84pub mod rebuild_294;
85pub mod remote_console;
86pub mod remove_fixed_ip_21;
87pub mod remove_floating_ip_21;
88pub mod remove_security_group;
89pub mod rescue;
90pub mod reset_network;
91pub mod resize;
92pub mod restore;
93pub mod resume;
94pub mod revert_resize;
95/// Server security group
96pub mod security_group {
97    pub mod list;
98}
99pub mod server_password;
100// mod set_20;
101pub mod set_21;
102pub mod set_219;
103pub mod set_290;
104pub mod set_294;
105pub mod shelve;
106pub mod shelve_offload;
107pub mod show;
108pub mod suspend;
109pub mod tag;
110/// Server topology
111pub mod topology {
112    pub mod list;
113}
114pub mod trigger_crash_dump_217;
115pub mod unlock_21;
116pub mod unpause;
117pub mod unrescue;
118pub mod unshelve_277;
119pub mod unshelve_291;
120pub mod volume_attachment;
121
122/// **Servers (servers)**
123///
124/// Lists, creates, shows details for, updates, and deletes
125/// servers.
126///
127/// **Passwords**
128///
129/// When you create a server, you can specify a password through
130/// the optional adminPass attribute. The password must meet the
131/// complexity requirements set by your OpenStack Compute provider.
132/// The server might enter an ERROR state if the complexity
133/// requirements are not met. In this case, a client might issue a
134/// change password action to reset the server password.
135///
136/// If you do not specify a password, the API generates and assigns
137/// a random password that it returns in the response object. This
138/// password meets the security requirements set by the compute
139/// provider. For security reasons, subsequent GET calls do not
140/// require this password.
141///
142/// **Server metadata**
143///
144/// You can specify custom server metadata at server launch time.
145/// The maximum size for each metadata key-value pair is 255 bytes.
146/// The compute provider determines the maximum number of key-value
147/// pairs for each server. You can query this value through the
148/// maxServerMeta absolute limit.
149#[derive(Parser)]
150#[command(about = "Servers")]
151pub struct ServerCommand {
152    /// sucommand
153    #[command(subcommand)]
154    command: ServerCommands,
155}
156
157/// Supported subcommands
158#[allow(missing_docs)]
159#[derive(Subcommand)]
160pub enum ServerCommands {
161    #[command(visible_alias = "add-fixed-ip")]
162    AddFixedIP21(Box<add_fixed_ip_21::ServerCommand>),
163    #[command(visible_alias = "add-floating-ip")]
164    AddFloatingIP21(Box<add_floating_ip_21::ServerCommand>),
165    AddSecurityGroup(Box<add_security_group::ServerCommand>),
166    ChangePassword(Box<change_password::ServerCommand>),
167    ConfirmResize(Box<confirm_resize::ServerCommand>),
168    #[command(visible_alias = "create")]
169    Create294(Box<create_294::ServerCommand>),
170    Create290(Box<create_290::ServerCommand>),
171    Create274(Box<create_274::ServerCommand>),
172    Create267(Box<create_267::ServerCommand>),
173    Create263(Box<create_263::ServerCommand>),
174    Create257(Box<create_257::ServerCommand>),
175    Create252(Box<create_252::ServerCommand>),
176    Create242(Box<create_242::ServerCommand>),
177    Create237(Box<create_237::ServerCommand>),
178    Create233(Box<create_233::ServerCommand>),
179    Create232(Box<create_232::ServerCommand>),
180    Create219(Box<create_219::ServerCommand>),
181    Create21(Box<create_21::ServerCommand>),
182    #[command(visible_alias = "create-backup")]
183    CreateBackup21(Box<create_backup_21::ServerCommand>),
184    #[command(visible_alias = "create-image")]
185    CreateImage21(Box<create_image_21::ServerCommand>),
186    Delete(Box<delete::ServerCommand>),
187    Diagnostic(Box<diagnostic::get::DiagnosticCommand>),
188    Evacuate214(Box<evacuate_214::ServerCommand>),
189    Evacuate229(Box<evacuate_229::ServerCommand>),
190    Evacuate268(Box<evacuate_268::ServerCommand>),
191    #[command(visible_alias = "evacuate")]
192    Evacuate295(Box<evacuate_295::ServerCommand>),
193    ForceDelete(Box<force_delete::ServerCommand>),
194    GetConsoleOutput(Box<os_get_console_output::ServerCommand>),
195    InstanceAction(Box<instance_action::InstanceActionCommand>),
196    Interface(Box<interface::InterfaceCommand>),
197    InjectNetworkInfo(Box<inject_network_info::ServerCommand>),
198    Ip(Box<ip::IpCommand>),
199    List(Box<list::ServersCommand>),
200    LiveMigrate20(Box<os_migrate_live_20::ServerCommand>),
201    LiveMigrate225(Box<os_migrate_live_225::ServerCommand>),
202    LiveMigrate230(Box<os_migrate_live_230::ServerCommand>),
203    #[command(visible_alias = "live-migrate")]
204    LiveMigrate268(Box<os_migrate_live_268::ServerCommand>),
205    #[command(visible_alias = "lock")]
206    Lock273(Box<lock_273::ServerCommand>),
207    Metadata(Box<metadata::MetadataCommand>),
208    #[command(visible_alias = "migrate")]
209    Migrate256(Box<migrate_256::ServerCommand>),
210    Migration(Box<migration::MigrationCommand>),
211    Password(Box<server_password::PasswordCommand>),
212    Pause(Box<pause::ServerCommand>),
213    ResetState(Box<os_reset_state::ServerCommand>),
214    Reboot(Box<reboot::ServerCommand>),
215    Rebuild21(Box<rebuild_21::ServerCommand>),
216    Rebuild219(Box<rebuild_219::ServerCommand>),
217    Rebuild254(Box<rebuild_254::ServerCommand>),
218    Rebuild257(Box<rebuild_257::ServerCommand>),
219    Rebuild263(Box<rebuild_263::ServerCommand>),
220    Rebuild290(Box<rebuild_290::ServerCommand>),
221    #[command(visible_alias = "rebuild")]
222    Rebuild294(Box<rebuild_294::ServerCommand>),
223    RemoteConsole(Box<remote_console::RemoteConsoleCommand>),
224    #[command(visible_alias = "remove-fixed-ip")]
225    RemoveFixedIP21(Box<remove_fixed_ip_21::ServerCommand>),
226    #[command(visible_alias = "remove-floating-ip")]
227    RemoveFloatingIP21(Box<remove_floating_ip_21::ServerCommand>),
228    RemoveSecurityGroup(Box<remove_security_group::ServerCommand>),
229    Rescue(Box<rescue::ServerCommand>),
230    ResetNetwork(Box<reset_network::ServerCommand>),
231    Resize(Box<resize::ServerCommand>),
232    Restore(Box<restore::ServerCommand>),
233    Resume(Box<resume::ServerCommand>),
234    RevertResize(Box<revert_resize::ServerCommand>),
235    SecurityGroups(Box<security_group::list::SecurityGroupsCommand>),
236    Set21(Box<set_21::ServerCommand>),
237    Set219(Box<set_219::ServerCommand>),
238    Set290(Box<set_290::ServerCommand>),
239    #[command(visible_alias = "set")]
240    Set294(Box<set_294::ServerCommand>),
241    Shelve(Box<shelve::ServerCommand>),
242    ShelveOffload(Box<shelve_offload::ServerCommand>),
243    Show(Box<show::ServerCommand>),
244    Start(Box<os_start::ServerCommand>),
245    Stop(Box<os_stop::ServerCommand>),
246    Suspend(Box<suspend::ServerCommand>),
247    Tag(Box<tag::TagCommand>),
248    Topology(Box<topology::list::TopologiesCommand>),
249    #[command(visible_alias = "trigger-crash-dump")]
250    TriggerCrashDump217(Box<trigger_crash_dump_217::ServerCommand>),
251    #[command(visible_alias = "unlock")]
252    Unlock21(Box<unlock_21::ServerCommand>),
253    Unpause(Box<unpause::ServerCommand>),
254    Unrescue(Box<unrescue::ServerCommand>),
255    Unshelve277(Box<unshelve_277::ServerCommand>),
256    #[command(visible_alias = "unshelve")]
257    Unshelve291(Box<unshelve_291::ServerCommand>),
258    VolumeAttachment(Box<volume_attachment::VolumeAttachmentCommand>),
259}
260
261impl ServerCommand {
262    /// Perform command action
263    pub async fn take_action<C: CliArgs>(
264        &self,
265        parsed_args: &C,
266        session: &mut AsyncOpenStack,
267    ) -> Result<(), OpenStackCliError> {
268        match &self.command {
269            ServerCommands::AddFixedIP21(cmd) => cmd.take_action(parsed_args, session).await,
270            ServerCommands::AddFloatingIP21(cmd) => cmd.take_action(parsed_args, session).await,
271            ServerCommands::AddSecurityGroup(cmd) => cmd.take_action(parsed_args, session).await,
272            ServerCommands::ChangePassword(cmd) => cmd.take_action(parsed_args, session).await,
273            ServerCommands::ConfirmResize(cmd) => cmd.take_action(parsed_args, session).await,
274            ServerCommands::Create294(cmd) => cmd.take_action(parsed_args, session).await,
275            ServerCommands::Create290(cmd) => cmd.take_action(parsed_args, session).await,
276            ServerCommands::Create274(cmd) => cmd.take_action(parsed_args, session).await,
277            ServerCommands::Create267(cmd) => cmd.take_action(parsed_args, session).await,
278            ServerCommands::Create263(cmd) => cmd.take_action(parsed_args, session).await,
279            ServerCommands::Create257(cmd) => cmd.take_action(parsed_args, session).await,
280            ServerCommands::Create252(cmd) => cmd.take_action(parsed_args, session).await,
281            ServerCommands::Create242(cmd) => cmd.take_action(parsed_args, session).await,
282            ServerCommands::Create237(cmd) => cmd.take_action(parsed_args, session).await,
283            ServerCommands::Create233(cmd) => cmd.take_action(parsed_args, session).await,
284            ServerCommands::Create232(cmd) => cmd.take_action(parsed_args, session).await,
285
286            ServerCommands::Create219(cmd) => cmd.take_action(parsed_args, session).await,
287
288            ServerCommands::Create21(cmd) => cmd.take_action(parsed_args, session).await,
289
290            ServerCommands::CreateBackup21(cmd) => cmd.take_action(parsed_args, session).await,
291
292            ServerCommands::CreateImage21(cmd) => cmd.take_action(parsed_args, session).await,
293
294            ServerCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
295
296            ServerCommands::Diagnostic(cmd) => cmd.take_action(parsed_args, session).await,
297
298            ServerCommands::Evacuate214(cmd) => cmd.take_action(parsed_args, session).await,
299
300            ServerCommands::Evacuate229(cmd) => cmd.take_action(parsed_args, session).await,
301
302            ServerCommands::Evacuate268(cmd) => cmd.take_action(parsed_args, session).await,
303
304            ServerCommands::Evacuate295(cmd) => cmd.take_action(parsed_args, session).await,
305
306            ServerCommands::ForceDelete(cmd) => cmd.take_action(parsed_args, session).await,
307
308            ServerCommands::GetConsoleOutput(cmd) => cmd.take_action(parsed_args, session).await,
309            ServerCommands::InstanceAction(cmd) => cmd.take_action(parsed_args, session).await,
310
311            ServerCommands::Interface(cmd) => cmd.take_action(parsed_args, session).await,
312
313            ServerCommands::InjectNetworkInfo(cmd) => cmd.take_action(parsed_args, session).await,
314            ServerCommands::Ip(cmd) => cmd.take_action(parsed_args, session).await,
315            ServerCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
316
317            ServerCommands::LiveMigrate20(cmd) => cmd.take_action(parsed_args, session).await,
318
319            ServerCommands::LiveMigrate225(cmd) => cmd.take_action(parsed_args, session).await,
320
321            ServerCommands::LiveMigrate230(cmd) => cmd.take_action(parsed_args, session).await,
322
323            ServerCommands::LiveMigrate268(cmd) => cmd.take_action(parsed_args, session).await,
324
325            ServerCommands::Lock273(cmd) => cmd.take_action(parsed_args, session).await,
326
327            ServerCommands::Metadata(cmd) => cmd.take_action(parsed_args, session).await,
328            ServerCommands::Migrate256(cmd) => cmd.take_action(parsed_args, session).await,
329
330            ServerCommands::Migration(cmd) => cmd.take_action(parsed_args, session).await,
331
332            ServerCommands::Password(cmd) => cmd.take_action(parsed_args, session).await,
333
334            ServerCommands::Pause(cmd) => cmd.take_action(parsed_args, session).await,
335
336            ServerCommands::ResetState(cmd) => cmd.take_action(parsed_args, session).await,
337
338            ServerCommands::Reboot(cmd) => cmd.take_action(parsed_args, session).await,
339
340            ServerCommands::Rebuild21(cmd) => cmd.take_action(parsed_args, session).await,
341
342            ServerCommands::Rebuild219(cmd) => cmd.take_action(parsed_args, session).await,
343
344            ServerCommands::Rebuild254(cmd) => cmd.take_action(parsed_args, session).await,
345
346            ServerCommands::Rebuild257(cmd) => cmd.take_action(parsed_args, session).await,
347
348            ServerCommands::Rebuild263(cmd) => cmd.take_action(parsed_args, session).await,
349
350            ServerCommands::Rebuild290(cmd) => cmd.take_action(parsed_args, session).await,
351
352            ServerCommands::Rebuild294(cmd) => cmd.take_action(parsed_args, session).await,
353
354            ServerCommands::RemoveFixedIP21(cmd) => cmd.take_action(parsed_args, session).await,
355
356            ServerCommands::RemoveFloatingIP21(cmd) => cmd.take_action(parsed_args, session).await,
357            ServerCommands::RemoveSecurityGroup(cmd) => cmd.take_action(parsed_args, session).await,
358            ServerCommands::RemoteConsole(cmd) => cmd.take_action(parsed_args, session).await,
359
360            ServerCommands::Rescue(cmd) => cmd.take_action(parsed_args, session).await,
361
362            ServerCommands::ResetNetwork(cmd) => cmd.take_action(parsed_args, session).await,
363
364            ServerCommands::Resize(cmd) => cmd.take_action(parsed_args, session).await,
365
366            ServerCommands::Restore(cmd) => cmd.take_action(parsed_args, session).await,
367
368            ServerCommands::Resume(cmd) => cmd.take_action(parsed_args, session).await,
369
370            ServerCommands::RevertResize(cmd) => cmd.take_action(parsed_args, session).await,
371
372            ServerCommands::SecurityGroups(cmd) => cmd.take_action(parsed_args, session).await,
373            ServerCommands::Set21(cmd) => cmd.take_action(parsed_args, session).await,
374
375            ServerCommands::Set219(cmd) => cmd.take_action(parsed_args, session).await,
376
377            ServerCommands::Set290(cmd) => cmd.take_action(parsed_args, session).await,
378
379            ServerCommands::Set294(cmd) => cmd.take_action(parsed_args, session).await,
380
381            ServerCommands::Shelve(cmd) => cmd.take_action(parsed_args, session).await,
382
383            ServerCommands::ShelveOffload(cmd) => cmd.take_action(parsed_args, session).await,
384
385            ServerCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
386
387            ServerCommands::Start(cmd) => cmd.take_action(parsed_args, session).await,
388
389            ServerCommands::Stop(cmd) => cmd.take_action(parsed_args, session).await,
390
391            ServerCommands::Suspend(cmd) => cmd.take_action(parsed_args, session).await,
392
393            ServerCommands::Tag(cmd) => cmd.take_action(parsed_args, session).await,
394
395            ServerCommands::Topology(cmd) => cmd.take_action(parsed_args, session).await,
396            ServerCommands::TriggerCrashDump217(cmd) => cmd.take_action(parsed_args, session).await,
397            ServerCommands::Unlock21(cmd) => cmd.take_action(parsed_args, session).await,
398            ServerCommands::Unpause(cmd) => cmd.take_action(parsed_args, session).await,
399            ServerCommands::Unrescue(cmd) => cmd.take_action(parsed_args, session).await,
400            ServerCommands::Unshelve277(cmd) => cmd.take_action(parsed_args, session).await,
401            ServerCommands::Unshelve291(cmd) => cmd.take_action(parsed_args, session).await,
402            ServerCommands::VolumeAttachment(cmd) => cmd.take_action(parsed_args, session).await,
403        }
404    }
405}