add stub for lxc commands
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 23 May 2018 10:19:34 +0000 (12:19 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 23 May 2018 10:19:34 +0000 (12:19 +0200)
Makefile
PVE/APIClient/Commands/lxc.pm [new file with mode: 0644]
pveclient

index 0766973..6eccaec 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,7 @@ install:  pve-api-definition.js
        # install pveclient
        install -D -m 0644 PVE/APIClient/Helpers.pm ${LIB_DIR}/PVE/APIClient/Helpers.pm
        install -D -m 0644 PVE/APIClient/Commands/remote.pm ${LIB_DIR}/PVE/APIClient/Commands/remote.pm
+       install -D -m 0644 PVE/APIClient/Commands/lxc.pm ${LIB_DIR}/PVE/APIClient/Commands/lxc.pm
        install -D -m 0644 pve-api-definition.js ${LIB_DIR}/pve-api-definition.js
        install -D -m 0755 pveclient ${DESTDIR}/usr/bin/pveclient
 
diff --git a/PVE/APIClient/Commands/lxc.pm b/PVE/APIClient/Commands/lxc.pm
new file mode 100644 (file)
index 0000000..469bcf1
--- /dev/null
@@ -0,0 +1,60 @@
+package PVE::APIClient::Commands::lxc;
+
+use strict;
+use warnings;
+
+use PVE::CLIHandler;
+
+use base qw(PVE::CLIHandler);
+
+__PACKAGE__->register_method ({
+    name => 'enter',
+    path => 'enter',
+    method => 'POST',
+    description => "Enter container console.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           vmid => {
+               description => "The container ID",
+               type => 'string',
+           },
+       },
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my ($param) = @_;
+
+       die "implement me";
+
+    }});
+
+__PACKAGE__->register_method ({
+    name => 'list',
+    path => 'list',
+    method => 'GET',
+    description => "List containers.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           remote => {
+               description => "The remote name.",
+               type => 'string',
+           },
+       },
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my ($param) = @_;
+
+       die "implement me";
+
+    }});
+
+
+our $cmddef = {
+    enter => [ __PACKAGE__, 'enter', ['vmid']],
+    list => [ __PACKAGE__, 'list', ['remote']],
+};
+
+1;
index 165505f..d24ec49 100755 (executable)
--- a/pveclient
+++ b/pveclient
@@ -12,6 +12,7 @@ use PVE::CLIHandler;
 use PVE::APIClient::LWP;
 use PVE::APIClient::Helpers;
 use PVE::APIClient::Commands::remote;
+use PVE::APIClient::Commands::lxc;
 
 use JSON;
 
@@ -21,6 +22,8 @@ sub print_usage {
 
     $text .= "pveclient remote <help|add|remove> {options}\n\n";
 
+    $text .= "pveclient lxc <help|create|destroy|...> {options}\n\n";
+
     $text .= "pveclient <get/set/create/delete> <path> {options}\n\n";
 
     print STDERR $text;
@@ -73,6 +76,8 @@ if ($cmd eq 'get') {
     die "implement me";
 } elsif ($cmd eq 'delete') {
     die "implement me";
+} elsif ($cmd eq 'lxc') {
+    PVE::APIClient::Commands::lxc->run_cli_handler();
 } elsif ($cmd eq 'remote') {
     PVE::APIClient::Commands::remote->run_cli_handler();
 } else {