use new api updater features

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Dietmar Maurer
2021-08-12 09:30:41 +02:00
committed by Wolfgang Bumiller
parent be5b468975
commit a8a20e9210
10 changed files with 164 additions and 173 deletions

View File

@ -62,20 +62,21 @@ impl Default for StandalonePlugin {
#[serde(rename_all = "kebab-case")]
pub struct DnsPluginCore {
/// Plugin ID.
pub(crate) id: String,
#[updater(skip)]
pub id: String,
/// DNS API Plugin Id.
pub(crate) api: String,
pub api: String,
/// Extra delay in seconds to wait before requesting validation.
///
/// Allows to cope with long TTL of DNS records.
#[serde(skip_serializing_if = "Option::is_none", default)]
pub(crate) validation_delay: Option<u32>,
pub validation_delay: Option<u32>,
/// Flag to disable the config.
#[serde(skip_serializing_if = "Option::is_none", default)]
disable: Option<bool>,
pub disable: Option<bool>,
}
#[api(
@ -88,17 +89,12 @@ pub struct DnsPluginCore {
#[serde(rename_all = "kebab-case")]
pub struct DnsPlugin {
#[serde(flatten)]
pub(crate) core: DnsPluginCore,
pub core: DnsPluginCore,
// FIXME: The `Updater` should allow:
// * having different descriptions for this and the Updater version
// * having different `#[serde]` attributes for the Updater
// * or, well, leaving fields out completely in teh Updater but this means we may need to
// separate Updater and Builder deriving.
// We handle this property separately in the API calls.
/// DNS plugin data (base64url encoded without padding).
#[serde(with = "proxmox::tools::serde::string_as_base64url_nopad")]
pub(crate) data: String,
pub data: String,
}
impl DnsPlugin {

View File

@ -5,7 +5,7 @@ use serde::{Serialize, Deserialize};
use proxmox::api::{
api,
schema::{Schema, StringSchema},
schema::{Schema, StringSchema, Updater},
section_config::{
SectionConfig,
SectionConfigData,
@ -82,14 +82,16 @@ pub const DIR_NAME_SCHEMA: Schema = StringSchema::new("Directory name").schema()
},
}
)]
#[derive(Serialize,Deserialize)]
#[derive(Serialize,Deserialize,Updater)]
#[serde(rename_all="kebab-case")]
/// Datastore configuration properties.
pub struct DataStoreConfig {
#[updater(skip)]
pub name: String,
#[updater(skip)]
pub path: String,
#[serde(skip_serializing_if="Option::is_none")]
pub comment: Option<String>,
pub path: String,
#[serde(skip_serializing_if="Option::is_none")]
pub gc_schedule: Option<String>,
#[serde(skip_serializing_if="Option::is_none")]

View File

@ -94,26 +94,26 @@ pub struct AcmeConfig {
/// Node specific configuration.
pub struct NodeConfig {
/// The acme account to use on this node.
#[serde(skip_serializing_if = "Updater::is_empty")]
acme: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub acme: Option<String>,
#[serde(skip_serializing_if = "Updater::is_empty")]
acmedomain0: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub acmedomain0: Option<String>,
#[serde(skip_serializing_if = "Updater::is_empty")]
acmedomain1: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub acmedomain1: Option<String>,
#[serde(skip_serializing_if = "Updater::is_empty")]
acmedomain2: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub acmedomain2: Option<String>,
#[serde(skip_serializing_if = "Updater::is_empty")]
acmedomain3: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub acmedomain3: Option<String>,
#[serde(skip_serializing_if = "Updater::is_empty")]
acmedomain4: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub acmedomain4: Option<String>,
#[serde(skip_serializing_if = "Updater::is_empty")]
http_proxy: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub http_proxy: Option<String>,
}
impl NodeConfig {

View File

@ -96,18 +96,18 @@ pub struct WebauthnConfig {
/// Relying party name. Any text identifier.
///
/// Changing this *may* break existing credentials.
rp: String,
pub rp: String,
/// Site origin. Must be a `https://` URL (or `http://localhost`). Should contain the address
/// users type in their browsers to access the web interface.
///
/// Changing this *may* break existing credentials.
origin: String,
pub origin: String,
/// Relying part ID. Must be the domain name without protocol, port or location.
///
/// Changing this *will* break existing credentials.
id: String,
pub id: String,
}
impl WebauthnConfig {