api: move AcmeChallengeSchema to acme types module

It will be reused in a later patch in another module which should not
depend on the actual API implementation (ugly and cyclic)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2021-05-10 14:39:05 +02:00
parent 875d53ef6c
commit 60643023ad
2 changed files with 34 additions and 33 deletions

View File

@ -1,4 +1,5 @@
use serde::{Deserialize, Serialize};
use serde_json::Value;
use proxmox::api::{api, schema::{Schema, StringSchema, ApiStringFormat}};
@ -68,3 +69,32 @@ proxmox::api_string_type! {
#[serde(transparent)]
pub struct AcmeAccountName(String);
}
#[api(
properties: {
schema: {
type: Object,
additional_properties: true,
properties: {},
},
type: {
type: String,
},
},
)]
#[derive(Serialize)]
/// Schema for an ACME challenge plugin.
pub struct AcmeChallengeSchema {
/// Plugin ID.
pub id: String,
/// Human readable name, falls back to id.
pub name: String,
/// Plugin Type.
#[serde(rename = "type")]
pub ty: &'static str,
/// The plugin's parameter schema.
pub schema: Value,
}