From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id F23DA60E31 for ; Mon, 19 Oct 2020 21:02:55 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 789D22F191 for ; Mon, 19 Oct 2020 21:02:25 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id E542D2F14B for ; Mon, 19 Oct 2020 21:02:23 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id B7B8C45E06 for ; Mon, 19 Oct 2020 21:02:23 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Mon, 19 Oct 2020 21:02:09 +0200 Message-Id: <20201019190209.11495-13-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201019190209.11495-1-s.ivanov@proxmox.com> References: <20201019190209.11495-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.045 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [RFC pmg-api 12/12] pbs-integration: add CLI calls to pmgbackup X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2020 19:02:56 -0000 This patch adds to new categories for commands to pmgbackup: * pmgbackup remote - for managing PBS instances' configuration, cluster-wide * pmgbackup pbsjob - for managing backups, restores and schedules to those remotes, per node Signed-off-by: Stoiko Ivanov --- src/PMG/CLI/pmgbackup.pm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/PMG/CLI/pmgbackup.pm b/src/PMG/CLI/pmgbackup.pm index 69224e5..06bf997 100644 --- a/src/PMG/CLI/pmgbackup.pm +++ b/src/PMG/CLI/pmgbackup.pm @@ -8,9 +8,12 @@ use PVE::Tools; use PVE::SafeSyslog; use PVE::INotify; use PVE::CLIHandler; +use PVE::CLIFormatter; use PMG::RESTEnvironment; use PMG::API2::Backup; +use PMG::API2::PBS::Remote; +use PMG::API2::PBS::Job; use base qw(PVE::CLIHandler); @@ -32,6 +35,30 @@ our $cmddef = { backup => [ 'PMG::API2::Backup', 'backup', undef, { node => $nodename } ], restore => [ 'PMG::API2::Backup', 'restore', undef, { node => $nodename } ], list => [ 'PMG::API2::Backup', 'list', undef, { node => $nodename }, $format_backup_list ], + remote => { + list => ['PMG::API2::PBS::Remote', 'list', undef, undef, sub { + my ($data, $schema, $options) = @_; + PVE::CLIFormatter::print_api_result($data, $schema, ['remote', 'server', 'datastore', 'username' ], $options); + }, $PVE::RESTHandler::standard_output_options ], + add => ['PMG::API2::PBS::Remote', 'create', ['remote'] ], + remove => ['PMG::API2::PBS::Remote', 'delete', ['remote'] ], + set => ['PMG::API2::PBS::Remote', 'update_config', ['remote'] ], + }, + pbsjob => { + list_backups => ['PMG::API2::PBS::Job', 'get_snapshots', ['remote'] , { node => $nodename }, sub { + my ($data, $schema, $options) = @_; + PVE::CLIFormatter::print_api_result($data, $schema, ['time', 'size'], $options); + }, $PVE::RESTHandler::standard_output_options ], + forget => ['PMG::API2::PBS::Job', 'forget_snapshot', ['remote', 'time'], { node => $nodename} ], + run => ['PMG::API2::PBS::Job', 'run_backup', ['remote'], { node => $nodename} ], + restore => ['PMG::API2::PBS::Job', 'restore', ['remote'], { node => $nodename} ], + create => ['PMG::API2::PBS::Job', 'create_timer', ['remote'], { node => $nodename }], + delete => ['PMG::API2::PBS::Job', 'delete_timer', ['remote'], { node => $nodename }], + schedule => ['PMG::API2::PBS::Job', 'list_timer', ['remote'], { node => $nodename }, sub { + my ($data, $schema, $options) = @_; + PVE::CLIFormatter::print_api_result($data, $schema, ['remote', 'schedule', 'delay'], $options); + }, $PVE::RESTHandler::standard_output_options ], + }, }; 1; -- 2.20.1