pve-manager/PVE/API2/Cluster/Mapping.pm
Markus Frank 3eaa1cd6a9 api: add resource map api endpoints for directories
Signed-off-by: Markus Frank <m.frank@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Laurențiu Leahu-Vlăducu <l.leahu-vladucu@proxmox.com
Reviewed-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Laurențiu Leahu-Vlăducu <l.leahu-vladucu@proxmox.com>
Tested-by: Daniel Kral <d.kral@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>
Link: https://lore.proxmox.com/20250407134950.265270-7-m.frank@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-08 00:46:40 +02:00

59 lines
1.1 KiB
Perl

package PVE::API2::Cluster::Mapping;
use strict;
use warnings;
use PVE::API2::Cluster::Mapping::Dir;
use PVE::API2::Cluster::Mapping::PCI;
use PVE::API2::Cluster::Mapping::USB;
use base qw(PVE::RESTHandler);
__PACKAGE__->register_method ({
subclass => "PVE::API2::Cluster::Mapping::Dir",
path => 'dir',
});
__PACKAGE__->register_method ({
subclass => "PVE::API2::Cluster::Mapping::PCI",
path => 'pci',
});
__PACKAGE__->register_method ({
subclass => "PVE::API2::Cluster::Mapping::USB",
path => 'usb',
});
__PACKAGE__->register_method ({
name => 'index',
path => '',
method => 'GET',
description => "List resource types.",
permissions => {
user => 'all',
},
parameters => {
additionalProperties => 0,
properties => {},
},
returns => {
type => 'array',
items => {
type => "object",
},
links => [ { rel => 'child', href => "{name}" } ],
},
code => sub {
my ($param) = @_;
my $result = [
{ name => 'dir' },
{ name => 'pci' },
{ name => 'usb' },
];
return $result;
}});
1;