Skip to main content

openstack_cli_compute/v2/
server_external_event.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//! External event
16
17use clap::{Parser, Subcommand};
18
19use openstack_sdk::AsyncOpenStack;
20
21use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
22
23pub mod create_20;
24pub mod create_251;
25pub mod create_276;
26pub mod create_282;
27pub mod create_293;
28
29/// Create external events (os-server-external-events)
30///
31/// Creates one or more external events. The API dispatches each event to a server instance.
32///
33/// **Warning**
34///
35/// This is an admin level service API only designed to be used by other OpenStack services. The
36/// point of this API is to coordinate between Nova and Neutron, Nova and Cinder, Nova and Ironic
37/// (and potentially future services) on activities they both need to be involved in, such as
38/// network hotplugging.
39///
40/// Unless you are writing Neutron, Cinder or Ironic code you should not be using this API.
41#[derive(Parser)]
42pub struct ServerExternalEventCommand {
43    /// subcommand
44    #[command(subcommand)]
45    command: ServerExternalEventCommands,
46}
47
48/// Supported subcommands
49#[allow(missing_docs)]
50#[derive(Subcommand)]
51pub enum ServerExternalEventCommands {
52    Create20(create_20::ServerExternalEventCommand),
53    Create251(create_251::ServerExternalEventCommand),
54    Create276(create_276::ServerExternalEventCommand),
55    Create282(create_282::ServerExternalEventCommand),
56    #[command(visible_alias = "create")]
57    Create293(create_293::ServerExternalEventCommand),
58}
59
60impl ServerExternalEventCommand {
61    /// Perform command action
62    pub async fn take_action<C: CliArgs>(
63        &self,
64        parsed_args: &C,
65        session: &mut AsyncOpenStack,
66    ) -> Result<(), OpenStackCliError> {
67        match &self.command {
68            ServerExternalEventCommands::Create20(cmd) => {
69                cmd.take_action(parsed_args, session).await
70            }
71            ServerExternalEventCommands::Create251(cmd) => {
72                cmd.take_action(parsed_args, session).await
73            }
74            ServerExternalEventCommands::Create276(cmd) => {
75                cmd.take_action(parsed_args, session).await
76            }
77            ServerExternalEventCommands::Create282(cmd) => {
78                cmd.take_action(parsed_args, session).await
79            }
80            ServerExternalEventCommands::Create293(cmd) => {
81                cmd.take_action(parsed_args, session).await
82            }
83        }
84    }
85}