Skip to main content

IDG - IoT Deployment Generator

PyPI version

Library used to create Azure IoT Edge deployment templates with python code.

Table of contents

Table of contents generated with markdown-toc

Library dependencies

None

Installation

In order to install the library you need to execute following command:

pip install IoT-Deployment-Generator

Required imports

It is the best to use following imports when working with IDG:

from IDG.deployment import Deployment
from IDG.module import Module

Module development

Running tests

First please install tox package

pip install tox

Then use following command to test module:

python -m tox

Module documentation

Creating module

In order to create module you need to specify its name, version and image.

module = Module("module_name", "1.0.0", "image_str")
  • image_str represents image which is used inside deployment template.
    • As it is template you can refer to modules inside solution to load them. exxample: ${MODULEDIR<../some_module>}

Changing miscellaneous settings of module

Below you will find all settings you can change inside module:

module.type = "docker"
module.status = "running"
module.restartPolicy = "always"

Setting HostConfig for module

module.createOptions["HostConfig"] = {
        "Binds": [
        "volumeA:/somewhere"
    ],
    "PortBindings": {
        "8080/tcp": [{
            "HostPort": "9080"
        }]
    }
}

another syntax:

module.HostConfig = {
        "Binds": [
        "volumeA:/somewhere"
    ],
    "PortBindings": {
        "8080/tcp": [{
            "HostPort": "9080"
        }]
    }
}

Setting NetorkingConfig for module

module.createOptions["NetworkingConfig"] = {
        "EndpointsConfig": {
        "host": {}
    }
}

another syntax:

module.NetworkingConfig = {
        "EndpointsConfig": {
        "host": {}
    }
}

Setting desired properties for module

module.desiredProperties = {
    "propertyA" : 123,
    "propertyB" : "IamB"
}

Adding environment variable to module

module.addEnvVariable("env_name", "env_value")

Removing environment variable from module

module.removeEnvVariable("env_name")

Cloning module

clonedModule = module.clone()

Cloned module is going to be a deep copy of initial module.

Deployment documentation

Creating deployment

Contains default deployment settings with edgeAgent and edgeHub initial settings.

deployment = Deployment()

Changing miscellaneous settings of deployment

Below you will find all settings you can change inside deployment:

deployment.minDockerVersion = "v1.25"
deployment.edgeAgentVersion = "1.0"
deployment.edgeHubVersion = "1.0"
deployment.loggingOptions = ""

Adding module to deployment

deployment.addModule(module)

Removing module from deployment

deployment.removeModule("module_name")

it is going to remove module which has module_name inside module.name

Adding registry credential to deployment

deployment.addRegistryCredentials("credential_name", "repo_address", "repo_username", "repo_pass")

Adding route to deployment

deployment.routeSettings.addRoute("routeName", "ROM /messages/modules/someModule/outputs/* into $upstream")

Changing storeAndForwardConfiguration inside edgeHub configuration

deployment.routeSettings.timeToLiveSecs = 7200

Merging deployment

If you have 2 separate deployments you can merge them.


deploymentA = Deployment()
deploymentB = Deployment()

merged = deploymentA.merge(deploymentB)

In this case following things are going to happen:

  • merged is going to have all modules from deploymentA and every module from deploymentB which name does not exist in deploymentA
  • merged is going to have all routes from deploymentA and every route from deploymentB which name does not exist in deploymentA
  • merged is going to have all registry credentials from deploymentA and every credential from deploymentB which name does not exist in deploymentA
  • Other value settings are going to be taken solely from deploymentA.
  • deploymentA and deploymentB are unaffected by this operation.

Converting deployment into string

stringifiedJson = deployment.toJson()

Saving deployment to deployment template file

deployment.saveToFile("deployment.debug.template.json")

Metadata

Release files for IoT-Deployment-Generator 0.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for IoT-Deployment-Generator 0.0.14
File Size Uploaded Provenance Actions
IoT Deployment Generator-0.0.14.tar.gz 6.8 kB Without provenance Details for IoT Deployment Generator-0.0.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for IoT-Deployment-Generator 0.0.14
File Interpreter ABI Platform Actions
IoT_Deployment_Generator-0.0.14-py3-none-any.whl Python 3 none any Details for IoT_Deployment_Generator-0.0.14-py3-none-any.whl

Total release size: 15.1 kB

Release files / IoT Deployment Generator-0.0.14.tar.gz

Download URL IoT Deployment Generator-0.0.14.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
82c2688d04c10a4147e7952e2a64403f38bb7f47e2ef9c7b5306b1e6b9494c89
BLAKE2b-256 checksum
How to use checksums
b9a1bdfadc543be94ad787c3809b20d9ca6389c319c60f1b5d50269e5ebc8d55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

Release files / IoT_Deployment_Generator-0.0.14-py3-none-any.whl

Download URL IoT_Deployment_Generator-0.0.14-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06e19f9a15b9c142e7ae3223a63531f2c799d3205a9b2ca2deb532c43bfc7527
BLAKE2b-256 checksum
How to use checksums
883210f9ad65d95eff10fa7b96a77c3dae0a0014de987a8ce1645f1f29946640
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

Security for IoT-Deployment-Generator 0.0.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page