src/api2/types.rs: define REMOTE_ID_SCHEMA here
This commit is contained in:
parent
6de36b94b1
commit
167971ed49
@ -3,6 +3,7 @@ use serde_json::Value;
|
|||||||
|
|
||||||
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment};
|
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment};
|
||||||
|
|
||||||
|
use crate::api2::types::*;
|
||||||
use crate::config::remotes;
|
use crate::config::remotes;
|
||||||
|
|
||||||
#[api(
|
#[api(
|
||||||
@ -34,7 +35,7 @@ pub fn list_remotes(
|
|||||||
input: {
|
input: {
|
||||||
properties: {
|
properties: {
|
||||||
name: {
|
name: {
|
||||||
schema: remotes::REMOTE_ID_SCHEMA,
|
schema: REMOTE_ID_SCHEMA,
|
||||||
},
|
},
|
||||||
comment: {
|
comment: {
|
||||||
optional: true,
|
optional: true,
|
||||||
@ -77,7 +78,7 @@ pub fn create_remote(name: String, param: Value) -> Result<(), Error> {
|
|||||||
input: {
|
input: {
|
||||||
properties: {
|
properties: {
|
||||||
name: {
|
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)
|
.max_length(32)
|
||||||
.schema();
|
.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
|
// Complex type definitions
|
||||||
|
@ -382,7 +382,7 @@ fn cert_mgmt_cli() -> CommandLineInterface {
|
|||||||
schema: DATASTORE_SCHEMA,
|
schema: DATASTORE_SCHEMA,
|
||||||
},
|
},
|
||||||
remote: {
|
remote: {
|
||||||
schema: crate::config::remotes::REMOTE_ID_SCHEMA,
|
schema: REMOTE_ID_SCHEMA,
|
||||||
},
|
},
|
||||||
"remote-store": {
|
"remote-store": {
|
||||||
schema: DATASTORE_SCHEMA,
|
schema: DATASTORE_SCHEMA,
|
||||||
|
@ -7,6 +7,7 @@ use proxmox::api::{api, schema::*};
|
|||||||
|
|
||||||
use proxmox::tools::{fs::replace_file, fs::CreateOptions};
|
use proxmox::tools::{fs::replace_file, fs::CreateOptions};
|
||||||
|
|
||||||
|
use crate::api2::types::*;
|
||||||
use crate::section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
|
use crate::section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
@ -15,10 +16,6 @@ lazy_static! {
|
|||||||
|
|
||||||
// fixme: define better schemas
|
// fixme: define better schemas
|
||||||
|
|
||||||
pub const REMOTE_ID_SCHEMA: Schema = StringSchema::new("Remote ID.")
|
|
||||||
.min_length(3)
|
|
||||||
.schema();
|
|
||||||
|
|
||||||
pub const COMMENT_SCHEMA: Schema = StringSchema::new("Comment").schema();
|
pub const COMMENT_SCHEMA: Schema = StringSchema::new("Comment").schema();
|
||||||
pub const REMOTE_HOST_SCHEMA: Schema = StringSchema::new("Host IP address or DNS name.").schema();
|
pub const REMOTE_HOST_SCHEMA: Schema = StringSchema::new("Host IP address or DNS name.").schema();
|
||||||
pub const REMOTE_USERID_SCHEMA: Schema = StringSchema::new("User ID").schema();
|
pub const REMOTE_USERID_SCHEMA: Schema = StringSchema::new("User ID").schema();
|
||||||
|
Loading…
Reference in New Issue
Block a user