]>
git.proxmox.com Git - pve-manager-legacy.git/blob - PVE/API2.pm
7 use PVE
::DataCenterConfig
;
11 use base
qw(PVE::RESTHandler);
14 use PVE
::API2
::Cluster
;
17 use PVE
::API2
::AccessControl
;
18 use PVE
::API2
::Storage
::Config
;
20 __PACKAGE__-
>register_method ({
21 subclass
=> "PVE::API2::Cluster",
25 __PACKAGE__-
>register_method ({
26 subclass
=> "PVE::API2::Nodes",
30 __PACKAGE__-
>register_method ({
31 subclass
=> "PVE::API2::Storage::Config",
35 __PACKAGE__-
>register_method ({
36 subclass
=> "PVE::API2::AccessControl",
40 __PACKAGE__-
>register_method ({
41 subclass
=> "PVE::API2::Pool",
45 __PACKAGE__-
>register_method ({
49 permissions
=> { user
=> 'all' },
50 description
=> "Directory index.",
52 additionalProperties
=> 0,
60 subdir
=> { type
=> 'string' },
63 links
=> [ { rel
=> 'child', href
=> "{subdir}" } ],
68 my $res = [ { subdir
=> 'version' } ];
70 my $ma = PVE
::API2-
>method_attributes();
72 foreach my $info (@$ma) {
73 next if !$info->{subclass
};
75 my $subpath = $info->{match_re
}->[0];
77 push @$res, { subdir
=> $subpath };
83 __PACKAGE__-
>register_method ({
87 permissions
=> { user
=> 'all' },
88 description
=> "API version details, including some parts of the global datacenter config.",
90 additionalProperties
=> 0,
98 description
=> 'The full pve-manager package version of this node.',
102 description
=> 'The current Proxmox VE point release in `x.y` format.',
106 description
=> 'The short git revision from which this version was build.',
110 enum
=> ['applet', 'vv', 'html5', 'xtermjs'],
112 description
=> 'The default console viewer to use.',
121 my $datacenter_confg = eval { PVE
::Cluster
::cfs_read_file
('datacenter.cfg') } // {};
122 for my $k (qw(console)) {
123 $res->{$k} = $datacenter_confg->{$k} if exists $datacenter_confg->{$k};
126 my $version_info = PVE
::pvecfg
::version_info
();
127 # force set all version keys independent of their definedness
128 $res->{$_} = $version_info->{$_} for qw(version release repoid);