-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add subcommand
wasmer domain register
to register a new domain
- Loading branch information
Showing
5 changed files
with
95 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use crate::{ | ||
commands::AsyncCliCommand, | ||
opts::{ApiOpts, ItemTableFormatOpts}, | ||
}; | ||
|
||
/// Show a domain | ||
#[derive(clap::Parser, Debug)] | ||
pub struct CmdDomainRegister { | ||
#[clap(flatten)] | ||
fmt: ItemTableFormatOpts, | ||
#[clap(flatten)] | ||
api: ApiOpts, | ||
|
||
/// Name of the domain. | ||
name: String, | ||
|
||
/// owner under which the domain will live. | ||
#[clap(long, short)] | ||
namespace: Option<String>, | ||
|
||
/// auto update DNS records for this domain. | ||
#[clap(long, short)] | ||
import_records: bool, | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl AsyncCliCommand for CmdDomainRegister { | ||
type Output = (); | ||
|
||
async fn run_async(self) -> Result<(), anyhow::Error> { | ||
let client = self.api.client()?; | ||
let domain = wasmer_api::query::register_domain( | ||
&client, | ||
self.name, | ||
self.namespace, | ||
Some(self.import_records), | ||
) | ||
.await?; | ||
println!( | ||
"{}: domain registered under owner `{}`", | ||
domain.name, domain.owner.global_name | ||
); | ||
Ok(()) | ||
} | ||
} |