Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions openstack_cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::auth;
use crate::block_storage::v3 as block_storage;
use crate::catalog;
use crate::compute::v2 as compute;
use crate::dns::v2 as dns;
use crate::identity::v3 as identity;
use crate::image::v2 as image;
use crate::load_balancer::v2 as load_balancer;
Expand Down Expand Up @@ -168,6 +169,7 @@ pub enum TopLevelCommands {
BlockStorage(block_storage::BlockStorageCommand),
Catalog(catalog::CatalogCommand),
Compute(compute::ComputeCommand),
Dns(dns::DnsCommand),
Identity(identity::IdentityCommand),
Image(image::ImageCommand),
LoadBalancer(load_balancer::LoadBalancerCommand),
Expand Down Expand Up @@ -202,6 +204,7 @@ impl Cli {
TopLevelCommands::BlockStorage(args) => args.take_action(self, client).await,
TopLevelCommands::Catalog(args) => args.take_action(self, client).await,
TopLevelCommands::Compute(args) => args.take_action(self, client).await,
TopLevelCommands::Dns(args) => args.take_action(self, client).await,
TopLevelCommands::Identity(args) => args.take_action(self, client).await,
TopLevelCommands::Image(args) => args.take_action(self, client).await,
TopLevelCommands::LoadBalancer(args) => args.take_action(self, client).await,
Expand Down
1 change: 1 addition & 0 deletions openstack_cli/src/dns/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
// SPDX-License-Identifier: Apache-2.0

//! DNS (Designate) API bindings
pub(super) mod v2;
56 changes: 56 additions & 0 deletions openstack_cli/src/dns/v2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

//! DNS API v2 command

use clap::{Parser, Subcommand};

use openstack_sdk::{types::ServiceType, AsyncOpenStack};

use crate::{Cli, OpenStackCliError};

mod recordset;
mod zone;

/// DNS service (Designate) operations
#[derive(Parser)]
pub struct DnsCommand {
/// Dns service resource
#[command(subcommand)]
command: DnsCommands,
}

/// Dns resources commands
#[allow(missing_docs)]
#[derive(Subcommand)]
pub enum DnsCommands {
Recordset(Box<recordset::RecordsetCommand>),
Zone(Box<zone::ZoneCommand>),
}

impl DnsCommand {
/// Perform command action
pub async fn take_action(
&self,
parsed_args: &Cli,
session: &mut AsyncOpenStack,
) -> Result<(), OpenStackCliError> {
session.discover_service_endpoint(&ServiceType::Dns).await?;

match &self.command {
DnsCommands::Recordset(cmd) => cmd.take_action(parsed_args, session).await,
DnsCommands::Zone(cmd) => cmd.take_action(parsed_args, session).await,
}
}
}
52 changes: 52 additions & 0 deletions openstack_cli/src/dns/v2/recordset.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

//! DNS project Recordsets management
use clap::{Parser, Subcommand};

use openstack_sdk::AsyncOpenStack;

use crate::{Cli, OpenStackCliError};

mod list;

/// DNS Project recordsets operations
///
/// This command manages all Recordsets owned by a project.
#[derive(Parser)]
pub struct RecordsetCommand {
/// subcommand
#[command(subcommand)]
command: RecordsetCommands,
}

/// Supported subcommands
#[allow(missing_docs)]
#[derive(Subcommand)]
pub enum RecordsetCommands {
List(list::RecordsetsCommand),
}

impl RecordsetCommand {
/// Perform command action
pub async fn take_action(
&self,
parsed_args: &Cli,
session: &mut AsyncOpenStack,
) -> Result<(), OpenStackCliError> {
match &self.command {
RecordsetCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
}
}
}
68 changes: 68 additions & 0 deletions openstack_cli/src/dns/v2/zone.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

//! DNS Zone management
use clap::{Parser, Subcommand};

use openstack_sdk::AsyncOpenStack;

use crate::{Cli, OpenStackCliError};

mod create;
mod delete;
mod list;
mod nameserver;
mod recordset;
mod set;
mod show;

/// DNS Zone operations
#[derive(Parser)]
pub struct ZoneCommand {
/// subcommand
#[command(subcommand)]
command: ZoneCommands,
}

/// Supported subcommands
#[allow(missing_docs)]
#[derive(Subcommand)]
pub enum ZoneCommands {
Create(create::ZoneCommand),
Delete(delete::ZoneCommand),
List(list::ZonesCommand),
Nameserver(nameserver::NameserverCommand),
Recordset(recordset::RecordsetCommand),
Show(show::ZoneCommand),
Set(set::ZoneCommand),
}

impl ZoneCommand {
/// Perform command action
pub async fn take_action(
&self,
parsed_args: &Cli,
session: &mut AsyncOpenStack,
) -> Result<(), OpenStackCliError> {
match &self.command {
ZoneCommands::Create(cmd) => cmd.take_action(parsed_args, session).await,
ZoneCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
ZoneCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
ZoneCommands::Nameserver(cmd) => cmd.take_action(parsed_args, session).await,
ZoneCommands::Recordset(cmd) => cmd.take_action(parsed_args, session).await,
ZoneCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
ZoneCommands::Set(cmd) => cmd.take_action(parsed_args, session).await,
}
}
}
50 changes: 50 additions & 0 deletions openstack_cli/src/dns/v2/zone/nameserver.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

//! DNS Zone Nameserver management
use clap::{Parser, Subcommand};

use openstack_sdk::AsyncOpenStack;

use crate::{Cli, OpenStackCliError};

mod list;

/// DNS recordsets operations
#[derive(Parser)]
pub struct NameserverCommand {
/// subcommand
#[command(subcommand)]
command: NameserverCommands,
}

/// Supported subcommands
#[allow(missing_docs)]
#[derive(Subcommand)]
pub enum NameserverCommands {
List(list::NameserversCommand),
}

impl NameserverCommand {
/// Perform command action
pub async fn take_action(
&self,
parsed_args: &Cli,
session: &mut AsyncOpenStack,
) -> Result<(), OpenStackCliError> {
match &self.command {
NameserverCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
}
}
}
114 changes: 0 additions & 114 deletions openstack_cli/src/dns/v2/zone/nameserver/get.rs

This file was deleted.

Loading