openstack_cli_placement/v1/
allocation.rs1use clap::{Parser, Subcommand};
17
18use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
19use openstack_sdk::AsyncOpenStack;
20
21pub mod create_113;
22pub mod create_128;
23pub mod create_134;
24pub mod create_138;
25pub mod delete;
26pub mod set_10;
27pub mod set_112;
28pub mod set_128;
29pub mod set_138;
30pub mod set_18;
31pub mod show;
32
33#[derive(Parser)]
39pub struct AllocationCommand {
40 #[command(subcommand)]
41 command: AllocationCommands,
42}
43
44#[allow(missing_docs)]
46#[derive(Subcommand)]
47pub enum AllocationCommands {
48 #[command(visible_alias = "create")]
49 Create138(create_138::AllocationCommand),
50 Create134(create_134::AllocationCommand),
51 Create128(create_128::AllocationCommand),
52 Create113(create_113::AllocationCommand),
53 Delete(delete::AllocationCommand),
54 #[command(visible_alias = "set")]
55 Set138(set_138::AllocationCommand),
56 Set128(set_128::AllocationCommand),
57 Set112(set_112::AllocationCommand),
58 Set18(set_18::AllocationCommand),
59 Set10(set_10::AllocationCommand),
60 Show(show::AllocationCommand),
61}
62
63impl AllocationCommand {
64 pub async fn take_action<C: CliArgs>(
66 &self,
67 parsed_args: &C,
68 session: &mut AsyncOpenStack,
69 ) -> Result<(), OpenStackCliError> {
70 match &self.command {
71 AllocationCommands::Create138(cmd) => cmd.take_action(parsed_args, session).await,
72 AllocationCommands::Create134(cmd) => cmd.take_action(parsed_args, session).await,
73 AllocationCommands::Create128(cmd) => cmd.take_action(parsed_args, session).await,
74 AllocationCommands::Create113(cmd) => cmd.take_action(parsed_args, session).await,
75 AllocationCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
76 AllocationCommands::Set128(cmd) => cmd.take_action(parsed_args, session).await,
77 AllocationCommands::Set138(cmd) => cmd.take_action(parsed_args, session).await,
78 AllocationCommands::Set112(cmd) => cmd.take_action(parsed_args, session).await,
79 AllocationCommands::Set18(cmd) => cmd.take_action(parsed_args, session).await,
80 AllocationCommands::Set10(cmd) => cmd.take_action(parsed_args, session).await,
81 AllocationCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
82 }
83 }
84}