]> git.proxmox.com Git - pve-client.git/blame - pveclient
add API definition
[pve-client.git] / pveclient
CommitLineData
29505e2c
DM
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use lib '.';
6use Data::Dumper;
7
8use PVE::APIClient::LWP;
9use PVE::APIClient::Helpers;
10use JSON;
11
12sub print_usage {
13
14 die "Usage: implement me";
15 exit(-1);
16}
17
18sub 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
48my $cmd = shift || print_usage();
49
50if ($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
70die "implement me";