mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 13:18:20 +00:00
Add subcommand wasmer domain register to register a new domain
This commit is contained in:
committed by
Christoph Herzog
parent
f3bfaf4cd5
commit
c0c4233349
@@ -865,6 +865,29 @@ pub async fn get_domain_with_records(
|
||||
Ok(opt)
|
||||
}
|
||||
|
||||
/// Register a new domain
|
||||
pub async fn register_domain(
|
||||
client: &WasmerClient,
|
||||
name: String,
|
||||
namespace: Option<String>,
|
||||
import_records: Option<bool>,
|
||||
) -> Result<types::DnsDomain, anyhow::Error> {
|
||||
let vars = types::RegisterDomainVars {
|
||||
name,
|
||||
namespace,
|
||||
import_records,
|
||||
};
|
||||
let opt = client
|
||||
.run_graphql_strict(types::RegisterDomain::build(vars))
|
||||
.await
|
||||
.map_err(anyhow::Error::from)?
|
||||
.register_domain
|
||||
.context("Domain registration failed")?
|
||||
.domain
|
||||
.context("Domain registration failed, no associatede domain found.")?;
|
||||
Ok(opt)
|
||||
}
|
||||
|
||||
/// Retrieve all DNS records.
|
||||
///
|
||||
/// NOTE: this is a privileged operation that requires extra permissions.
|
||||
|
||||
Reference in New Issue
Block a user