pve-manager/PVE/API2/Hardware.pm
Thomas Lamprecht 1c182fc59f api: add usb list in hardware endpoint
As envisioned in[0][1], better late than never.

[0]: commit 523d5f486b
[1]: https://lists.proxmox.com/pipermail/pve-devel/2018-November/034694.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-02 11:27:02 +01:00

59 lines
1.0 KiB
Perl

package PVE::API2::Hardware;
use strict;
use warnings;
use PVE::JSONSchema qw(get_standard_option);
use PVE::RESTHandler;
use PVE::API2::Hardware::PCI;
use PVE::API2::Hardware::USB;
use base qw(PVE::RESTHandler);
__PACKAGE__->register_method ({
subclass => "PVE::API2::Hardware::PCI",
path => 'pci',
});
__PACKAGE__->register_method ({
subclass => "PVE::API2::Hardware::USB",
path => 'usb',
});
__PACKAGE__->register_method ({
name => 'index',
path => '',
method => 'GET',
description => "Index of hardware types",
permissions => {
user => 'all',
},
parameters => {
additionalProperties => 0,
properties => {
node => get_standard_option('pve-node'),
},
},
returns => {
type => 'array',
items => {
type => "object",
properties => { type => { type => 'string'} },
},
links => [ { rel => 'child', href => "{type}" } ],
},
code => sub {
my ($param) = @_;
my $res = [
{ type => 'pci' },
{ type => 'usb' },
];
return $res;
}
});