andreas-stuerz / opn-cli

CLI for OPNsense Firewall using API Requests
BSD 2-Clause "Simplified" License
45 stars 8 forks source link

add api-backup plugin support #43

Closed fraenki closed 1 year ago

fraenki commented 1 year ago

This PR adds support for the os-backup-api plugin.

Now it's easy to download a backup of the OPNsense system configuration to the current directory:

$ opn-cli apibackup backup download                              
successfully saved to: ./config.xml

Or specify an alternative path and filename:

$ opn-cli apibackup backup download -p /tmp/config_backup.xml
successfully saved to: /tmp/config_backup.xml

Note: This requires the upcoming release of os-backup-api 1.1, which will likely be released in OPNsense 23.1.2 soon.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 80.00% and project coverage change: -0.16 :warning:

Comparison is base (a28c4e4) 99.92% compared to head (7688348) 99.77%.

:exclamation: Current head 7688348 differs from pull request most recent head ee13a9a. Consider uploading reports for the commit ee13a9a to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #43 +/- ## ========================================== - Coverage 99.92% 99.77% -0.16% ========================================== Files 169 175 +6 Lines 6916 6971 +55 ========================================== + Hits 6911 6955 +44 - Misses 5 16 +11 ``` | [Impacted Files](https://codecov.io/gh/andeman/opn-cli/pull/43?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz) | Coverage Δ | | |---|---|---| | [...se\_cli/facades/commands/plugin/apibackup/backup.py](https://codecov.io/gh/andeman/opn-cli/pull/43?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz#diff-b3Buc2Vuc2VfY2xpL2ZhY2FkZXMvY29tbWFuZHMvcGx1Z2luL2FwaWJhY2t1cC9iYWNrdXAucHk=) | `55.55% <55.55%> (ø)` | | | [opnsense\_cli/api/plugin/apibackup.py](https://codecov.io/gh/andeman/opn-cli/pull/43?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz#diff-b3Buc2Vuc2VfY2xpL2FwaS9wbHVnaW4vYXBpYmFja3VwLnB5) | `75.00% <75.00%> (ø)` | | | [...ense\_cli/facades/commands/plugin/apibackup/base.py](https://codecov.io/gh/andeman/opn-cli/pull/43?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz#diff-b3Buc2Vuc2VfY2xpL2ZhY2FkZXMvY29tbWFuZHMvcGx1Z2luL2FwaWJhY2t1cC9iYXNlLnB5) | `75.00% <75.00%> (ø)` | | | [opnsense\_cli/commands/plugin/apibackup/backup.py](https://codecov.io/gh/andeman/opn-cli/pull/43?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz#diff-b3Buc2Vuc2VfY2xpL2NvbW1hbmRzL3BsdWdpbi9hcGliYWNrdXAvYmFja3VwLnB5) | `82.60% <82.60%> (ø)` | | | [opnsense\_cli/commands/plugin/apibackup/\_\_init\_\_.py](https://codecov.io/gh/andeman/opn-cli/pull/43?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz#diff-b3Buc2Vuc2VfY2xpL2NvbW1hbmRzL3BsdWdpbi9hcGliYWNrdXAvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | | | [...nsense\_cli/tests/commands/plugin/test\_apibackup.py](https://codecov.io/gh/andeman/opn-cli/pull/43?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz#diff-b3Buc2Vuc2VfY2xpL3Rlc3RzL2NvbW1hbmRzL3BsdWdpbi90ZXN0X2FwaWJhY2t1cC5weQ==) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

andreas-stuerz commented 1 year ago

Great new feature and nice work Fraenki 👍