]>
git.proxmox.com Git - pve-manager.git/blob - PVE/CLI/pvesubscription.pm
1 package PVE
::CLI
::pvesubscription
;
7 use JSON
qw(decode_json);
12 use PVE
::RPCEnvironment
;
14 use PVE
::API2
::Subscription
;
16 use base
qw(PVE::CLIHandler);
18 my $nodename = PVE
::INotify
::nodename
();
20 sub setup_environment
{
21 PVE
::RPCEnvironment-
>setup_default_cli_env();
24 __PACKAGE__-
>register_method({
25 name
=> 'set_offline_key',
26 path
=> 'set_offline_key',
28 description
=> "(Internal use only!) Set a signed subscription info blob as offline key",
30 additionalProperties
=> 0,
37 returns
=> { type
=> 'null' },
41 my $info = decode_json
(decode_base64
($param->{data
}));
43 $info = Proxmox
::RS
::Subscription
::check_signature
($info);
44 $info = Proxmox
::RS
::Subscription
::check_server_id
($info);
45 $info = Proxmox
::RS
::Subscription
::check_age
($info, 0);
47 PVE
::API2
::Subscription
::check_key
($info->{key
}, PVE
::API2
::Subscription
::get_sockets
());
49 PVE
::API2
::Subscription
::write_etc_subscription
($info);
53 update
=> [ 'PVE::API2::Subscription', 'update', undef, { node
=> $nodename } ],
54 get
=> [ 'PVE::API2::Subscription', 'get', undef, { node
=> $nodename }, sub {
56 print "$_: $info->{$_}\n" for sort keys %$info;
58 set
=> [ 'PVE::API2::Subscription', 'set', ['key'], { node
=> $nodename } ],
59 "set-offline-key" => [ __PACKAGE__
, 'set_offline_key', ['data'] ],
60 delete => [ 'PVE::API2::Subscription', 'delete', undef, { node
=> $nodename } ],