src/api2/types.rs: define REMOTE_ID_SCHEMA here
This commit is contained in:
@ -3,6 +3,7 @@ use serde_json::Value;
|
||||
|
||||
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment};
|
||||
|
||||
use crate::api2::types::*;
|
||||
use crate::config::remotes;
|
||||
|
||||
#[api(
|
||||
@ -34,7 +35,7 @@ pub fn list_remotes(
|
||||
input: {
|
||||
properties: {
|
||||
name: {
|
||||
schema: remotes::REMOTE_ID_SCHEMA,
|
||||
schema: REMOTE_ID_SCHEMA,
|
||||
},
|
||||
comment: {
|
||||
optional: true,
|
||||
@ -77,7 +78,7 @@ pub fn create_remote(name: String, param: Value) -> Result<(), Error> {
|
||||
input: {
|
||||
properties: {
|
||||
name: {
|
||||
schema: remotes::REMOTE_ID_SCHEMA,
|
||||
schema: REMOTE_ID_SCHEMA,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -117,6 +117,12 @@ pub const DATASTORE_SCHEMA: Schema = StringSchema::new("Datastore name.")
|
||||
.max_length(32)
|
||||
.schema();
|
||||
|
||||
pub const REMOTE_ID_SCHEMA: Schema = StringSchema::new("Remote ID.")
|
||||
.format(&PROXMOX_SAFE_ID_FORMAT)
|
||||
.min_length(3)
|
||||
.max_length(32)
|
||||
.schema();
|
||||
|
||||
|
||||
|
||||
// Complex type definitions
|
||||
|
Reference in New Issue
Block a user