iotedgedev 3.3.4__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- s/.devcontainer/Dockerfile +75 -0
- s/.devcontainer/devcontainer.json +40 -0
- s/.devcontainer/library-scripts/docker-in-docker-debian.sh +236 -0
- s/.env.tmp +108 -0
- s/.git/FETCH_HEAD +61 -0
- s/.git/HEAD +1 -0
- s/.git/config +12 -0
- s/.git/description +1 -0
- s/.git/hooks/applypatch-msg.sample +15 -0
- s/.git/hooks/commit-msg.sample +24 -0
- s/.git/hooks/fsmonitor-watchman.sample +173 -0
- s/.git/hooks/post-update.sample +8 -0
- s/.git/hooks/pre-applypatch.sample +14 -0
- s/.git/hooks/pre-commit.sample +49 -0
- s/.git/hooks/pre-merge-commit.sample +13 -0
- s/.git/hooks/pre-push.sample +53 -0
- s/.git/hooks/pre-rebase.sample +169 -0
- s/.git/hooks/pre-receive.sample +24 -0
- s/.git/hooks/prepare-commit-msg.sample +42 -0
- s/.git/hooks/push-to-checkout.sample +78 -0
- s/.git/hooks/update.sample +128 -0
- s/.git/index +0 -0
- s/.git/info/exclude +6 -0
- s/.git/logs/HEAD +1 -0
- s/.git/logs/refs/remotes/origin/EO +1 -0
- s/.git/logs/refs/remotes/origin/avagraw/security_fix +1 -0
- s/.git/logs/refs/remotes/origin/cherry-pick-rename +1 -0
- s/.git/logs/refs/remotes/origin/chyuan/fix-validation-not-fail-test +1 -0
- s/.git/logs/refs/remotes/origin/chyuan/update-linux-agent +1 -0
- s/.git/logs/refs/remotes/origin/dependabot/pip/pyyaml-5.4 +1 -0
- s/.git/logs/refs/remotes/origin/eliises/add-device-tagging-docs +1 -0
- s/.git/logs/refs/remotes/origin/main +1 -0
- s/.git/logs/refs/remotes/origin/ray-deps +1 -0
- s/.git/logs/refs/remotes/origin/ray-dev-setup +1 -0
- s/.git/logs/refs/remotes/origin/ray-tox +1 -0
- s/.git/logs/refs/remotes/origin/release-pipeline-automation +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/fix-pipeline-test-install +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/layered-deployments +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/pypi-package-test-pipeline +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/remove-py2 +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/remove-py2-dev +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/test-native-runtime-install +1 -0
- s/.git/logs/refs/remotes/origin/spmcdono/update-pipeline +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/EliiseS/devcontainer +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/fixsimver +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/layereddeploymentsbuildtest +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/master-to-main +1 -0
- s/.git/logs/refs/remotes/origin/user/marine/pipeline +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas0212/verify-tests +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas2 +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas_pypi +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas_pypi-1 +1 -0
- s/.git/logs/refs/remotes/origin/user/vikas_testing +1 -0
- s/.git/logs/refs/remotes/origin/user/xinzed/dps_conn_str +1 -0
- s/.git/logs/refs/remotes/origin/user/xinzed/update-python-docker +1 -0
- s/.git/logs/refs/remotes/origin/vikas/azure +1 -0
- s/.git/logs/refs/remotes/origin/vikas/dependebot +1 -0
- s/.git/logs/refs/remotes/origin/xinzed/3_1_0rc1 +1 -0
- s/.git/logs/refs/remotes/origin/xinzed/update-runtime +1 -0
- s/.git/objects/pack/pack-a8179feb7da51d11a42c37c5b3c8593cffe17075.idx +0 -0
- s/.git/objects/pack/pack-a8179feb7da51d11a42c37c5b3c8593cffe17075.pack +0 -0
- s/.git/refs/remotes/origin/EO +1 -0
- s/.git/refs/remotes/origin/avagraw/security_fix +1 -0
- s/.git/refs/remotes/origin/cherry-pick-rename +1 -0
- s/.git/refs/remotes/origin/chyuan/fix-validation-not-fail-test +1 -0
- s/.git/refs/remotes/origin/chyuan/update-linux-agent +1 -0
- s/.git/refs/remotes/origin/dependabot/pip/pyyaml-5.4 +1 -0
- s/.git/refs/remotes/origin/eliises/add-device-tagging-docs +1 -0
- s/.git/refs/remotes/origin/main +1 -0
- s/.git/refs/remotes/origin/ray-deps +1 -0
- s/.git/refs/remotes/origin/ray-dev-setup +1 -0
- s/.git/refs/remotes/origin/ray-tox +1 -0
- s/.git/refs/remotes/origin/release-pipeline-automation +1 -0
- s/.git/refs/remotes/origin/spmcdono/fix-pipeline-test-install +1 -0
- s/.git/refs/remotes/origin/spmcdono/layered-deployments +1 -0
- s/.git/refs/remotes/origin/spmcdono/pypi-package-test-pipeline +1 -0
- s/.git/refs/remotes/origin/spmcdono/remove-py2 +1 -0
- s/.git/refs/remotes/origin/spmcdono/remove-py2-dev +1 -0
- s/.git/refs/remotes/origin/spmcdono/test-native-runtime-install +1 -0
- s/.git/refs/remotes/origin/spmcdono/update-pipeline +1 -0
- s/.git/refs/remotes/origin/user/marine/EliiseS/devcontainer +1 -0
- s/.git/refs/remotes/origin/user/marine/fixsimver +1 -0
- s/.git/refs/remotes/origin/user/marine/layereddeploymentsbuildtest +1 -0
- s/.git/refs/remotes/origin/user/marine/master-to-main +1 -0
- s/.git/refs/remotes/origin/user/marine/pipeline +1 -0
- s/.git/refs/remotes/origin/user/vikas +1 -0
- s/.git/refs/remotes/origin/user/vikas0212/verify-tests +1 -0
- s/.git/refs/remotes/origin/user/vikas2 +1 -0
- s/.git/refs/remotes/origin/user/vikas_pypi +1 -0
- s/.git/refs/remotes/origin/user/vikas_pypi-1 +1 -0
- s/.git/refs/remotes/origin/user/vikas_testing +1 -0
- s/.git/refs/remotes/origin/user/xinzed/dps_conn_str +1 -0
- s/.git/refs/remotes/origin/user/xinzed/update-python-docker +1 -0
- s/.git/refs/remotes/origin/vikas/azure +1 -0
- s/.git/refs/remotes/origin/vikas/dependebot +1 -0
- s/.git/refs/remotes/origin/xinzed/3_1_0rc1 +1 -0
- s/.git/refs/remotes/origin/xinzed/update-runtime +1 -0
- s/.git/refs/tags/v0.49.0 +1 -0
- s/.git/refs/tags/v0.50.0 +1 -0
- s/.git/refs/tags/v0.51.0 +1 -0
- s/.git/refs/tags/v0.52.0 +1 -0
- s/.git/refs/tags/v0.53.0 +1 -0
- s/.git/refs/tags/v0.54.0 +1 -0
- s/.git/refs/tags/v0.55.0 +1 -0
- s/.git/refs/tags/v0.56.0 +1 -0
- s/.git/refs/tags/v0.57.0 +1 -0
- s/.git/refs/tags/v0.58.0 +1 -0
- s/.git/refs/tags/v0.59.0 +1 -0
- s/.git/refs/tags/v0.60.0 +1 -0
- s/.git/refs/tags/v0.61.0 +1 -0
- s/.git/refs/tags/v0.62.0 +1 -0
- s/.git/refs/tags/v0.63.0 +1 -0
- s/.git/refs/tags/v0.64.0 +1 -0
- s/.git/refs/tags/v0.65.0 +1 -0
- s/.git/refs/tags/v0.66.0 +1 -0
- s/.git/refs/tags/v0.67.0 +1 -0
- s/.git/refs/tags/v0.68.0 +1 -0
- s/.git/refs/tags/v0.69.0 +1 -0
- s/.git/refs/tags/v0.70.0 +1 -0
- s/.git/refs/tags/v0.71.0 +1 -0
- s/.git/refs/tags/v0.72.0 +1 -0
- s/.git/refs/tags/v0.73.0 +1 -0
- s/.git/refs/tags/v0.74.0 +1 -0
- s/.git/refs/tags/v0.75.0 +1 -0
- s/.git/refs/tags/v0.76.0 +1 -0
- s/.git/refs/tags/v0.77.0 +1 -0
- s/.git/refs/tags/v0.78.0 +1 -0
- s/.git/refs/tags/v0.79.0 +1 -0
- s/.git/refs/tags/v0.82.0 +1 -0
- s/.git/refs/tags/v0.82.0-container +1 -0
- s/.git/refs/tags/v1.0.0 +1 -0
- s/.git/refs/tags/v1.1.0 +1 -0
- s/.git/refs/tags/v1.2.0 +1 -0
- s/.git/refs/tags/v1.3.0 +1 -0
- s/.git/refs/tags/v2.0.0 +1 -0
- s/.git/refs/tags/v2.0.1 +1 -0
- s/.git/refs/tags/v2.0.2 +1 -0
- s/.git/refs/tags/v2.1.0 +1 -0
- s/.git/refs/tags/v2.1.1 +1 -0
- s/.git/refs/tags/v2.1.2 +1 -0
- s/.git/refs/tags/v2.1.3 +1 -0
- s/.git/refs/tags/v2.1.4 +1 -0
- s/.git/refs/tags/v2.1.6 +1 -0
- s/.git/refs/tags/v2.2.0 +1 -0
- s/.git/refs/tags/v3.0.0 +1 -0
- s/.git/refs/tags/v3.0.0-rc +1 -0
- s/.git/refs/tags/v3.1.0 +1 -0
- s/.git/refs/tags/v3.1.1 +1 -0
- s/.git/refs/tags/v3.1.2 +1 -0
- s/.git/refs/tags/v3.2.0 +1 -0
- s/.git/refs/tags/v3.2.0rc0 +1 -0
- s/.git/refs/tags/v3.3.0 +1 -0
- s/.git/refs/tags/v3.3.1 +1 -0
- s/.git/refs/tags/v3.3.2 +1 -0
- s/.git/refs/tags/v3.3.3 +1 -0
- s/.git/refs/tags/v3.3.3-rc0 +1 -0
- s/.git/refs/tags/v3.3.4 +1 -0
- s/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
- s/.github/ISSUE_TEMPLATE/feature_request.md +7 -0
- s/.github/workflows/wiki.yml +54 -0
- s/.gitignore +103 -0
- s/.vscode/launch.json +26 -0
- s/.vscode/settings.json +30 -0
- s/CHANGELOG.md +156 -0
- s/CODE_OF_CONDUCT.md +1 -0
- s/CONTRIBUTING.md +122 -0
- s/LICENSE +14 -0
- s/MANIFEST.in +7 -0
- s/Makefile +87 -0
- s/README.md +204 -0
- s/assets/armdeployment.png +0 -0
- s/assets/armoutputs.png +0 -0
- s/assets/deploy/ARMDeployment/ARMDeployment.deployproj +36 -0
- s/assets/deploy/ARMDeployment/Deploy-AzureResourceGroup.ps1 +118 -0
- s/assets/deploy/ARMDeployment/azuredeploy.json +145 -0
- s/assets/deploy/ARMDeployment/azuredeploy.parameters.json +6 -0
- s/assets/deploy/ARMDeployment.sln +25 -0
- s/assets/edgedevtool2mins.png +0 -0
- s/assets/edgedevtoolintro.png +0 -0
- s/assets/edgedevtoolquickstartlarge.png +0 -0
- s/assets/edgedevtoolquickstartsmall.png +0 -0
- s/assets/edgedevtoolwsl.png +0 -0
- s/azure-pipelines.yml +144 -0
- s/build/lib/iotedgedev/__init__.py +6 -0
- s/build/lib/iotedgedev/args.py +18 -0
- s/build/lib/iotedgedev/azurecli.py +542 -0
- s/build/lib/iotedgedev/buildoptionsparser.py +151 -0
- s/build/lib/iotedgedev/buildprofile.py +5 -0
- s/build/lib/iotedgedev/cli.py +830 -0
- s/build/lib/iotedgedev/connectionstring.py +58 -0
- s/build/lib/iotedgedev/constants.py +12 -0
- s/build/lib/iotedgedev/containerregistry.py +5 -0
- s/build/lib/iotedgedev/decorators.py +116 -0
- s/build/lib/iotedgedev/deploymentmanifest.py +313 -0
- s/build/lib/iotedgedev/dockercls.py +255 -0
- s/build/lib/iotedgedev/dotnet.py +31 -0
- s/build/lib/iotedgedev/edge.py +33 -0
- s/build/lib/iotedgedev/envvars.py +240 -0
- s/build/lib/iotedgedev/iothub.py +65 -0
- s/build/lib/iotedgedev/module.py +62 -0
- s/build/lib/iotedgedev/modules.py +332 -0
- s/build/lib/iotedgedev/organizedgroup.py +48 -0
- s/build/lib/iotedgedev/output.py +57 -0
- s/build/lib/iotedgedev/simulator.py +58 -0
- s/build/lib/iotedgedev/solution.py +48 -0
- s/build/lib/iotedgedev/telemetry.py +155 -0
- s/build/lib/iotedgedev/telemetryconfig.py +85 -0
- s/build/lib/iotedgedev/telemetryuploader.py +53 -0
- s/build/lib/iotedgedev/template/.env.tmp +87 -0
- s/build/lib/iotedgedev/template/.gitignore +10 -0
- s/build/lib/iotedgedev/template/deployment.template.json +79 -0
- s/build/lib/iotedgedev/template/launch_c.json +50 -0
- s/build/lib/iotedgedev/template/launch_csharp.json +43 -0
- s/build/lib/iotedgedev/template/launch_java.json +27 -0
- s/build/lib/iotedgedev/template/launch_node.json +36 -0
- s/build/lib/iotedgedev/template/launch_python.json +22 -0
- s/build/lib/iotedgedev/utility.py +179 -0
- s/build/lib/iotedgedev/version.py +4 -0
- s/build.sh +150 -0
- s/cleanup.sh +7 -0
- s/dist/iotedgedev-3.3.4-py3-none-any.whl +0 -0
- s/docker/tool/build-docker.sh +168 -0
- s/docker/tool/deps.txt +7 -0
- s/docker/tool/linux/Dockerfile +7 -0
- s/docker/tool/linux/Dockerfile.base +61 -0
- s/docker/tool/linux/install-dev.sh +8 -0
- s/docker/tool/linux/run.ps1 +5 -0
- s/docker/tool/linux/run.sh +5 -0
- s/docker/tool/push-docker.sh +35 -0
- s/docker/tool/windows/Dockerfile +4 -0
- s/docker/tool/windows/Dockerfile.base +63 -0
- s/docker/tool/windows/install-dev.bat +4 -0
- s/docker/tool/windows/run.ps1 +30 -0
- s/docs/Azure-Setup.md +102 -0
- s/docs/Command-List.md +564 -0
- s/docs/Command-Tips.md +51 -0
- s/docs/Edge-Device-Setup.md +23 -0
- s/docs/Home.md +10 -0
- s/docs/Manual-Dev-Machine-Setup.md +77 -0
- s/docs/Migration-Guides.md +131 -0
- s/docs/Overview.md +66 -0
- s/docs/Python-Virtual-Environment-Setup.md +35 -0
- s/docs/Quickstart-with-IoT-Edge-Dev-Container.md +145 -0
- s/docs/Test-Coverage.md +7 -0
- s/docs/Troubleshooting.md +21 -0
- s/docs/Usage.md +123 -0
- s/docs/_Sidebar.md +13 -0
- s/iotedgedev/__init__.py +6 -0
- s/iotedgedev/args.py +18 -0
- s/iotedgedev/azurecli.py +542 -0
- s/iotedgedev/buildoptionsparser.py +151 -0
- s/iotedgedev/buildprofile.py +5 -0
- s/iotedgedev/cli.py +830 -0
- s/iotedgedev/connectionstring.py +58 -0
- s/iotedgedev/constants.py +12 -0
- s/iotedgedev/containerregistry.py +5 -0
- s/iotedgedev/decorators.py +116 -0
- s/iotedgedev/deploymentmanifest.py +313 -0
- s/iotedgedev/dockercls.py +255 -0
- s/iotedgedev/dotnet.py +31 -0
- s/iotedgedev/edge.py +33 -0
- s/iotedgedev/envvars.py +240 -0
- s/iotedgedev/iothub.py +65 -0
- s/iotedgedev/module.py +62 -0
- s/iotedgedev/modules.py +332 -0
- s/iotedgedev/organizedgroup.py +48 -0
- s/iotedgedev/output.py +57 -0
- s/iotedgedev/simulator.py +58 -0
- s/iotedgedev/solution.py +48 -0
- s/iotedgedev/telemetry.py +155 -0
- s/iotedgedev/telemetryconfig.py +85 -0
- s/iotedgedev/telemetryuploader.py +53 -0
- s/iotedgedev/template/.env.tmp +87 -0
- s/iotedgedev/template/.gitignore +10 -0
- s/iotedgedev/template/deployment.template.json +79 -0
- s/iotedgedev/template/launch_c.json +50 -0
- s/iotedgedev/template/launch_csharp.json +43 -0
- s/iotedgedev/template/launch_java.json +27 -0
- s/iotedgedev/template/launch_node.json +36 -0
- s/iotedgedev/template/launch_python.json +22 -0
- s/iotedgedev/utility.py +179 -0
- s/iotedgedev/version.py +4 -0
- s/iotedgedev.egg-info/PKG-INFO +21 -0
- s/iotedgedev.egg-info/SOURCES.txt +100 -0
- s/iotedgedev.egg-info/dependency_links.txt +1 -0
- s/iotedgedev.egg-info/entry_points.txt +3 -0
- s/iotedgedev.egg-info/not-zip-safe +1 -0
- s/iotedgedev.egg-info/requires.txt +18 -0
- s/iotedgedev.egg-info/top_level.txt +1 -0
- s/pull_request_template.md +9 -0
- s/pytest.ini +4 -0
- s/requirements.txt +12 -0
- s/requirements_dev.txt +17 -0
- s/scripts/gen-help-markdown.bat +177 -0
- s/scripts/install-pip.sh +1 -0
- s/scripts/setup-wsl.sh +7 -0
- s/setup.cfg +18 -0
- s/setup.py +66 -0
- s/tests/__init__.py +5 -0
- s/tests/assets/deployment.manifest_invalid.json +106 -0
- s/tests/assets/deployment.manifest_invalid_createoptions.json +102 -0
- s/tests/assets/deployment.manifest_invalid_schema.json +69 -0
- s/tests/assets/deployment.template.non_str_placeholder.json +79 -0
- s/tests/assets/deployment.template_1.json +163 -0
- s/tests/assets/deployment.template_2.json +163 -0
- s/tests/assets/deployment.template_3.json +174 -0
- s/tests/assets/deployment.template_4.json +79 -0
- s/tests/assets/deployment.template_invalidresult.json +183 -0
- s/tests/assets/deployment.template_without_schema_template.json +99 -0
- s/tests/assets/launch.json +225 -0
- s/tests/assets/launch_without_nodejs.json +194 -0
- s/tests/assets/test_solution_shared_lib/.gitignore +2 -0
- s/tests/assets/test_solution_shared_lib/.vscode/launch.json +43 -0
- s/tests/assets/test_solution_shared_lib/deployment.debug.template.json +100 -0
- s/tests/assets/test_solution_shared_lib/deployment.escapedpath.template.json +90 -0
- s/tests/assets/test_solution_shared_lib/deployment.template.json +106 -0
- s/tests/assets/test_solution_shared_lib/layered_deployment.flattened_props.template.json +21 -0
- s/tests/assets/test_solution_shared_lib/layered_deployment.no_modules.template.json +12 -0
- s/tests/assets/test_solution_shared_lib/libs/sharedlib/Class1.cs +12 -0
- s/tests/assets/test_solution_shared_lib/libs/sharedlib/sharedlib.csproj +7 -0
- s/tests/assets/test_solution_shared_lib/modules/non_module_project/placeholder.txt +0 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/.gitignore +34 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/Dockerfile.amd64 +18 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/Dockerfile.amd64.debug +25 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/Dockerfile.windows-amd64 +15 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/Program.cs +91 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/module.json +18 -0
- s/tests/assets/test_solution_shared_lib/modules/sample_module/sample_module.csproj +26 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/.gitignore +34 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/Dockerfile.amd64 +18 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/Dockerfile.amd64.debug +25 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/Dockerfile.windows-amd64 +15 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/Program.cs +91 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/module.json +18 -0
- s/tests/assets/test_solution_shared_lib/sample_module_2/sample_module_2.csproj +26 -0
- s/tests/test_azurecli.py +33 -0
- s/tests/test_buildoptionsparser.py +155 -0
- s/tests/test_cli.py +55 -0
- s/tests/test_config.py +28 -0
- s/tests/test_connectionstring.py +87 -0
- s/tests/test_decorators.py +44 -0
- s/tests/test_deploymentmanifest.py +106 -0
- s/tests/test_envvars.py +169 -0
- s/tests/test_iotedgedev_iothub_deploy.py +199 -0
- s/tests/test_iotedgedev_simulator.py +133 -0
- s/tests/test_iotedgedev_solution.py +457 -0
- s/tests/test_iotedgedev_solution_build.py +246 -0
- s/tests/test_iotedgedev_solution_tag.py +99 -0
- s/tests/test_utility.py +132 -0
- s/tests/utility.py +132 -0
- s/tox.ini +29 -0
- s/vsts_ci/.vsts-ci.yml +93 -0
- s/vsts_ci/darwin/continuous-build-darwin.yml +54 -0
- s/vsts_ci/linux/continuous-build-linux.yml +28 -0
- s/vsts_ci/win32/continuous-build-win32.yml +26 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema-template": "4.0.0",
|
|
3
|
+
"modulesContent": {
|
|
4
|
+
"$edgeAgent": {
|
|
5
|
+
"properties.desired": {
|
|
6
|
+
"schemaVersion": "${EDGEAGENT_SCHEMA_VERSION}",
|
|
7
|
+
"runtime": {
|
|
8
|
+
"type": "docker",
|
|
9
|
+
"settings": {
|
|
10
|
+
"minDockerVersion": "v1.25",
|
|
11
|
+
"loggingOptions": "",
|
|
12
|
+
"registryCredentials": {}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"systemModules": {
|
|
16
|
+
"edgeAgent": {
|
|
17
|
+
"type": "docker",
|
|
18
|
+
"settings": {
|
|
19
|
+
"image": "mcr.microsoft.com/azureiotedge-agent:${EDGE_RUNTIME_VERSION}",
|
|
20
|
+
"createOptions": {}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"edgeHub": {
|
|
24
|
+
"type": "docker",
|
|
25
|
+
"status": "running",
|
|
26
|
+
"restartPolicy": "always",
|
|
27
|
+
"settings": {
|
|
28
|
+
"image": "mcr.microsoft.com/azureiotedge-hub:${EDGE_RUNTIME_VERSION}",
|
|
29
|
+
"createOptions": {
|
|
30
|
+
"HostConfig": {
|
|
31
|
+
"PortBindings": {
|
|
32
|
+
"5671/tcp": [
|
|
33
|
+
{
|
|
34
|
+
"HostPort": "5671"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"8883/tcp": [
|
|
38
|
+
{
|
|
39
|
+
"HostPort": "8883"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"443/tcp": [
|
|
43
|
+
{
|
|
44
|
+
"HostPort": "443"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"modules": {
|
|
54
|
+
"tempSensor": {
|
|
55
|
+
"version": "1.0",
|
|
56
|
+
"type": "docker",
|
|
57
|
+
"status": "running",
|
|
58
|
+
"restartPolicy": "always",
|
|
59
|
+
"settings": {
|
|
60
|
+
"image": "mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0",
|
|
61
|
+
"createOptions": {}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"sample_module_2": {
|
|
65
|
+
"version": "1.0",
|
|
66
|
+
"type": "docker",
|
|
67
|
+
"status": "running",
|
|
68
|
+
"restartPolicy": "always",
|
|
69
|
+
"settings": {
|
|
70
|
+
"image": "${MODULEDIR<.\\sample_module_2>}",
|
|
71
|
+
"createOptions": {}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"$edgeHub": {
|
|
78
|
+
"properties.desired": {
|
|
79
|
+
"schemaVersion": "${EDGEHUB_SCHEMA_VERSION}",
|
|
80
|
+
"routes": {
|
|
81
|
+
"sample_moduleToIoTHub": "FROM /messages/modules/sample_module/outputs/* INTO $upstream",
|
|
82
|
+
"sensorTosample_module": "FROM /messages/modules/tempSensor/outputs/temperatureOutput INTO BrokeredEndpoint(\"/modules/sample_module/inputs/input1\")"
|
|
83
|
+
},
|
|
84
|
+
"storeAndForwardConfiguration": {
|
|
85
|
+
"timeToLiveSecs": 7200
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema-template": "4.0.0",
|
|
3
|
+
"modulesContent": {
|
|
4
|
+
"$edgeAgent": {
|
|
5
|
+
"properties.desired": {
|
|
6
|
+
"schemaVersion": "${EDGEAGENT_SCHEMA_VERSION}",
|
|
7
|
+
"runtime": {
|
|
8
|
+
"type": "docker",
|
|
9
|
+
"settings": {
|
|
10
|
+
"minDockerVersion": "v1.25",
|
|
11
|
+
"loggingOptions": "",
|
|
12
|
+
"registryCredentials": {
|
|
13
|
+
"testacr": {
|
|
14
|
+
"username": "$USERNAME",
|
|
15
|
+
"password": "$PASSWORD",
|
|
16
|
+
"address": "$CONTAINER_REGISTRY_PASSWORD"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"systemModules": {
|
|
22
|
+
"edgeAgent": {
|
|
23
|
+
"type": "docker",
|
|
24
|
+
"settings": {
|
|
25
|
+
"image": "mcr.microsoft.com/azureiotedge-agent:${EDGE_RUNTIME_VERSION}",
|
|
26
|
+
"createOptions": {}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"edgeHub": {
|
|
30
|
+
"type": "docker",
|
|
31
|
+
"status": "running",
|
|
32
|
+
"restartPolicy": "always",
|
|
33
|
+
"settings": {
|
|
34
|
+
"image": "mcr.microsoft.com/azureiotedge-hub:${EDGE_RUNTIME_VERSION}",
|
|
35
|
+
"createOptions": {
|
|
36
|
+
"HostConfig": {
|
|
37
|
+
"PortBindings": {
|
|
38
|
+
"5671/tcp": [
|
|
39
|
+
{
|
|
40
|
+
"HostPort": "5671"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"8883/tcp": [
|
|
44
|
+
{
|
|
45
|
+
"HostPort": "8883"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"443/tcp": [
|
|
49
|
+
{
|
|
50
|
+
"HostPort": "443"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"modules": {
|
|
60
|
+
"tempSensor": {
|
|
61
|
+
"version": "1.0",
|
|
62
|
+
"type": "docker",
|
|
63
|
+
"status": "running",
|
|
64
|
+
"restartPolicy": "always",
|
|
65
|
+
"settings": {
|
|
66
|
+
"image": "mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0",
|
|
67
|
+
"createOptions": {}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"sample_module": {
|
|
71
|
+
"version": "1.0",
|
|
72
|
+
"type": "docker",
|
|
73
|
+
"status": "running",
|
|
74
|
+
"restartPolicy": "always",
|
|
75
|
+
"settings": {
|
|
76
|
+
"image": "${MODULES.sample_module}",
|
|
77
|
+
"createOptions": {}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"sample_module_2": {
|
|
81
|
+
"version": "1.0",
|
|
82
|
+
"type": "docker",
|
|
83
|
+
"status": "running",
|
|
84
|
+
"restartPolicy": "always",
|
|
85
|
+
"settings": {
|
|
86
|
+
"image": "${MODULEDIR<./sample_module_2>}",
|
|
87
|
+
"createOptions": {}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"$edgeHub": {
|
|
94
|
+
"properties.desired": {
|
|
95
|
+
"schemaVersion": "${EDGEHUB_SCHEMA_VERSION}",
|
|
96
|
+
"routes": {
|
|
97
|
+
"sample_moduleToIoTHub": "FROM /messages/modules/sample_module/outputs/* INTO $upstream",
|
|
98
|
+
"sensorTosample_module": "FROM /messages/modules/tempSensor/outputs/temperatureOutput INTO BrokeredEndpoint(\"/modules/sample_module/inputs/input1\")"
|
|
99
|
+
},
|
|
100
|
+
"storeAndForwardConfiguration": {
|
|
101
|
+
"timeToLiveSecs": 7200
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"content": {
|
|
3
|
+
"modulesContent": {
|
|
4
|
+
"$edgeAgent": {
|
|
5
|
+
"properties.desired.modules.sample_module": {
|
|
6
|
+
"version": "1.0",
|
|
7
|
+
"type": "docker",
|
|
8
|
+
"status": "running",
|
|
9
|
+
"restartPolicy": "always",
|
|
10
|
+
"settings": {
|
|
11
|
+
"image": "${MODULES.sample_module}",
|
|
12
|
+
"createOptions": {}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"$edgeHub": {
|
|
17
|
+
"properties.desired.routes.upstream": "FROM /messages/* INTO $upstream"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# .NET Core
|
|
2
|
+
project.lock.json
|
|
3
|
+
project.fragment.lock.json
|
|
4
|
+
artifacts/
|
|
5
|
+
**/Properties/launchSettings.json
|
|
6
|
+
|
|
7
|
+
*_i.c
|
|
8
|
+
*_p.c
|
|
9
|
+
*_i.h
|
|
10
|
+
*.ilk
|
|
11
|
+
*.meta
|
|
12
|
+
*.obj
|
|
13
|
+
*.pch
|
|
14
|
+
*.pdb
|
|
15
|
+
*.pgc
|
|
16
|
+
*.pgd
|
|
17
|
+
*.rsp
|
|
18
|
+
*.sbr
|
|
19
|
+
*.tlb
|
|
20
|
+
*.tli
|
|
21
|
+
*.tlh
|
|
22
|
+
*.tmp
|
|
23
|
+
*.tmp_proj
|
|
24
|
+
*.log
|
|
25
|
+
*.vspscc
|
|
26
|
+
*.vssscc
|
|
27
|
+
.builds
|
|
28
|
+
*.pidb
|
|
29
|
+
*.svclog
|
|
30
|
+
*.scc
|
|
31
|
+
.vs
|
|
32
|
+
|
|
33
|
+
[Bb]in/
|
|
34
|
+
[Oo]bj/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
FROM mcr.microsoft.com/dotnet/sdk:2.1 AS build-env
|
|
2
|
+
|
|
3
|
+
COPY ./libs /app/libs
|
|
4
|
+
COPY ./modules/sample_module/*.csproj /app/modules/sample_module/
|
|
5
|
+
COPY ./modules/sample_module /app/modules/sample_module
|
|
6
|
+
|
|
7
|
+
WORKDIR /app/modules/sample_module
|
|
8
|
+
RUN dotnet restore
|
|
9
|
+
RUN dotnet publish -c Release -o /app/out
|
|
10
|
+
|
|
11
|
+
FROM mcr.microsoft.com/dotnet/runtime:2.1-stretch-slim
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
COPY --from=build-env /app/out ./
|
|
14
|
+
|
|
15
|
+
RUN useradd -ms /bin/bash moduleuser
|
|
16
|
+
USER moduleuser
|
|
17
|
+
|
|
18
|
+
ENTRYPOINT ["dotnet", "sample_module.dll"]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
FROM mcr.microsoft.com/dotnet/runtime:2.1-stretch-slim AS base
|
|
2
|
+
|
|
3
|
+
RUN apt-get update && \
|
|
4
|
+
apt-get install -y --no-install-recommends unzip procps && \
|
|
5
|
+
rm -rf /var/lib/apt/lists/*
|
|
6
|
+
|
|
7
|
+
RUN useradd -ms /bin/bash moduleuser
|
|
8
|
+
USER moduleuser
|
|
9
|
+
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg
|
|
10
|
+
|
|
11
|
+
FROM mcr.microsoft.com/dotnet/sdk:2.1 AS build-env
|
|
12
|
+
|
|
13
|
+
COPY ./libs /app/libs
|
|
14
|
+
COPY ./modules/sample_module/*.csproj /app/modules/sample_module/
|
|
15
|
+
COPY ./modules/sample_module /app/modules/sample_module
|
|
16
|
+
|
|
17
|
+
WORKDIR /app/modules/sample_module
|
|
18
|
+
RUN dotnet restore
|
|
19
|
+
RUN dotnet publish -c Debug -o /app/out
|
|
20
|
+
|
|
21
|
+
FROM base
|
|
22
|
+
WORKDIR /app
|
|
23
|
+
COPY --from=build-env /app/out ./
|
|
24
|
+
|
|
25
|
+
ENTRYPOINT ["dotnet", "sample_module.dll"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
FROM mcr.microsoft.com/dotnet/sdk:2.1 AS build-env
|
|
2
|
+
|
|
3
|
+
COPY ./libs /app/libs
|
|
4
|
+
COPY ./modules/sample_module/*.csproj /app/modules/sample_module/
|
|
5
|
+
COPY ./modules/sample_module /app/modules/sample_module
|
|
6
|
+
|
|
7
|
+
WORKDIR /app/modules/sample_module
|
|
8
|
+
RUN dotnet restore
|
|
9
|
+
RUN dotnet publish -c Release -o /app/out
|
|
10
|
+
|
|
11
|
+
FROM mcr.microsoft.com/dotnet/runtime:2.1-nanoserver-1809
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
COPY --from=build-env /app/out ./
|
|
14
|
+
|
|
15
|
+
ENTRYPOINT ["dotnet", "sample_module.dll"]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
namespace sample_module
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.IO;
|
|
5
|
+
using System.Runtime.InteropServices;
|
|
6
|
+
using System.Runtime.Loader;
|
|
7
|
+
using System.Security.Cryptography.X509Certificates;
|
|
8
|
+
using System.Text;
|
|
9
|
+
using System.Threading;
|
|
10
|
+
using System.Threading.Tasks;
|
|
11
|
+
using Microsoft.Azure.Devices.Client;
|
|
12
|
+
using sharedlib;
|
|
13
|
+
|
|
14
|
+
class Program
|
|
15
|
+
{
|
|
16
|
+
static int counter;
|
|
17
|
+
|
|
18
|
+
static void Main(string[] args)
|
|
19
|
+
{
|
|
20
|
+
Class1.Foo();
|
|
21
|
+
|
|
22
|
+
Init().Wait();
|
|
23
|
+
|
|
24
|
+
// Wait until the app unloads or is cancelled
|
|
25
|
+
var cts = new CancellationTokenSource();
|
|
26
|
+
AssemblyLoadContext.Default.Unloading += (ctx) => cts.Cancel();
|
|
27
|
+
Console.CancelKeyPress += (sender, cpe) => cts.Cancel();
|
|
28
|
+
WhenCancelled(cts.Token).Wait();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
/// Handles cleanup operations when app is cancelled or unloads
|
|
33
|
+
/// </summary>
|
|
34
|
+
public static Task WhenCancelled(CancellationToken cancellationToken)
|
|
35
|
+
{
|
|
36
|
+
var tcs = new TaskCompletionSource<bool>();
|
|
37
|
+
cancellationToken.Register(s => ((TaskCompletionSource<bool>)s).SetResult(true), tcs);
|
|
38
|
+
return tcs.Task;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
/// Initializes the ModuleClient and sets up the callback to receive
|
|
43
|
+
/// messages containing temperature information
|
|
44
|
+
/// </summary>
|
|
45
|
+
static async Task Init()
|
|
46
|
+
{
|
|
47
|
+
AmqpTransportSettings amqpSetting = new AmqpTransportSettings(TransportType.Amqp_Tcp_Only);
|
|
48
|
+
ITransportSettings[] settings = { amqpSetting };
|
|
49
|
+
|
|
50
|
+
// Open a connection to the Edge runtime
|
|
51
|
+
ModuleClient ioTHubModuleClient = await ModuleClient.CreateFromEnvironmentAsync(settings);
|
|
52
|
+
await ioTHubModuleClient.OpenAsync();
|
|
53
|
+
Console.WriteLine("IoT Hub module client initialized.");
|
|
54
|
+
|
|
55
|
+
// Register callback to be called when a message is received by the module
|
|
56
|
+
await ioTHubModuleClient.SetInputMessageHandlerAsync("input1", PipeMessage, ioTHubModuleClient);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
/// This method is called whenever the module is sent a message from the EdgeHub.
|
|
61
|
+
/// It just pipe the messages without any change.
|
|
62
|
+
/// It prints all the incoming messages.
|
|
63
|
+
/// </summary>
|
|
64
|
+
static async Task<MessageResponse> PipeMessage(Message message, object userContext)
|
|
65
|
+
{
|
|
66
|
+
int counterValue = Interlocked.Increment(ref counter);
|
|
67
|
+
|
|
68
|
+
var moduleClient = userContext as ModuleClient;
|
|
69
|
+
if (moduleClient == null)
|
|
70
|
+
{
|
|
71
|
+
throw new InvalidOperationException("UserContext doesn't contain " + "expected values");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
byte[] messageBytes = message.GetBytes();
|
|
75
|
+
string messageString = Encoding.UTF8.GetString(messageBytes);
|
|
76
|
+
Console.WriteLine($"Received message: {counterValue}, Body: [{messageString}]");
|
|
77
|
+
|
|
78
|
+
if (!string.IsNullOrEmpty(messageString))
|
|
79
|
+
{
|
|
80
|
+
var pipeMessage = new Message(messageBytes);
|
|
81
|
+
foreach (var prop in message.Properties)
|
|
82
|
+
{
|
|
83
|
+
pipeMessage.Properties.Add(prop.Key, prop.Value);
|
|
84
|
+
}
|
|
85
|
+
await moduleClient.SendEventAsync("output1", pipeMessage);
|
|
86
|
+
Console.WriteLine("Received message sent");
|
|
87
|
+
}
|
|
88
|
+
return MessageResponse.Completed;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema-version": "0.0.1",
|
|
3
|
+
"description": "",
|
|
4
|
+
"image": {
|
|
5
|
+
"repository": "${CONTAINER_REGISTRY_SERVER}/sample_module",
|
|
6
|
+
"tag": {
|
|
7
|
+
"version": "0.0.1-RC",
|
|
8
|
+
"platforms": {
|
|
9
|
+
"amd64": "./Dockerfile.amd64",
|
|
10
|
+
"amd64.debug": "./Dockerfile.amd64.debug",
|
|
11
|
+
"windows-amd64": "./Dockerfile.windows-amd64"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"buildOptions": [],
|
|
15
|
+
"contextPath": "../../"
|
|
16
|
+
},
|
|
17
|
+
"language": "csharp"
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
+
<PropertyGroup>
|
|
3
|
+
<OutputType>Exe</OutputType>
|
|
4
|
+
<TargetFramework>netcoreapp2.1</TargetFramework>
|
|
5
|
+
</PropertyGroup>
|
|
6
|
+
|
|
7
|
+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp2.1|AnyCPU'">
|
|
8
|
+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
|
|
9
|
+
<TreatSpecificWarningsAsErrors />
|
|
10
|
+
</PropertyGroup>
|
|
11
|
+
|
|
12
|
+
<ItemGroup>
|
|
13
|
+
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.40.0" />
|
|
14
|
+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
|
|
15
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.0.0" />
|
|
16
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.0.0" />
|
|
17
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
|
|
18
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.0" />
|
|
19
|
+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
|
|
20
|
+
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
|
|
21
|
+
</ItemGroup>
|
|
22
|
+
|
|
23
|
+
<ItemGroup>
|
|
24
|
+
<ProjectReference Include="..\..\libs\sharedlib\sharedlib.csproj" />
|
|
25
|
+
</ItemGroup>
|
|
26
|
+
</Project>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# .NET Core
|
|
2
|
+
project.lock.json
|
|
3
|
+
project.fragment.lock.json
|
|
4
|
+
artifacts/
|
|
5
|
+
**/Properties/launchSettings.json
|
|
6
|
+
|
|
7
|
+
*_i.c
|
|
8
|
+
*_p.c
|
|
9
|
+
*_i.h
|
|
10
|
+
*.ilk
|
|
11
|
+
*.meta
|
|
12
|
+
*.obj
|
|
13
|
+
*.pch
|
|
14
|
+
*.pdb
|
|
15
|
+
*.pgc
|
|
16
|
+
*.pgd
|
|
17
|
+
*.rsp
|
|
18
|
+
*.sbr
|
|
19
|
+
*.tlb
|
|
20
|
+
*.tli
|
|
21
|
+
*.tlh
|
|
22
|
+
*.tmp
|
|
23
|
+
*.tmp_proj
|
|
24
|
+
*.log
|
|
25
|
+
*.vspscc
|
|
26
|
+
*.vssscc
|
|
27
|
+
.builds
|
|
28
|
+
*.pidb
|
|
29
|
+
*.svclog
|
|
30
|
+
*.scc
|
|
31
|
+
.vs
|
|
32
|
+
|
|
33
|
+
[Bb]in/
|
|
34
|
+
[Oo]bj/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
FROM mcr.microsoft.com/dotnet/sdk:2.1 AS build-env
|
|
2
|
+
|
|
3
|
+
COPY ./libs /app/libs
|
|
4
|
+
COPY ./sample_module_2/*.csproj /app/sample_module_2/
|
|
5
|
+
COPY ./sample_module_2 /app/sample_module_2
|
|
6
|
+
|
|
7
|
+
WORKDIR /app/sample_module_2
|
|
8
|
+
RUN dotnet restore
|
|
9
|
+
RUN dotnet publish -c Release -o /app/out
|
|
10
|
+
|
|
11
|
+
FROM mcr.microsoft.com/dotnet/runtime:2.1-stretch-slim
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
COPY --from=build-env /app/out ./
|
|
14
|
+
|
|
15
|
+
RUN useradd -ms /bin/bash moduleuser
|
|
16
|
+
USER moduleuser
|
|
17
|
+
|
|
18
|
+
ENTRYPOINT ["dotnet", "sample_module_2.dll"]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
FROM mcr.microsoft.com/dotnet/runtime:2.1-stretch-slim AS base
|
|
2
|
+
|
|
3
|
+
RUN apt-get update && \
|
|
4
|
+
apt-get install -y --no-install-recommends unzip procps && \
|
|
5
|
+
rm -rf /var/lib/apt/lists/*
|
|
6
|
+
|
|
7
|
+
RUN useradd -ms /bin/bash moduleuser
|
|
8
|
+
USER moduleuser
|
|
9
|
+
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg
|
|
10
|
+
|
|
11
|
+
FROM mcr.microsoft.com/dotnet/sdk:2.1 AS build-env
|
|
12
|
+
|
|
13
|
+
COPY ./libs /app/libs
|
|
14
|
+
COPY ./sample_module_2/*.csproj /app/sample_module_2/
|
|
15
|
+
COPY ./sample_module_2 /app/sample_module_2
|
|
16
|
+
|
|
17
|
+
WORKDIR /app/sample_module_2
|
|
18
|
+
RUN dotnet restore
|
|
19
|
+
RUN dotnet publish -c Debug -o /app/out
|
|
20
|
+
|
|
21
|
+
FROM base
|
|
22
|
+
WORKDIR /app
|
|
23
|
+
COPY --from=build-env /app/out ./
|
|
24
|
+
|
|
25
|
+
ENTRYPOINT ["dotnet", "sample_module_2.dll"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
FROM mcr.microsoft.com/dotnet/sdk:2.1 AS build-env
|
|
2
|
+
|
|
3
|
+
COPY ./libs /app/libs
|
|
4
|
+
COPY ./sample_module_2/*.csproj /app/sample_module_2/
|
|
5
|
+
COPY ./sample_module_2 /app/sample_module_2
|
|
6
|
+
|
|
7
|
+
WORKDIR /app/sample_module_2
|
|
8
|
+
RUN dotnet restore
|
|
9
|
+
RUN dotnet publish -c Release -o /app/out
|
|
10
|
+
|
|
11
|
+
FROM mcr.microsoft.com/dotnet/runtime:2.1-nanoserver-1809
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
COPY --from=build-env /app/out ./
|
|
14
|
+
|
|
15
|
+
ENTRYPOINT ["dotnet", "sample_module_2.dll"]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
namespace sample_module
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.IO;
|
|
5
|
+
using System.Runtime.InteropServices;
|
|
6
|
+
using System.Runtime.Loader;
|
|
7
|
+
using System.Security.Cryptography.X509Certificates;
|
|
8
|
+
using System.Text;
|
|
9
|
+
using System.Threading;
|
|
10
|
+
using System.Threading.Tasks;
|
|
11
|
+
using Microsoft.Azure.Devices.Client;
|
|
12
|
+
using sharedlib;
|
|
13
|
+
|
|
14
|
+
class Program
|
|
15
|
+
{
|
|
16
|
+
static int counter;
|
|
17
|
+
|
|
18
|
+
static void Main(string[] args)
|
|
19
|
+
{
|
|
20
|
+
Class1.Foo();
|
|
21
|
+
|
|
22
|
+
Init().Wait();
|
|
23
|
+
|
|
24
|
+
// Wait until the app unloads or is cancelled
|
|
25
|
+
var cts = new CancellationTokenSource();
|
|
26
|
+
AssemblyLoadContext.Default.Unloading += (ctx) => cts.Cancel();
|
|
27
|
+
Console.CancelKeyPress += (sender, cpe) => cts.Cancel();
|
|
28
|
+
WhenCancelled(cts.Token).Wait();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
/// Handles cleanup operations when app is cancelled or unloads
|
|
33
|
+
/// </summary>
|
|
34
|
+
public static Task WhenCancelled(CancellationToken cancellationToken)
|
|
35
|
+
{
|
|
36
|
+
var tcs = new TaskCompletionSource<bool>();
|
|
37
|
+
cancellationToken.Register(s => ((TaskCompletionSource<bool>)s).SetResult(true), tcs);
|
|
38
|
+
return tcs.Task;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
/// Initializes the ModuleClient and sets up the callback to receive
|
|
43
|
+
/// messages containing temperature information
|
|
44
|
+
/// </summary>
|
|
45
|
+
static async Task Init()
|
|
46
|
+
{
|
|
47
|
+
AmqpTransportSettings amqpSetting = new AmqpTransportSettings(TransportType.Amqp_Tcp_Only);
|
|
48
|
+
ITransportSettings[] settings = { amqpSetting };
|
|
49
|
+
|
|
50
|
+
// Open a connection to the Edge runtime
|
|
51
|
+
ModuleClient ioTHubModuleClient = await ModuleClient.CreateFromEnvironmentAsync(settings);
|
|
52
|
+
await ioTHubModuleClient.OpenAsync();
|
|
53
|
+
Console.WriteLine("IoT Hub module client initialized.");
|
|
54
|
+
|
|
55
|
+
// Register callback to be called when a message is received by the module
|
|
56
|
+
await ioTHubModuleClient.SetInputMessageHandlerAsync("input1", PipeMessage, ioTHubModuleClient);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
/// This method is called whenever the module is sent a message from the EdgeHub.
|
|
61
|
+
/// It just pipe the messages without any change.
|
|
62
|
+
/// It prints all the incoming messages.
|
|
63
|
+
/// </summary>
|
|
64
|
+
static async Task<MessageResponse> PipeMessage(Message message, object userContext)
|
|
65
|
+
{
|
|
66
|
+
int counterValue = Interlocked.Increment(ref counter);
|
|
67
|
+
|
|
68
|
+
var moduleClient = userContext as ModuleClient;
|
|
69
|
+
if (moduleClient == null)
|
|
70
|
+
{
|
|
71
|
+
throw new InvalidOperationException("UserContext doesn't contain " + "expected values");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
byte[] messageBytes = message.GetBytes();
|
|
75
|
+
string messageString = Encoding.UTF8.GetString(messageBytes);
|
|
76
|
+
Console.WriteLine($"Received message: {counterValue}, Body: [{messageString}]");
|
|
77
|
+
|
|
78
|
+
if (!string.IsNullOrEmpty(messageString))
|
|
79
|
+
{
|
|
80
|
+
var pipeMessage = new Message(messageBytes);
|
|
81
|
+
foreach (var prop in message.Properties)
|
|
82
|
+
{
|
|
83
|
+
pipeMessage.Properties.Add(prop.Key, prop.Value);
|
|
84
|
+
}
|
|
85
|
+
await moduleClient.SendEventAsync("output1", pipeMessage);
|
|
86
|
+
Console.WriteLine("Received message sent");
|
|
87
|
+
}
|
|
88
|
+
return MessageResponse.Completed;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|