api3/admin/datastore.rs: rename parameter "name" to "store"

This commit is contained in:
Dietmar Maurer 2019-01-18 08:33:11 +01:00
parent 244d9b17a8
commit 5a778d92b3
2 changed files with 12 additions and 12 deletions

View File

@ -17,11 +17,11 @@ mod upload_catar;
// this is just a test for mutability/mutex handling - will remove later // this is just a test for mutability/mutex handling - will remove later
fn start_garbage_collection(param: Value, _info: &ApiMethod) -> Result<Value, Error> { fn start_garbage_collection(param: Value, _info: &ApiMethod) -> Result<Value, Error> {
let name = param["name"].as_str().unwrap(); let store = param["store"].as_str().unwrap();
let datastore = DataStore::lookup_datastore(name)?; let datastore = DataStore::lookup_datastore(store)?;
println!("Starting garbage collection on store {}", name); println!("Starting garbage collection on store {}", store);
datastore.garbage_collection()?; datastore.garbage_collection()?;
@ -32,15 +32,15 @@ pub fn api_method_start_garbage_collection() -> ApiMethod {
ApiMethod::new( ApiMethod::new(
start_garbage_collection, start_garbage_collection,
ObjectSchema::new("Start garbage collection.") ObjectSchema::new("Start garbage collection.")
.required("name", StringSchema::new("Datastore name.")) .required("store", StringSchema::new("Datastore name."))
) )
} }
fn garbage_collection_status(param: Value, _info: &ApiMethod) -> Result<Value, Error> { fn garbage_collection_status(param: Value, _info: &ApiMethod) -> Result<Value, Error> {
let name = param["name"].as_str().unwrap(); let store = param["store"].as_str().unwrap();
println!("Garbage collection status on store {}", name); println!("Garbage collection status on store {}", store);
Ok(json!(null)) Ok(json!(null))
@ -50,7 +50,7 @@ pub fn api_method_garbage_collection_status() -> ApiMethod {
ApiMethod::new( ApiMethod::new(
garbage_collection_status, garbage_collection_status,
ObjectSchema::new("Garbage collection status.") ObjectSchema::new("Garbage collection status.")
.required("name", StringSchema::new("Datastore name.")) .required("store", StringSchema::new("Datastore name."))
) )
} }
@ -59,7 +59,7 @@ fn get_datastore_list(_param: Value, _info: &ApiMethod) -> Result<Value, Error>
let config = datastore::config()?; let config = datastore::config()?;
Ok(config.convert_to_array("name")) Ok(config.convert_to_array("store"))
} }
@ -72,7 +72,7 @@ pub fn router() -> Router {
{"subdir": "gc" } {"subdir": "gc" }
])), ])),
ObjectSchema::new("Directory index.") ObjectSchema::new("Directory index.")
.required("name", StringSchema::new("Datastore name."))) .required("store", StringSchema::new("Datastore name.")))
) )
.subdir( .subdir(
"upload_catar", "upload_catar",
@ -90,7 +90,7 @@ pub fn router() -> Router {
.get(ApiMethod::new( .get(ApiMethod::new(
get_datastore_list, get_datastore_list,
ObjectSchema::new("Directory index."))) ObjectSchema::new("Directory index.")))
.match_all("name", datastore_info); .match_all("store", datastore_info);

View File

@ -45,7 +45,7 @@ impl Future for UploadCaTar {
fn upload_catar(parts: Parts, req_body: Body, param: Value, _info: &ApiUploadMethod) -> Result<BoxFut, Error> { fn upload_catar(parts: Parts, req_body: Body, param: Value, _info: &ApiUploadMethod) -> Result<BoxFut, Error> {
let store = tools::required_string_param(&param, "name")?; let store = tools::required_string_param(&param, "store")?;
let archive_name = tools::required_string_param(&param, "archive_name")?; let archive_name = tools::required_string_param(&param, "archive_name")?;
println!("Upload {}.catar to {} ({}.aidx)", archive_name, store, archive_name); println!("Upload {}.catar to {} ({}.aidx)", archive_name, store, archive_name);
@ -85,7 +85,7 @@ pub fn api_method_upload_catar() -> ApiUploadMethod {
ApiUploadMethod::new( ApiUploadMethod::new(
upload_catar, upload_catar,
ObjectSchema::new("Upload .catar backup file.") ObjectSchema::new("Upload .catar backup file.")
.required("name", StringSchema::new("Datastore name.")) .required("store", StringSchema::new("Datastore name."))
.required("archive_name", StringSchema::new("Backup archive name.")) .required("archive_name", StringSchema::new("Backup archive name."))
) )
} }