5 use lib
'/usr/share/pve-client';
12 use PVE
::APIClient
::LWP
;
13 use PVE
::APIClient
::Helpers
;
14 use PVE
::APIClient
::Commands
::remote
;
15 use PVE
::APIClient
::Commands
::lxc
;
21 my $text = "pveclient usage:\n\n";
23 $text .= "pveclient remote <help|add|remove> {options}\n\n";
25 $text .= "pveclient lxc <help|create|destroy|...> {options}\n\n";
27 $text .= "pveclient <get/set/create/delete> <path> {options}\n\n";
34 my ($path, $method, $args) = @_;
36 die "missing API path\n" if !defined($path);
38 my $info = PVE
::APIClient
::Helpers
::lookup_api_method
($path, $method);
39 my $param = PVE
::JSONSchema
::get_options
($info->{parameters
}, $args);
45 # NOTE: This binary is just a placeholer - nothing implemented so far!
47 #my $hostname = 'localhost';
48 #my $username = 'root@pam';
50 #my $conn = PVE::APIClient::LWP->new(
51 # username => $username,
52 # #password => 'yourpassword',
54 # #csrftoken => $csrftoken,
56 # # allow manual fingerprint verification
57 # manual_verification => 1,
60 #my $res = $conn->get("/", {});
61 #print to_json($res, { pretty => 1, canonical => 1});
63 my $cmd = shift || (print_usage
() && exit(-1));
68 if (scalar(@ARGV) && $ARGV[0] !~ m/^\-/) {
71 my $res = call_method
($path, $method, \
@ARGV);
73 } elsif ($cmd eq 'set') {
75 } elsif ($cmd eq 'create') {
77 } elsif ($cmd eq 'delete') {
79 } elsif ($cmd eq 'lxc') {
80 PVE
::APIClient
::Commands
::lxc-
>run_cli_handler();
81 } elsif ($cmd eq 'remote') {
82 PVE
::APIClient
::Commands
::remote-
>run_cli_handler();