]>
git.proxmox.com Git - pve-manager.git/blob - PVE/API2.pm
7 use PVE
::DataCenterConfig
;
12 use base
qw(PVE::RESTHandler);
15 use PVE
::API2
::Cluster
;
18 use PVE
::API2
::AccessControl
;
19 use PVE
::API2
::Storage
::Config
;
21 __PACKAGE__-
>register_method ({
22 subclass
=> "PVE::API2::Cluster",
26 __PACKAGE__-
>register_method ({
27 subclass
=> "PVE::API2::Nodes",
31 __PACKAGE__-
>register_method ({
32 subclass
=> "PVE::API2::Storage::Config",
36 __PACKAGE__-
>register_method ({
37 subclass
=> "PVE::API2::AccessControl",
41 __PACKAGE__-
>register_method ({
42 subclass
=> "PVE::API2::Pool",
46 __PACKAGE__-
>register_method ({
50 permissions
=> { user
=> 'all' },
51 description
=> "Directory index.",
53 additionalProperties
=> 0,
61 subdir
=> { type
=> 'string' },
64 links
=> [ { rel
=> 'child', href
=> "{subdir}" } ],
69 my $res = [ { subdir
=> 'version' } ];
71 my $ma = PVE
::API2-
>method_attributes();
73 foreach my $info (@$ma) {
74 next if !$info->{subclass
};
76 my $subpath = $info->{match_re
}->[0];
78 push @$res, { subdir
=> $subpath };
84 __PACKAGE__-
>register_method ({
88 permissions
=> { user
=> 'all' },
89 description
=> "API version details, including some parts of the global datacenter config.",
91 additionalProperties
=> 0,
99 description
=> 'The full pve-manager package version of this node.',
103 description
=> 'The current Proxmox VE point release in `x.y` format.',
107 # length 8 is old (< 8.0) short-id, 16 is new short id, 40 is sha1 and 64 is sha256
108 pattern
=> '[0-9a-fA-F]{8,64}',
109 description
=> 'The short git revision from which this version was build.',
113 enum
=> ['applet', 'vv', 'html5', 'xtermjs'],
115 description
=> 'The default console viewer to use.',
124 # TODO remove with next major release
125 my $datacenter_confg = eval { PVE
::Cluster
::cfs_read_file
('datacenter.cfg') } // {};
126 for my $k (qw(console)) {
127 $res->{$k} = $datacenter_confg->{$k} if exists $datacenter_confg->{$k};
130 my $version_info = PVE
::pvecfg
::version_info
();
131 # force set all version keys independent of their definedness
132 $res->{$_} = $version_info->{$_} for qw(version release repoid);