]> git.proxmox.com Git - pmg-api.git/commitdiff
add version API
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 25 Jan 2017 15:58:24 +0000 (16:58 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 25 Jan 2017 15:58:24 +0000 (16:58 +0100)
PMG/API2.pm

index 97d3be6332e82fb4d9f2eae331926930fe8523f5..2be5d1128861d2fe43738c6adaf51bb0ab71ed18 100644 (file)
@@ -8,16 +8,17 @@ use PVE::JSONSchema;
 
 use PMG::API2::AccessControl;
 use PMG::API2::Nodes;
+use PMG::pmgcfg;
 
 use base qw(PVE::RESTHandler);
 
 __PACKAGE__->register_method ({
-    subclass => "PMG::API2::Nodes",  
+    subclass => "PMG::API2::Nodes",
     path => 'nodes',
 });
 
 __PACKAGE__->register_method ({
-    subclass => "PMG::API2::AccessControl",  
+    subclass => "PMG::API2::AccessControl",
     path => 'access',
 });
 
@@ -44,10 +45,37 @@ __PACKAGE__->register_method ({
     code => sub {
        my ($resp, $param) = @_;
 
-       my $res = [ { subdir => 'nodes' } ];
+       my $res = [
+           { subdir => 'nodes' },
+           { subdir => 'version' },
+           ];
 
        return $res;
     }});
 
 
+__PACKAGE__->register_method ({
+    name => 'version',
+    path => 'version',
+    method => 'GET',
+    permissions => { user => 'all' },
+    description => "API version details.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {},
+    },
+    returns => {
+       type => "object",
+       properties => {
+           version => { type => 'string' },
+           release => { type => 'string' },
+           repoid => { type => 'string' },
+       },
+    },
+    code => sub {
+       my ($param) = @_;
+
+       return PMG::pmgcfg::version_info();
+    }});
+
 1;