]> git.proxmox.com Git - pve-client.git/blob - pveclient
add debian package files
[pve-client.git] / pveclient
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use lib '.';
6 use Data::Dumper;
7
8 use PVE::APIClient::LWP;
9 use PVE::APIClient::Helpers;
10 use JSON;
11
12 sub print_usage {
13
14 die "Usage: implement me";
15 exit(-1);
16 }
17
18 sub call_method {
19 my ($path, $method, $args) = @_;
20
21 die "missing API path\n" if !defined($path);
22
23 my $info = PVE::APIClient::Helpers::lookup_api_method($path, $method);
24 my $param = PVE::APIClient::Helpers::get_options($info->{parameters}, $args);
25 print Dumper($param);
26
27 die "implement me";
28 }
29
30 # NOTE: This binary is just a placeholer - nothing implemented so far!
31
32 #my $hostname = 'localhost';
33 #my $username = 'root@pam';
34 #
35 #my $conn = PVE::APIClient::LWP->new(
36 # username => $username,
37 # #password => 'yourpassword',
38 # #ticket => $ticket,
39 # #csrftoken => $csrftoken,
40 # host => $hostname,
41 # # allow manual fingerprint verification
42 # manual_verification => 1,
43 # );
44
45 #my $res = $conn->get("/", {});
46 #print to_json($res, { pretty => 1, canonical => 1});
47
48 my $cmd = shift || print_usage();
49
50 if ($cmd eq 'get') {
51 my $method = 'GET';
52 my $path;
53 if (scalar(@ARGV) && $ARGV[0] !~ m/^\-/) {
54 $path = shift @ARGV;
55 }
56 my $res = call_method($path, $method, \@ARGV);
57 die "implement me";
58 } elsif ($cmd eq 'set') {
59 die "implement me";
60 } elsif ($cmd eq 'create') {
61 die "implement me";
62 } elsif ($cmd eq 'delete') {
63 die "implement me";
64 } elsif ($cmd eq 'enter') {
65 die "implement me";
66 } else {
67 print_usage();
68 }
69
70 die "implement me";