RFC: schema: make enums static

I don't see a reason to allow these to be dynamically
modifiable.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2019-05-23 11:27:45 +02:00
parent aa1b2e04fe
commit cc84a830c5
4 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@ pub fn api_method_upgrade_backup() -> ApiAsyncMethod {
ObjectSchema::new("Upgraded to backup protocol.")
.required("store", StringSchema::new("Datastore name."))
.required("backup-type", StringSchema::new("Backup type.")
.format(Arc::new(ApiStringFormat::Enum(vec!["vm".into(), "ct".into(), "host".into()]))))
.format(Arc::new(ApiStringFormat::Enum(&["vm", "ct", "host"]))))
.required("backup-id", StringSchema::new("Backup ID."))
)
}

View File

@ -130,7 +130,7 @@ pub fn api_method_upload_pxar() -> ApiAsyncMethod {
.required("store", StringSchema::new("Datastore name."))
.required("archive-name", StringSchema::new("Backup archive name."))
.required("backup-type", StringSchema::new("Backup type.")
.format(Arc::new(ApiStringFormat::Enum(vec!["ct".into(), "host".into()]))))
.format(Arc::new(ApiStringFormat::Enum(&["ct", "host"]))))
.required("backup-id", StringSchema::new("Backup ID."))
.required("backup-time", IntegerSchema::new("Backup time (Unix epoch.)")
.minimum(1547797308))
@ -194,7 +194,7 @@ pub fn api_method_download_pxar() -> ApiAsyncMethod {
.required("store", StringSchema::new("Datastore name."))
.required("archive-name", StringSchema::new("Backup archive name."))
.required("backup-type", StringSchema::new("Backup type.")
.format(Arc::new(ApiStringFormat::Enum(vec!["ct".into(), "host".into()]))))
.format(Arc::new(ApiStringFormat::Enum(&["ct", "host"]))))
.required("backup-id", StringSchema::new("Backup ID."))
.required("backup-time", IntegerSchema::new("Backup time (Unix epoch.)")
.minimum(1547797308))