tape: implement barcode-label-mdedia
This commit is contained in:
@ -326,9 +326,49 @@ fn inventory(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[api(
|
||||
input: {
|
||||
properties: {
|
||||
pool: {
|
||||
schema: MEDIA_POOL_NAME_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
drive: {
|
||||
schema: DRIVE_ID_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
)]
|
||||
/// Label media with barcodes from changer device
|
||||
fn barcode_label_media(
|
||||
mut param: Value,
|
||||
rpcenv: &mut dyn RpcEnvironment,
|
||||
) -> Result<(), Error> {
|
||||
|
||||
let (config, _digest) = config::drive::config()?;
|
||||
|
||||
param["drive"] = lookup_drive_name(¶m, &config)?.into();
|
||||
|
||||
let info = &api2::tape::drive::API_METHOD_BARCODE_LABEL_MEDIA;
|
||||
|
||||
match info.handler {
|
||||
ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
let cmd_def = CliCommandMap::new()
|
||||
.insert(
|
||||
"barcode-label",
|
||||
CliCommand::new(&API_METHOD_BARCODE_LABEL_MEDIA)
|
||||
.completion_cb("drive", complete_drive_name)
|
||||
.completion_cb("pool", complete_pool_name)
|
||||
)
|
||||
.insert(
|
||||
"rewind",
|
||||
CliCommand::new(&API_METHOD_REWIND)
|
||||
|
Reference in New Issue
Block a user