mirror of
				https://git.proxmox.com/git/pve-manager
				synced 2025-11-04 14:19:12 +00:00 
			
		
		
		
	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>
		
	
			
		
			
				
	
	
		
			59 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Perl
		
	
	
	
	
	
			
		
		
	
	
			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;
 | 
						|
    }
 | 
						|
});
 | 
						|
 |