]>
Commit | Line | Data |
---|---|---|
adf285bf DM |
1 | package PVE::APIClient::Commands::lxc; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
aa570b38 | 5 | use JSON; |
adf285bf | 6 | |
84ba32e5 | 7 | use PVE::Tools; |
3454a319 | 8 | use PVE::JSONSchema qw(get_standard_option); |
adf285bf DM |
9 | use PVE::CLIHandler; |
10 | ||
11 | use base qw(PVE::CLIHandler); | |
3454a319 | 12 | use PVE::APIClient::Config; |
84ba32e5 | 13 | |
adf285bf DM |
14 | __PACKAGE__->register_method ({ |
15 | name => 'enter', | |
16 | path => 'enter', | |
17 | method => 'POST', | |
18 | description => "Enter container console.", | |
19 | parameters => { | |
20 | additionalProperties => 0, | |
21 | properties => { | |
3454a319 | 22 | remote => get_standard_option('pveclient-remote-name'), |
adf285bf DM |
23 | vmid => { |
24 | description => "The container ID", | |
25 | type => 'string', | |
26 | }, | |
27 | }, | |
28 | }, | |
29 | returns => { type => 'null'}, | |
30 | code => sub { | |
31 | my ($param) = @_; | |
32 | ||
aa570b38 | 33 | my $conn = PVE::APIClient::Config::get_remote_connection($param->{remote}); |
84ba32e5 DM |
34 | my $node = 'localhost'; # ?? |
35 | ||
36 | my $api_path = "api2/json/nodes/$node/lxc/$param->{vmid}"; | |
37 | ||
38 | my $res = $conn->get($api_path, {}); | |
39 | ||
40 | print to_json($res, { pretty => 1, canonical => 1}); | |
adf285bf DM |
41 | die "implement me"; |
42 | ||
43 | }}); | |
44 | ||
45 | __PACKAGE__->register_method ({ | |
46 | name => 'list', | |
47 | path => 'list', | |
48 | method => 'GET', | |
49 | description => "List containers.", | |
50 | parameters => { | |
51 | additionalProperties => 0, | |
52 | properties => { | |
3454a319 | 53 | remote => get_standard_option('pveclient-remote-name'), |
adf285bf DM |
54 | }, |
55 | }, | |
56 | returns => { type => 'null'}, | |
57 | code => sub { | |
58 | my ($param) = @_; | |
59 | ||
60 | die "implement me"; | |
61 | ||
62 | }}); | |
63 | ||
64 | ||
65 | our $cmddef = { | |
84ba32e5 | 66 | enter => [ __PACKAGE__, 'enter', ['remote', 'vmid']], |
adf285bf DM |
67 | list => [ __PACKAGE__, 'list', ['remote']], |
68 | }; | |
69 | ||
70 | 1; |