Skip to main content

NebulaPythonSDK is a Pythonic SDK to manage Nebula container orchestrator

Project description


Travis CI unit tests & auto PyPi push status: Build Status

Code coverage: codecov

An SDK for managing nebula via python.

translates all of Nebula API calls to something more pythonic.

Source code is available at github

How To Use

first get NebulaPythonSDK onto your machine

# Install from PyPi
pip install NebulaPythonSDK

now use it in your code

# Load API wrapper from library
from NebulaPythonSDK import Nebula

# Create API object.
# port defaults to 80, protocol defaults to "http" & request_timeout defaults to 60 if any of them is not set.
connection = Nebula(username="your_nebula_user", password="your_nebula_pass", host="", port=80, protocol="http", request_timeout=60)

# List apps
app_list = connection.list_apps()

# List app info
app_config = connection.list_app_info("app_name")

# Create app
app_conf = {
    "containers_per_cpu": 8,
    "env_vars": {
        "test": "blabla",
        "test3t2t32": "tesg4ehgee"
    "docker_ulimits": [],
    "networks": ["nebula"],
    "running": True,
    "rolling_restart": False,
    "volumes": ["/tmp:/tmp/1", "/var/tmp/:/var/tmp/1:ro"],
    "containers_per": {
        "cpu": 6
    "starting_ports": [
            "81": 80
    "docker_image": "httpd",
    "privileged": False,
    "devices": []
connection.create_app("app_name", app_conf)

# create device group
device_group_config = {"apps": ["app_name"]}
connection.create_device_group("device_group_name", device_group_config)

# list device group

# list device group info

# ping api

# delete app

# stop app

# start app

# restart app

# update app
connection.update_app("app_name", app_conf)

# update app force all params - will reset all params to default values if not declared and raise an error for params 
# that are required but not given, similar to the POST update of the API
connection.update_app("app_name", app_conf, force_all=True)

# prune images on all device groups

# delete device_group

# prune images on a selected device groups

# update device group
connection.update_device_group("device_group_name", device_group_config)

# list paginated reports

# create a user
user_config = {"password": "user_password", "token": "user_token"}
connection.create_user("user_name", user_config)

# list user info

# list all users

# update a user
user_config = {"password": "new_password", "token": "new_token"}
connection.update_user("user_name", user_config)

# refresh a user token

# delete a user

# create a user group
user_group_config = {
                        "group_members": [
                        "pruning_allowed": True, 
                        "apps": {
                            "app_name": "rw"
                        "device_groups": {
                            "device_group_name": "ro"
                        "admin": False
connection.create_user_group("user_group_name", user_group_config)

# list user group info

# list all users group

# update a user group
user_group_config = {"admin": False}
connection.update_user_group("user_group_name", user_group_config)

# delete a user group

# list all cron jobs

# delete a cron job

# list a cron job

# create a cron job
cron_job_config = {
  "env_vars": {"test": "test123"},
  "docker_image" : "nginx",
  "running": True,
  "volumes": [],
  "networks": ["nebula", "bridge"],
  "devices": [],
  "privileged": False,
  "schedule": "0 * * * *"
connection.create_cron_job("cron_job_name", cron_job_config)

# update a cron job
cron_job_config = {
  "schedule": "5 * * * *"
connection.update_cron_job("cron_job_name", cron_job_config)

# update a cron job force all params - will reset all params to default values if not declared and raise an error for 
# params that are required but not given, similar to the POST update of the API
cron_job_config = {
  "schedule": "5 * * * *",
  "docker_image" : "nginx"
connection.update_cron_job("cron_job_name", cron_job_config, force_all=True)

Project details

Download files

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

Source Distribution

NebulaPythonSDK-2.8.0.tar.gz (8.0 kB view hashes)

Uploaded source

Built Distribution

NebulaPythonSDK-2.8.0-py3-none-any.whl (12.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page