[pbs-devel] [PATCH proxmox-backup v2 6/8] api2/tape/restore: add 'restore-single' api path

Dominik Csapak d.csapak at proxmox.com
Wed May 5 14:48:47 CEST 2021


On 5/5/21 12:53, Thomas Lamprecht wrote:
> On 05.05.21 12:09, Dominik Csapak wrote:
>> @@ -182,6 +190,608 @@ fn check_datastore_privs(
>>   }
>>   
>>   pub const ROUTER: Router = Router::new().post(&API_METHOD_RESTORE);
>> +pub const ROUTER_SINGLE: Router = Router::new().post(&API_METHOD_RESTORE_SINGLE);
>> +
>> +#[api(
>> +   input: {
>> +        properties: {
>> +            store: {
>> +                schema: DATASTORE_MAP_LIST_SCHEMA,
>> +            },
>> +            drive: {
>> +                schema: DRIVE_NAME_SCHEMA,
>> +            },
>> +            "media-set": {
>> +                description: "Media set UUID.",
>> +                type: String,
>> +            },
>> +            "snapshots": {
>> +                description: "List of snapshots.",
>> +                type: Array,
>> +                items: {
>> +                    type: String,
>> +                    description: "A single snapshot in format: 'store:type/group/id'."
>> +                },
>> +            },
> 
> restore-*single* which may restore a list of snapshots, rather weird...
> 
> Why is snapshots not just an optional parameter of the default restore path?
> 
> We have already all other parameters there, would make it less confusing from
> an outside POV and allow reusing some code if done right..
> 

thanks. yes that make sense, i'll integrate it.
(i overestimated the non-overlapping parts of the api calls,
turns out they share much if i do a little refactoring...)


>> +            "notify-user": {
>> +                type: Userid,
>> +                optional: true,
>> +            },
>> +            owner: {
>> +                type: Authid,
>> +                optional: true,
>> +            },
>> +        },
>> +    },
>> +    returns: {
>> +        schema: UPID_SCHEMA,
>> +    },
>> +    access: {
>> +        // Note: parameters are no uri parameter, so we need to test inside function body
>> +        description: "The user needs Tape.Read privilege on /tape/pool/{pool} \
>> +                      and /tape/drive/{drive}, Datastore.Backup privilege on /datastore/{store}.",
>> +        permission: &Permission::Anybody,
>> +    },
>> +)]






More information about the pbs-devel mailing list