Skip to main content

Barracuda REST API abstraction

Project description

Barracuda API

This is a more convenient wrapper around the Barracuda REST api than using plain REST API methods. Following methods are implemented:

  • add/get/delete lists
  • add/get/delete network objects
  • add/get/delete service objects
  • add/get/delete firewall rules

Tests

(py310_venv) peter\barracuda-api\coverage run -m pytest
=========================== test session starts ===========================
platform win32 -- Python 3.10.5, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: peter\barracuda-api
collected 19 items

tests\test_01_box_info.py ...
tests\test_02_ff_lists.py .....
tests\test_03_ff_networks.py .......
tests\test_04_ff_services.py ........
tests\test_05_ff_rules.py ............

=========================== 35 passed in 4.06s ===========================

(py310_venv) peter\barracuda-api\coverage report -m
Name                           Stmts   Miss  Cover   Missing
------------------------------------------------------------
barracuda_api\__init__.py          9      0   100%
barracuda_api\barracuda.py       199      2    99%   101, 112
barracuda_api\endpoints.py        15      0   100%
barracuda_api\exceptions.py       12      0   100%
tests\__init__.py                  1      0   100%
tests\test_01_box_info.py         22      0   100%
tests\test_02_ff_lists.py         38      0   100%
tests\test_03_ff_networks.py      64      0   100%
tests\test_04_ff_services.py      56      0   100%
tests\test_05_ff_rules.py         86      0   100%
------------------------------------------------------------
TOTAL                            502      2    99%

Build wheel (recommended over an egg)

(py310_venv) peter\barracuda-api\pip wheel .
Processing peter\barracuda-api
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: barracuda-api
  Building wheel for barracuda-api (setup.py) ... done
  Created wheel for barracuda-api: filename=barracuda_api-0.2-py3-none-any.whl size=13749 sha256=789fe40d9c08c1826e5c7a0d34168f68fa4cee5c16d59341bb4ff10b2998bb63
  Stored in directory: c:\users\peter210\appdata\local\pip\cache\wheels\72\a4\9b\2789e9879d99a602283d1ae10b9abf2cba8442fd7cfbc876a5
Successfully built barracuda-api
peter\barracuda-api\python setup.py bdist_wheel

running bdist_wheel
running build
running build_py
installing to build\bdist.win-amd64\wheel
running install
running install_lib
creating build\bdist.win-amd64\wheel
creating build\bdist.win-amd64\wheel\barracuda_api
copying build\lib\barracuda_api\barracuda.py -> build\bdist.win-amd64\wheel\.\barracuda_api
copying build\lib\barracuda_api\endpoints.py -> build\bdist.win-amd64\wheel\.\barracuda_api
copying build\lib\barracuda_api\exceptions.py -> build\bdist.win-amd64\wheel\.\barracuda_api
copying build\lib\barracuda_api\__init__.py -> build\bdist.win-amd64\wheel\.\barracuda_api
creating build\bdist.win-amd64\wheel\tests
copying build\lib\tests\test_01_box_info.py -> build\bdist.win-amd64\wheel\.\tests
copying build\lib\tests\test_02_ff_lists copy.py -> build\bdist.win-amd64\wheel\.\tests
copying build\lib\tests\test_02_ff_lists.py -> build\bdist.win-amd64\wheel\.\tests
copying build\lib\tests\test_03_ff_networks.py -> build\bdist.win-amd64\wheel\.\tests
copying build\lib\tests\test_04_ff_services.py -> build\bdist.win-amd64\wheel\.\tests
copying build\lib\tests\test_05_ff_rules.py -> build\bdist.win-amd64\wheel\.\tests
copying build\lib\tests\__init__.py -> build\bdist.win-amd64\wheel\.\tests
running install_egg_info
running egg_info
writing barracuda_api.egg-info\PKG-INFO
writing dependency_links to barracuda_api.egg-info\dependency_links.txt
writing top-level names to barracuda_api.egg-info\top_level.txt
reading manifest file 'barracuda_api.egg-info\SOURCES.txt'
writing manifest file 'barracuda_api.egg-info\SOURCES.txt'
Copying barracuda_api.egg-info to build\bdist.win-amd64\wheel\.\barracuda_api-0.1-py3.10.egg-info
running install_scripts
creating build\bdist.win-amd64\wheel\barracuda_api-0.1.dist-info\WHEEL
creating 'dist\barracuda_api-0.1-py3-none-any.whl' and adding 'build\bdist.win-amd64\wheel' to it
adding 'barracuda_api/__init__.py'
adding 'barracuda_api/barracuda.py'
adding 'barracuda_api/endpoints.py'
adding 'barracuda_api/exceptions.py'
adding 'tests/__init__.py'
adding 'tests/test_01_box_info.py'
adding 'tests/test_02_ff_lists copy.py'
adding 'tests/test_02_ff_lists.py'
adding 'tests/test_03_ff_networks.py'
adding 'tests/test_04_ff_services.py'
adding 'tests/test_05_ff_rules.py'
adding 'barracuda_api-0.1.dist-info/METADATA'
adding 'barracuda_api-0.1.dist-info/WHEEL'
adding 'barracuda_api-0.1.dist-info/top_level.txt'
adding 'barracuda_api-0.1.dist-info/RECORD'
removing build\bdist.win-amd64\wheel

Installation

(py310_venv) peter\barracuda-api\pip install .
Processing peter\barracuda-api
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: barracuda-api
  Building wheel for barracuda-api (setup.py) ... done
  Created wheel for barracuda-api: filename=barracuda_api-0.2-py3-none-any.whl size=13750 sha256=31750ac6cb23266159453a68d0e499b005a6208ea9db1bdaab1be35ab42ed13c
  Stored in directory: c:\users\peter210\appdata\local\pip\cache\wheels\72\a4\9b\2789e9879d99a602283d1ae10b9abf2cba8442fd7cfbc876a5
Successfully built barracuda-api
Installing collected packages: barracuda-api
  Attempting uninstall: barracuda-api
    Found existing installation: barracuda-api 0.1
    Uninstalling barracuda-api-0.1:
      Successfully uninstalled barracuda-api-0.1
Successfully installed barracuda-api-0.2

Basic usage

from barracuda_api.barracuda import BarracudaSession

cc_ip = "10.2.3.4"

with BarracudaSession(
    cc_ip, "apitoken", endpoint_port=8443, debug=False
) as bs:
    cc_info = bs.get_box_info()
    print(cc_info)

Project details


Release history Release notifications | RSS feed

This version

0.4

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

barracuda_api-0.4-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file barracuda_api-0.4-py3-none-any.whl.

File metadata

  • Download URL: barracuda_api-0.4-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for barracuda_api-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0aa01fa1f2178a8ed12fe395eec022f2f0661f448aaabe96623a689b12337782
MD5 a1500af71cc3fac05028c99fee5c6d30
BLAKE2b-256 0c0baf91ee8133cf3a54bccde1513fb95a7900496267dae787c24986f539031a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page