├── docs ├── README.md ├── assets │ └── images │ │ └── dashboard.png └── CODEOWNER ├── scripts ├── vsts │ └── imagestopush ├── git │ ├── .functions.sh │ ├── pre-commit-runner.sh │ ├── setup │ └── setup.cmd ├── build ├── local │ └── launch │ │ ├── start-device-simulation.cmd │ │ ├── start-device-simulation.sh │ │ ├── os │ │ ├── win │ │ │ └── set-env-uri.cmd │ │ ├── linux │ │ │ └── set-env-uri.sh │ │ └── osx │ │ │ └── set-env-uri.sh │ │ ├── start-dotnet-only-services.cmd │ │ ├── start.cmd │ │ ├── start.sh │ │ └── start-dotnet-only-services.sh ├── build.cmd ├── iothub │ ├── list-subscriptions.sh │ ├── list-hubs.sh │ ├── show-hub.sh │ └── select-subscription.sh └── docker │ ├── run │ └── README.md ├── storage-adapter ├── version ├── project │ ├── build.properties │ └── scaffold.sbt ├── sbt ├── sbt.cmd ├── scripts │ ├── git │ │ ├── .functions.sh │ │ ├── pre-commit-runner-no-sandbox.sh │ │ └── pre-commit-runner-with-sandbox.sh │ ├── sbt-dist │ │ ├── bin │ │ │ └── sbt-launch.jar │ │ └── conf │ │ │ └── sbtconfig.txt │ ├── docker │ │ ├── content │ │ │ └── README.md │ │ ├── build │ │ └── publish │ ├── iothub │ │ ├── list-subscriptions.sh │ │ ├── list-hubs.sh │ │ ├── show-hub.sh │ │ └── select-subscription.sh │ ├── env-vars-check │ ├── package │ ├── env-vars-check.cmd │ ├── clean-up │ └── clean-up.cmd ├── test │ ├── it │ │ └── README.md │ ├── helpers │ │ ├── SlowTest.java │ │ ├── UnitTest.java │ │ └── IntegrationTest.java │ └── README.md ├── app │ └── com │ │ └── microsoft │ │ └── azure │ │ └── iotsolutions │ │ └── storageadapter │ │ ├── webservice │ │ ├── wrappers │ │ │ ├── IKeyGenerator.java │ │ │ └── GuidKeyGenerator.java │ │ ├── v1 │ │ │ ├── controllers │ │ │ │ └── README.md │ │ │ ├── Version.java │ │ │ ├── exceptions │ │ │ │ └── BadRequestException.java │ │ │ └── models │ │ │ │ └── README.md │ │ └── runtime │ │ │ └── IConfig.java │ │ └── services │ │ ├── helpers │ │ └── DocumentIdHelper.java │ │ ├── README.md │ │ ├── runtime │ │ ├── IConfigData.java │ │ └── IServicesConfig.java │ │ ├── models │ │ └── README.md │ │ ├── wrappers │ │ └── IFactory.java │ │ ├── IStatusService.java │ │ ├── KeyValueDocument.java │ │ └── exceptions │ │ ├── CreateResourceException.java │ │ ├── ResourceNotFoundException.java │ │ ├── InvalidInputException.java │ │ ├── InvalidConfigurationException.java │ │ └── ResourceOutOfDateException.java ├── .github │ ├── CODEOWNERS │ └── PULL_REQUEST_TEMPLATE.md └── .gitattributes ├── auth └── scripts │ ├── docker │ ├── .dockerignore │ ├── content │ │ ├── run.sh │ │ └── README.md │ ├── publish │ ├── publish.cmd │ ├── Dockerfile │ └── run │ ├── git │ ├── .functions.sh │ ├── pre-commit-runner-no-sandbox.sh │ └── pre-commit-runner-with-sandbox.sh │ ├── env-vars-setup.cmd │ ├── env-vars-check.cmd │ ├── travis │ ├── env-vars-setup │ ├── travis.cmd │ └── clean-up ├── device-telemetry ├── scripts │ ├── docker │ │ ├── content │ │ │ ├── run.sh │ │ │ └── README.md │ │ ├── build │ │ ├── publish │ │ └── run │ ├── git │ │ ├── .functions.sh │ │ ├── pre-commit-runner-no-sandbox.sh │ │ └── pre-commit-runner-with-sandbox.sh │ ├── sbt-dist │ │ ├── bin │ │ │ └── sbt-launch.jar │ │ └── conf │ │ │ └── sbtconfig.txt │ ├── package │ ├── clean-up │ ├── env-vars-check │ ├── env-vars-check.cmd │ └── clean-up.cmd ├── project │ ├── build.properties │ └── scaffold.sbt ├── sbt ├── sbt.cmd ├── test │ ├── it │ │ └── README.md │ ├── helpers │ │ ├── SlowTest.java │ │ ├── UnitTest.java │ │ └── IntegrationTest.java │ ├── data │ │ └── EmailTemplate.html │ └── README.md ├── app │ ├── com │ │ └── microsoft │ │ │ └── azure │ │ │ └── iotsolutions │ │ │ └── devicetelemetry │ │ │ ├── services │ │ │ ├── runtime │ │ │ │ ├── StorageType.java │ │ │ │ ├── IConfigData.java │ │ │ │ ├── DiagnosticsConfig.java │ │ │ │ ├── IServicesConfig.java │ │ │ │ └── AlarmsConfig.java │ │ │ ├── storage │ │ │ │ ├── storageAdapter │ │ │ │ │ └── IStorageAdapterClient.java │ │ │ │ └── timeSeries │ │ │ │ │ └── PropertyModel.java │ │ │ ├── README.md │ │ │ ├── exceptions │ │ │ │ ├── NotAuthorizedException.java │ │ │ │ ├── TimeSeriesParseException.java │ │ │ │ ├── ResourceNotFoundException.java │ │ │ │ ├── InvalidInputException.java │ │ │ │ ├── InvalidConfigurationException.java │ │ │ │ ├── ResourceOutOfDateException.java │ │ │ │ ├── ExternalDependencyException.java │ │ │ │ └── ConflictingResourceException.java │ │ │ ├── models │ │ │ │ ├── actions │ │ │ │ │ └── ActionType.java │ │ │ │ ├── CalculationType.java │ │ │ │ ├── SeverityType.java │ │ │ │ ├── OperatorType.java │ │ │ │ └── MessageListServiceModel.java │ │ │ ├── IStatusService.java │ │ │ ├── external │ │ │ │ └── IDiagnosticsClient.java │ │ │ └── helpers │ │ │ │ └── WsRequestBuilder.java │ │ │ ├── actionsagent │ │ │ ├── IAgent.java │ │ │ └── actions │ │ │ │ ├── IActionManager.java │ │ │ │ └── IActionExecutor.java │ │ │ └── webservice │ │ │ ├── auth │ │ │ ├── Authorize.java │ │ │ ├── exceptions │ │ │ │ ├── NotAuthorizedException.java │ │ │ │ ├── InvalidConfigurationException.java │ │ │ │ └── ExternalDependencyException.java │ │ │ ├── UserClaims.java │ │ │ └── IJwtValidation.java │ │ │ └── v1 │ │ │ ├── models │ │ │ ├── AlarmStatus.java │ │ │ └── AlarmIdListApiModel.java │ │ │ ├── exceptions │ │ │ └── BadRequestException.java │ │ │ └── Version.java │ └── resources │ │ └── data │ │ └── EmailTemplate.html ├── .github │ ├── CODEOWNERS │ └── PULL_REQUEST_TEMPLATE.md ├── .gitattributes └── device-telemetry.iml ├── project ├── build.properties └── scaffold.sbt ├── asa-manager └── scripts │ ├── docker │ ├── .dockerignore │ ├── content │ │ ├── run.sh │ │ └── README.md │ ├── publish │ ├── publish.cmd │ └── Dockerfile │ ├── git │ ├── .functions.sh │ ├── pre-commit-runner-no-sandbox.sh │ └── pre-commit-runner-with-sandbox.sh │ ├── asa │ ├── samples │ │ └── devicegroups.csv │ └── functions │ │ ├── applyRuleFilter.js │ │ ├── removeUnusedProperties.js │ │ ├── applyRuleFilter.js.json │ │ └── removeUnusedProperties.js.json │ ├── travis │ └── travis.cmd ├── config ├── project │ ├── build.properties │ └── scaffold.sbt ├── sbt ├── sbt.cmd ├── scripts │ ├── git │ │ ├── .functions.sh │ │ ├── pre-commit-runner-no-sandbox.sh │ │ └── pre-commit-runner-with-sandbox.sh │ ├── sbt-dist │ │ ├── bin │ │ │ └── sbt-launch.jar │ │ └── conf │ │ │ └── sbtconfig.txt │ ├── docker │ │ ├── content │ │ │ └── README.md │ │ ├── build │ │ ├── publish │ │ └── run │ ├── env-vars-check │ ├── package │ ├── env-vars-check.cmd │ ├── clean-up │ └── clean-up.cmd ├── test │ ├── it │ │ └── README.md │ ├── helpers │ │ ├── SlowTest.java │ │ ├── UnitTest.java │ │ ├── IntegrationTest.java │ │ └── Random.java │ ├── README.md │ └── com │ │ └── microsoft │ │ └── azure │ │ └── iotsolutions │ │ └── uiconfig │ │ └── webservice │ │ └── runtime │ │ └── ConfigTest.java ├── app │ ├── com │ │ └── microsoft │ │ │ └── azure │ │ │ └── iotsolutions │ │ │ └── uiconfig │ │ │ ├── services │ │ │ ├── models │ │ │ │ ├── actions │ │ │ │ │ ├── ActionType.java │ │ │ │ │ └── IActionSettings.java │ │ │ │ ├── OperatorType.java │ │ │ │ ├── README.md │ │ │ │ ├── ConfigType.java │ │ │ │ ├── PackageType.java │ │ │ │ └── Theme.java │ │ │ ├── IRecurringTasks.java │ │ │ ├── README.md │ │ │ ├── external │ │ │ │ ├── PackageValidation │ │ │ │ │ ├── EdgePackageValidator.java │ │ │ │ │ ├── FirmwareValidator.java │ │ │ │ │ ├── IPackageValidator.java │ │ │ │ │ ├── PackageValidator.java │ │ │ │ │ └── PackageValidatorFactory.java │ │ │ │ ├── ValueListApiModel.java │ │ │ │ ├── IDeviceSimulationClient.java │ │ │ │ ├── DeviceModelRef.java │ │ │ │ └── IDeviceTelemetryClient.java │ │ │ ├── runtime │ │ │ │ ├── IActionsConfig.java │ │ │ │ ├── IConfigData.java │ │ │ │ └── IServicesConfig.java │ │ │ ├── ISeed.java │ │ │ ├── http │ │ │ │ ├── IHttpResponse.java │ │ │ │ └── IHttpClient.java │ │ │ ├── IStatusService.java │ │ │ ├── exceptions │ │ │ │ ├── SeedException.java │ │ │ │ ├── ExternalDependencyException.java │ │ │ │ ├── NotAuthorizedException.java │ │ │ │ ├── ResourceNotFoundException.java │ │ │ │ ├── BaseException.java │ │ │ │ ├── InvalidInputException.java │ │ │ │ ├── InvalidConfigurationException.java │ │ │ │ ├── ResourceOutOfDateException.java │ │ │ │ └── ConflictingResourceException.java │ │ │ ├── IActions.java │ │ │ ├── IStorageMutex.java │ │ │ └── helpers │ │ │ │ └── WsRequestBuilder.java │ │ │ └── webservice │ │ │ ├── v1 │ │ │ ├── controllers │ │ │ │ └── README.md │ │ │ ├── Version.java │ │ │ ├── exceptions │ │ │ │ └── BadRequestException.java │ │ │ └── models │ │ │ │ └── README.md │ │ │ └── auth │ │ │ ├── Authorize.java │ │ │ ├── IJwtValidation.java │ │ │ ├── exceptions │ │ │ ├── NotAuthorizedException.java │ │ │ ├── InvalidConfigurationException.java │ │ │ └── ExternalDependencyException.java │ │ │ └── UserClaims.java │ └── resources │ │ └── content │ │ └── DefaultLogo.svg ├── .github │ ├── CODEOWNERS │ └── PULL_REQUEST_TEMPLATE.md └── .gitattributes ├── device-simulation └── scripts │ ├── docker │ ├── .dockerignore │ ├── content │ │ └── run.sh │ ├── publish │ ├── publish.cmd │ ├── Dockerfile │ └── run │ ├── git │ ├── .functions.sh │ ├── pre-commit-runner-no-sandbox.sh │ └── pre-commit-runner-with-sandbox.sh │ ├── env-vars-check.cmd │ ├── env-vars-setup.cmd │ ├── env-vars-setup │ ├── travis │ └── travis.cmd ├── iothub-manager ├── project │ ├── build.properties │ └── scaffold.sbt ├── sbt ├── sbt.cmd ├── scripts │ ├── git │ │ ├── .functions.sh │ │ ├── pre-commit-runner-no-sandbox.sh │ │ └── pre-commit-runner-with-sandbox.sh │ ├── sbt-dist │ │ ├── bin │ │ │ └── sbt-launch.jar │ │ └── conf │ │ │ └── sbtconfig.txt │ ├── iothub │ │ ├── list-subscriptions.sh │ │ ├── list-hubs.sh │ │ ├── show-hub.sh │ │ └── select-subscription.sh │ ├── package │ ├── docker │ │ ├── build │ │ └── publish │ ├── clean-up │ ├── env-vars-check │ ├── env-vars-check.cmd │ └── clean-up.cmd ├── test │ ├── it │ │ └── README.md │ ├── helpers │ │ ├── SlowTest.java │ │ ├── UnitTest.java │ │ └── IntegrationTest.java │ ├── com │ │ └── microsoft │ │ │ └── azure │ │ │ └── iotsolutions │ │ │ └── iothubmanager │ │ │ └── webservice │ │ │ └── runtime │ │ │ └── ConfigTest.java │ └── README.md ├── app │ └── com │ │ └── microsoft │ │ └── azure │ │ └── iotsolutions │ │ └── iothubmanager │ │ ├── services │ │ ├── models │ │ │ ├── DeploymentStatus.java │ │ │ ├── README.md │ │ │ ├── ConfigType.java │ │ │ ├── DeploymentServiceListModel.java │ │ │ ├── PackageType.java │ │ │ ├── DeviceGroup.java │ │ │ └── TwinServiceListModel.java │ │ ├── README.md │ │ ├── external │ │ │ ├── ValueListApiModel.java │ │ │ └── DeviceGroupFiltersApiModel.java │ │ ├── runtime │ │ │ ├── IConfigData.java │ │ │ └── IServicesConfig.java │ │ ├── DevicePropertyCallBack.java │ │ ├── exceptions │ │ │ ├── ExternalDependencyException.java │ │ │ ├── ResourceNotFoundException.java │ │ │ ├── InvalidInputException.java │ │ │ ├── InvalidConfigurationException.java │ │ │ ├── ResourceOutOfDateException.java │ │ │ └── ConflictingResourceException.java │ │ ├── IStatusService.java │ │ └── helpers │ │ │ └── WsRequestBuilder.java │ │ ├── RecurringTasksAgent │ │ └── IRecurringTasksAgent.java │ │ └── webservice │ │ ├── v1 │ │ ├── controllers │ │ │ └── README.md │ │ ├── models │ │ │ ├── MethodResultApiModel.java │ │ │ └── README.md │ │ └── Version.java │ │ ├── auth │ │ ├── IJwtValidation.java │ │ ├── Authorize.java │ │ ├── NotAuthorizedException.java │ │ ├── ExternalDependencyException.java │ │ ├── InvalidConfigurationException.java │ │ ├── UserClaims.java │ │ └── IUserManagementClient.java │ │ └── exceptions │ │ └── BadRequestException.java ├── iothubmanager │ └── iothub-manager-java.iml ├── docs │ ├── CODEOWNERS │ ├── PULL_REQUEST_TEMPLATE.md │ └── API_SPECS_DEVICE_PROPERTIES.md ├── iothub-manager.iml ├── .gitattributes └── iothub-manager-java.iml ├── .gitattributes └── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md /docs/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/vsts/imagestopush: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /storage-adapter/version: -------------------------------------------------------------------------------- 1 | 0.1.6 2 | -------------------------------------------------------------------------------- /auth/scripts/docker/.dockerignore: -------------------------------------------------------------------------------- 1 | envvars.sh 2 | -------------------------------------------------------------------------------- /device-telemetry/scripts/docker/content/run.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.16 2 | -------------------------------------------------------------------------------- /asa-manager/scripts/docker/.dockerignore: -------------------------------------------------------------------------------- 1 | envvars.sh 2 | -------------------------------------------------------------------------------- /config/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.16 2 | -------------------------------------------------------------------------------- /device-simulation/scripts/docker/.dockerignore: -------------------------------------------------------------------------------- 1 | envvars.sh 2 | -------------------------------------------------------------------------------- /iothub-manager/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.16 2 | -------------------------------------------------------------------------------- /device-telemetry/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.16 2 | -------------------------------------------------------------------------------- /storage-adapter/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.15 2 | -------------------------------------------------------------------------------- /config/sbt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./scripts/sbt-dist/bin/sbt "$@" 4 | -------------------------------------------------------------------------------- /iothub-manager/sbt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./scripts/sbt-dist/bin/sbt "$@" 4 | -------------------------------------------------------------------------------- /config/sbt.cmd: -------------------------------------------------------------------------------- 1 | @REM SBT launcher script 2 | 3 | .\scripts\sbt-dist\bin\sbt.bat %* 4 | -------------------------------------------------------------------------------- /device-telemetry/sbt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./scripts/sbt-dist/bin/sbt "$@" 4 | -------------------------------------------------------------------------------- /storage-adapter/sbt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./scripts/sbt-dist/bin/sbt "$@" 4 | -------------------------------------------------------------------------------- /device-telemetry/sbt.cmd: -------------------------------------------------------------------------------- 1 | @REM SBT launcher script 2 | 3 | .\scripts\sbt-dist\bin\sbt.bat %* 4 | -------------------------------------------------------------------------------- /iothub-manager/sbt.cmd: -------------------------------------------------------------------------------- 1 | @REM SBT launcher script 2 | 3 | .\scripts\sbt-dist\bin\sbt.bat %* 4 | -------------------------------------------------------------------------------- /storage-adapter/sbt.cmd: -------------------------------------------------------------------------------- 1 | @REM SBT launcher script 2 | 3 | .\scripts\sbt-dist\bin\sbt.bat %* 4 | -------------------------------------------------------------------------------- /scripts/git/.functions.sh: -------------------------------------------------------------------------------- 1 | header() { 2 | echo -e "\n### $1" 3 | } 4 | 5 | error() { 6 | echo -e "$1" 7 | } 8 | -------------------------------------------------------------------------------- /auth/scripts/git/.functions.sh: -------------------------------------------------------------------------------- 1 | header() { 2 | echo -e "\n### $1" 3 | } 4 | 5 | error() { 6 | echo -e "$1" 7 | } 8 | -------------------------------------------------------------------------------- /config/scripts/git/.functions.sh: -------------------------------------------------------------------------------- 1 | header() { 2 | echo -e "\n### $1" 3 | } 4 | 5 | error() { 6 | echo -e "$1" 7 | } 8 | -------------------------------------------------------------------------------- /device-telemetry/scripts/git/.functions.sh: -------------------------------------------------------------------------------- 1 | header() { 2 | echo -e "\n### $1" 3 | } 4 | 5 | error() { 6 | echo -e "$1" 7 | } 8 | -------------------------------------------------------------------------------- /docs/assets/images/dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/remote-monitoring-services-java/HEAD/docs/assets/images/dashboard.png -------------------------------------------------------------------------------- /iothub-manager/scripts/git/.functions.sh: -------------------------------------------------------------------------------- 1 | header() { 2 | echo -e "\n### $1" 3 | } 4 | 5 | error() { 6 | echo -e "$1" 7 | } 8 | -------------------------------------------------------------------------------- /storage-adapter/scripts/git/.functions.sh: -------------------------------------------------------------------------------- 1 | header() { 2 | echo -e "\n### $1" 3 | } 4 | 5 | error() { 6 | echo -e "$1" 7 | } 8 | -------------------------------------------------------------------------------- /scripts/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 4 | 5 | cd $APP_HOME 6 | -------------------------------------------------------------------------------- /project/scaffold.sbt: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.7.1") -------------------------------------------------------------------------------- /config/scripts/sbt-dist/bin/sbt-launch.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/remote-monitoring-services-java/HEAD/config/scripts/sbt-dist/bin/sbt-launch.jar -------------------------------------------------------------------------------- /scripts/local/launch/start-device-simulation.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | cd device-simulation\scripts\docker 3 | run.cmd 4 | 5 | -------------------------------------------------------------------------------- /auth/scripts/docker/content/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd /app/ 4 | 5 | cd webservice 6 | 7 | dotnet Microsoft.Azure.IoTSolutions.Auth.WebService.dll 8 | -------------------------------------------------------------------------------- /iothub-manager/scripts/sbt-dist/bin/sbt-launch.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/remote-monitoring-services-java/HEAD/iothub-manager/scripts/sbt-dist/bin/sbt-launch.jar -------------------------------------------------------------------------------- /device-telemetry/scripts/sbt-dist/bin/sbt-launch.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/remote-monitoring-services-java/HEAD/device-telemetry/scripts/sbt-dist/bin/sbt-launch.jar -------------------------------------------------------------------------------- /storage-adapter/scripts/sbt-dist/bin/sbt-launch.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/remote-monitoring-services-java/HEAD/storage-adapter/scripts/sbt-dist/bin/sbt-launch.jar -------------------------------------------------------------------------------- /asa-manager/scripts/git/.functions.sh: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft. All rights reserved. 2 | 3 | header() { 4 | echo -e "\n### $1" 5 | } 6 | 7 | error() { 8 | echo -e "$1" 9 | } 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set bash scripts to always be in LF 2 | * text=auto eol=lf 3 | *.sh text eol=lf 4 | scripts/build text eol=lf 5 | scripts/docker/run text eol=lf 6 | scripts/git/setup text eol=lf 7 | -------------------------------------------------------------------------------- /device-simulation/scripts/git/.functions.sh: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft. All rights reserved. 2 | 3 | header() { 4 | echo -e "\n### $1" 5 | } 6 | 7 | error() { 8 | echo -e "$1" 9 | } 10 | -------------------------------------------------------------------------------- /asa-manager/scripts/docker/content/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | 4 | cd /app/ 5 | 6 | cd webservice && dotnet Microsoft.Azure.IoTSolutions.AsaManager.WebService.dll 7 | -------------------------------------------------------------------------------- /config/project/scaffold.sbt: -------------------------------------------------------------------------------- 1 | // TODO: do we need this? 2 | 3 | // Defines scaffolding (found under .g8 folder) 4 | // sbt "g8Scaffold form" 5 | addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.7.1") 6 | -------------------------------------------------------------------------------- /auth/scripts/docker/content/README.md: -------------------------------------------------------------------------------- 1 | Place in this folder files to be copied inside the container. Note that the 2 | files are not copied automatically though, you still need to customize the 3 | Docker image build script. 4 | -------------------------------------------------------------------------------- /config/scripts/docker/content/README.md: -------------------------------------------------------------------------------- 1 | Place in this folder files to be copied inside the container. Note that the 2 | files are not copied automatically though, you still need to customize the 3 | Docker image build script. 4 | -------------------------------------------------------------------------------- /device-telemetry/project/scaffold.sbt: -------------------------------------------------------------------------------- 1 | // TODO: do we need this? 2 | 3 | // Defines scaffolding (found under .g8 folder) 4 | // sbt "g8Scaffold form" 5 | addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.7.1") 6 | -------------------------------------------------------------------------------- /iothub-manager/project/scaffold.sbt: -------------------------------------------------------------------------------- 1 | // TODO: do we need this? 2 | 3 | // Defines scaffolding (found under .g8 folder) 4 | // sbt "g8Scaffold form" 5 | addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.7.1") 6 | -------------------------------------------------------------------------------- /storage-adapter/project/scaffold.sbt: -------------------------------------------------------------------------------- 1 | // TODO: do we need this? 2 | 3 | // Defines scaffolding (found under .g8 folder) 4 | // sbt "g8Scaffold form" 5 | addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.7.1") 6 | -------------------------------------------------------------------------------- /asa-manager/scripts/docker/content/README.md: -------------------------------------------------------------------------------- 1 | Place in this folder files to be copied inside the container. Note that the 2 | files are not copied automatically though, you still need to customize the 3 | Docker image build script. 4 | -------------------------------------------------------------------------------- /device-simulation/scripts/docker/content/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | 4 | cd /app/ 5 | 6 | cd webservice && dotnet Microsoft.Azure.IoTSolutions.DeviceSimulation.WebService.dll 7 | -------------------------------------------------------------------------------- /storage-adapter/scripts/docker/content/README.md: -------------------------------------------------------------------------------- 1 | Place in this folder files to be copied inside the container. Note that the 2 | files are not copied automatically though, you still need to customize the 3 | Docker image build script. 4 | -------------------------------------------------------------------------------- /device-telemetry/scripts/docker/content/README.md: -------------------------------------------------------------------------------- 1 | Place in this folder files to be copied inside the container. Note that the 2 | files are not copied automatically though, you still need to customize the 3 | Docker image build script. 4 | -------------------------------------------------------------------------------- /asa-manager/scripts/asa/samples/devicegroups.csv: -------------------------------------------------------------------------------- 1 | DeviceId,GroupId 2 | "Simulated.chiller-01.0","default_Chillers" 3 | "Simulated.chiller-02.0","default_Chillers" 4 | "Simulated.truck-01.0","default_Truck" 5 | "Simulated.truck-02.0","default_Truck" -------------------------------------------------------------------------------- /scripts/git/pre-commit-runner.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/git/pre-commit.sh" 8 | -------------------------------------------------------------------------------- /config/scripts/sbt-dist/conf/sbtconfig.txt: -------------------------------------------------------------------------------- 1 | # Set the java args to high 2 | 3 | -Xmx512M 4 | 5 | -XX:MaxPermSize=256m 6 | 7 | -XX:ReservedCodeCacheSize=128m 8 | 9 | 10 | 11 | # Set the extra SBT options 12 | 13 | -Dsbt.log.format=true 14 | -------------------------------------------------------------------------------- /iothub-manager/scripts/sbt-dist/conf/sbtconfig.txt: -------------------------------------------------------------------------------- 1 | # Set the java args to high 2 | 3 | -Xmx512M 4 | 5 | -XX:MaxPermSize=256m 6 | 7 | -XX:ReservedCodeCacheSize=128m 8 | 9 | 10 | 11 | # Set the extra SBT options 12 | 13 | -Dsbt.log.format=true 14 | -------------------------------------------------------------------------------- /storage-adapter/scripts/sbt-dist/conf/sbtconfig.txt: -------------------------------------------------------------------------------- 1 | # Set the java args to high 2 | 3 | -Xmx512M 4 | 5 | -XX:MaxPermSize=256m 6 | 7 | -XX:ReservedCodeCacheSize=128m 8 | 9 | 10 | 11 | # Set the extra SBT options 12 | 13 | -Dsbt.log.format=true 14 | -------------------------------------------------------------------------------- /device-telemetry/scripts/sbt-dist/conf/sbtconfig.txt: -------------------------------------------------------------------------------- 1 | # Set the java args to high 2 | 3 | -Xmx512M 4 | 5 | -XX:MaxPermSize=256m 6 | 7 | -XX:ReservedCodeCacheSize=128m 8 | 9 | 10 | 11 | # Set the extra SBT options 12 | 13 | -Dsbt.log.format=true 14 | -------------------------------------------------------------------------------- /config/test/it/README.md: -------------------------------------------------------------------------------- 1 | Integration Tests 2 | ================= 3 | 4 | ## Guidelines 5 | 6 | 7 | 8 | ## Conventions 9 | 10 | * For each scenario create a test class with "Test" suffix. 11 | * Flag all the tests with `@Category({IntegrationTest.class})` 12 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/models/actions/ActionType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.models.actions; 4 | 5 | public enum ActionType { 6 | Email 7 | } 8 | -------------------------------------------------------------------------------- /device-telemetry/test/it/README.md: -------------------------------------------------------------------------------- 1 | Integration Tests 2 | ================= 3 | 4 | ## Guidelines 5 | 6 | 7 | 8 | ## Conventions 9 | 10 | * For each scenario create a test class with "Test" suffix. 11 | * Flag all the tests with `@Category({IntegrationTest.class})` 12 | -------------------------------------------------------------------------------- /iothub-manager/test/it/README.md: -------------------------------------------------------------------------------- 1 | Integration Tests 2 | ================= 3 | 4 | ## Guidelines 5 | 6 | 7 | 8 | ## Conventions 9 | 10 | * For each scenario create a test class with "Test" suffix. 11 | * Flag all the tests with `@Category({IntegrationTest.class})` 12 | -------------------------------------------------------------------------------- /storage-adapter/test/it/README.md: -------------------------------------------------------------------------------- 1 | Integration Tests 2 | ================= 3 | 4 | ## Guidelines 5 | 6 | 7 | 8 | ## Conventions 9 | 10 | * For each scenario create a test class with "Test" suffix. 11 | * Flag all the tests with `@Category({IntegrationTest.class})` 12 | -------------------------------------------------------------------------------- /auth/scripts/git/pre-commit-runner-no-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --no-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /scripts/local/launch/start-device-simulation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | 4 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../../ && pwd )" 5 | 6 | set -e 7 | 8 | cd $APP_HOME/device-simulation/scripts/docker 9 | ./run 10 | 11 | set +e -------------------------------------------------------------------------------- /auth/scripts/git/pre-commit-runner-with-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --with-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /config/scripts/git/pre-commit-runner-no-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --no-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /config/scripts/git/pre-commit-runner-with-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --with-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /iothub-manager/scripts/git/pre-commit-runner-no-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --no-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /storage-adapter/scripts/git/pre-commit-runner-no-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --no-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /auth/scripts/docker/publish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash -e 2 | 3 | # Note: use lowercase names for the Docker images 4 | DOCKER_IMAGE="azureiotpcs/pcs-auth-dotnet" 5 | # "testing" is the latest dev build, usually matching the code in the "master" branch 6 | DOCKER_TAG="$DOCKER_IMAGE:testing" 7 | 8 | docker push $DOCKER_TAG 9 | -------------------------------------------------------------------------------- /device-telemetry/scripts/git/pre-commit-runner-no-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --no-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /device-telemetry/scripts/git/pre-commit-runner-with-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --with-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /iothub-manager/scripts/git/pre-commit-runner-with-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --with-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /storage-adapter/scripts/git/pre-commit-runner-with-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Path relative to .git/hooks/ 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | cd $APP_HOME 8 | 9 | ./scripts/git/pre-commit.sh --with-sandbox 10 | 11 | set +e 12 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/runtime/StorageType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.runtime; 4 | 5 | public enum StorageType { 6 | cosmosdb, // Cosmos DB 7 | tsi, // Time Series Insights 8 | } 9 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/models/DeploymentStatus.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.models; 4 | 5 | public enum DeploymentStatus { 6 | Pending, 7 | Succeeded, 8 | Failed, 9 | Unknown 10 | } 11 | -------------------------------------------------------------------------------- /scripts/build.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | setlocal 3 | 4 | :: strlen("\scripts\") => 9 5 | SET APP_HOME=%~dp0 6 | SET APP_HOME=%APP_HOME:~0,-9% 7 | cd %APP_HOME% 8 | 9 | IF NOT ERRORLEVEL 0 GOTO FAIL 10 | 11 | :: - - - - - - - - - - - - - - 12 | goto :END 13 | 14 | :FAIL 15 | echo Command failed 16 | endlocal 17 | exit /B 1 18 | 19 | :END 20 | endlocal 21 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/IRecurringTasks.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | @ImplementedBy(RecurringTasks.class) 8 | public interface IRecurringTasks { 9 | void run(); 10 | } 11 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/models/OperatorType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.models; 4 | 5 | public enum OperatorType { 6 | EQ, // = 7 | NE, // != 8 | LT, // < 9 | GT, // > 10 | LE, // <= 11 | GE, // >= 12 | IN // IN 13 | } 14 | -------------------------------------------------------------------------------- /auth/scripts/env-vars-setup.cmd: -------------------------------------------------------------------------------- 1 | :: Prepare the environment variables used by the application. 2 | 3 | :: The OpenId tokens issuer URL, e.g. https://sts.windows.net/12000000-3400-5600-0000-780000000000/ 4 | SETX PCS_AUTH_ISSUER "{enter the token issuer URL here}" 5 | 6 | :: The intended audience of the tokens, e.g. your Client Id 7 | SETX PCS_AUTH_AUDIENCE "{enter the tokens audience here}" 8 | -------------------------------------------------------------------------------- /auth/scripts/docker/publish.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off & setlocal enableextensions enabledelayedexpansion 2 | 3 | :: Note: use lowercase names for the Docker images 4 | SET DOCKER_IMAGE="azureiotpcs/pcs-auth-dotnet" 5 | :: "testing" is the latest dev build, usually matching the code in the "master" branch 6 | SET DOCKER_TAG=%DOCKER_IMAGE%:testing 7 | 8 | docker push %DOCKER_TAG% 9 | 10 | endlocal 11 | -------------------------------------------------------------------------------- /auth/scripts/env-vars-check.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off & setlocal enableextensions enabledelayedexpansion 2 | 3 | IF "%PCS_AUTH_ISSUER%" == "" ( 4 | echo Error: the PCS_AUTH_ISSUER environment variable is not defined. 5 | exit /B 1 6 | ) 7 | 8 | IF "%PCS_AUTH_AUDIENCE%" == "" ( 9 | echo Error: the PCS_AUTH_AUDIENCE environment variable is not defined. 10 | exit /B 1 11 | ) 12 | 13 | endlocal 14 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/RecurringTasksAgent/IRecurringTasksAgent.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.RecurringTasksAgent; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | @ImplementedBy(Agent.class) 8 | public interface IRecurringTasksAgent { 9 | void run(); 10 | } 11 | -------------------------------------------------------------------------------- /iothub-manager/iothubmanager/iothub-manager-java.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /scripts/iothub/list-subscriptions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | main() { 8 | check_dependencies 9 | login 10 | 11 | header "Azure subscriptions" 12 | azure account list 13 | #az account list | jq '.[] | {name: .name, id: .id, current: .isDefault}' | jq . 14 | } 15 | 16 | main 17 | -------------------------------------------------------------------------------- /scripts/local/launch/os/win/set-env-uri.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | SETX PCS_TELEMETRY_WEBSERVICE_URL "http://localhost:9004/v1" 3 | SETX PCS_CONFIG_WEBSERVICE_URL "http://localhost:9005/v1" 4 | SETX PCS_IOTHUBMANAGER_WEBSERVICE_URL "http://localhost:9002/v1" 5 | SETX PCS_STORAGEADAPTER_WEBSERVICE_URL "http://localhost:9022/v1" 6 | SETX PCS_AUTH_WEBSERVICE_URL "http://localhost:9001/v1" 7 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/webservice/wrappers/IKeyGenerator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.webservice.wrappers; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | @ImplementedBy(GuidKeyGenerator.class) 8 | public interface IKeyGenerator { 9 | String generate(); 10 | } 11 | -------------------------------------------------------------------------------- /asa-manager/scripts/git/pre-commit-runner-no-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Path relative to .git/hooks/ 7 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 8 | cd $APP_HOME 9 | 10 | ./scripts/git/pre-commit.sh --no-sandbox 11 | 12 | set +e 13 | -------------------------------------------------------------------------------- /asa-manager/scripts/git/pre-commit-runner-with-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Path relative to .git/hooks/ 7 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 8 | cd $APP_HOME 9 | 10 | ./scripts/git/pre-commit.sh --with-sandbox 11 | 12 | set +e 13 | -------------------------------------------------------------------------------- /auth/scripts/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.0.3-runtime-jessie 2 | 3 | MAINTAINER Devis Lucato (https://github.com/dluc) 4 | 5 | LABEL Tags="Azure,IoT,Solutions,authz,authn,.NET" 6 | 7 | ARG user=pcsuser 8 | 9 | RUN useradd -m -s /bin/bash -U $user 10 | 11 | ENTRYPOINT ["/bin/bash", "/app/run.sh"] 12 | 13 | COPY . /app/ 14 | RUN chown -R $user.$user /app 15 | WORKDIR /app 16 | 17 | USER $user 18 | -------------------------------------------------------------------------------- /device-simulation/scripts/git/pre-commit-runner-no-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Path relative to .git/hooks/ 7 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 8 | cd $APP_HOME 9 | 10 | ./scripts/git/pre-commit.sh --no-sandbox 11 | 12 | set +e 13 | -------------------------------------------------------------------------------- /device-simulation/scripts/git/pre-commit-runner-with-sandbox.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Path relative to .git/hooks/ 7 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 8 | cd $APP_HOME 9 | 10 | ./scripts/git/pre-commit.sh --with-sandbox 11 | 12 | set +e 13 | -------------------------------------------------------------------------------- /device-telemetry/scripts/docker/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 6 | source "$APP_HOME/scripts/.functions.sh" 7 | 8 | sbt_build_docker_image() { 9 | check_dependency_docker 10 | 11 | cd $APP_HOME 12 | chmod +x sbt 13 | ./sbt docker:publishLocal 14 | } 15 | 16 | sbt_build_docker_image 17 | 18 | set +e 19 | -------------------------------------------------------------------------------- /device-telemetry/scripts/docker/publish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 6 | source "$APP_HOME/scripts/.functions.sh" 7 | 8 | sbt_publish_docker_image() { 9 | check_dependency_docker 10 | 11 | cd $APP_HOME 12 | chmod +x sbt 13 | ./sbt docker:publish 14 | } 15 | 16 | sbt_publish_docker_image 17 | 18 | set +e 19 | -------------------------------------------------------------------------------- /iothub-manager/scripts/iothub/list-subscriptions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | main() { 8 | check_dependencies 9 | login 10 | 11 | header "Azure subscriptions" 12 | azure account list 13 | #az account list | jq '.[] | {name: .name, id: .id, current: .isDefault}' | jq . 14 | } 15 | 16 | main 17 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/webservice/wrappers/GuidKeyGenerator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.webservice.wrappers; 4 | 5 | public class GuidKeyGenerator implements IKeyGenerator { 6 | public String generate() { 7 | return java.util.UUID.randomUUID().toString(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/storage/storageAdapter/IStorageAdapterClient.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.storage.storageAdapter; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | @ImplementedBy(StorageAdapterClient.class) 8 | public interface IStorageAdapterClient { 9 | } 10 | -------------------------------------------------------------------------------- /storage-adapter/scripts/iothub/list-subscriptions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | main() { 8 | check_dependencies 9 | login 10 | 11 | header "Azure subscriptions" 12 | azure account list 13 | #az account list | jq '.[] | {name: .name, id: .id, current: .isDefault}' | jq . 14 | } 15 | 16 | main 17 | -------------------------------------------------------------------------------- /scripts/local/launch/os/linux/set-env-uri.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | export PCS_TELEMETRY_WEBSERVICE_URL="http://localhost:9004/v1" 4 | export PCS_CONFIG_WEBSERVICE_URL="http://localhost:9005/v1" 5 | export PCS_IOTHUBMANAGER_WEBSERVICE_URL="http://localhost:9002/v1" 6 | export PCS_STORAGEADAPTER_WEBSERVICE_URL="http://localhost:9022/v1" 7 | export PCS_AUTH_WEBSERVICE_URL="http://localhost:9001/v1" 8 | -------------------------------------------------------------------------------- /scripts/docker/run: -------------------------------------------------------------------------------- 1 | echo "Starting at https://localhost:10443" 2 | echo 3 | echo "Note:" 4 | echo " * When running locally, the service might run with an invalid SSL cert" 5 | echo " * The service requires some configuration files hosted under /app" 6 | echo " Edit docker-compose.yml to use a different path" 7 | echo 8 | 9 | read -t 10 -p "Press ENTER to start or wait ten seconds for the services to start..." 10 | 11 | docker-compose up 12 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/helpers/DocumentIdHelper.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services.helpers; 4 | 5 | public class DocumentIdHelper { 6 | public static String GenerateId(String collectionId, String key) { 7 | return collectionId.toLowerCase() + "." + key.toLowerCase(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /scripts/iothub/list-hubs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | main() { 8 | check_dependencies 9 | login 10 | 11 | header "Azure IoT Hubs in the current subscription" 12 | az iot hub list | jq '.[] | {name: .name, resourcegroup: .resourcegroup, location: .location, subscription: .subscriptionid}' | jq . 13 | } 14 | 15 | main 16 | -------------------------------------------------------------------------------- /asa-manager/scripts/docker/publish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Note: use lowercase names for the Docker images 7 | DOCKER_IMAGE="azureiotpcs/asa-manager-dotnet" 8 | # "testing" is the latest dev build, usually matching the code in the "master" branch 9 | DOCKER_TAG="$DOCKER_IMAGE:testing" 10 | 11 | docker push $DOCKER_TAG 12 | -------------------------------------------------------------------------------- /config/test/helpers/SlowTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface SlowTest { 10 | /* 11 | Category marker, usage: 12 | 13 | @Category({SlowTest.class, ...}) 14 | public void testName() { 15 | // test code 16 | } 17 | */ 18 | } 19 | -------------------------------------------------------------------------------- /config/test/helpers/UnitTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface UnitTest { 10 | /* 11 | Category marker, usage: 12 | 13 | @Category({UnitTests.class, ...}) 14 | public void testName() { 15 | // test code 16 | } 17 | */ 18 | } 19 | -------------------------------------------------------------------------------- /iothub-manager/scripts/package: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash -e 2 | 3 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 4 | source "$APP_HOME/scripts/.functions.sh" 5 | 6 | sbt_package() { 7 | check_dependency_java 8 | 9 | cd $APP_HOME 10 | chmod +x sbt 11 | ./sbt assembly && echo -n "Package available at: " && echo $(find target/scala-2.12 -name *.jar |grep assembly) 12 | } 13 | 14 | sbt_package 15 | 16 | set +e 17 | -------------------------------------------------------------------------------- /asa-manager/scripts/docker/publish.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | @ECHO off & setlocal enableextensions enabledelayedexpansion 4 | 5 | :: Note: use lowercase names for the Docker images 6 | SET DOCKER_IMAGE="azureiotpcs/asa-manager-dotnet" 7 | :: "testing" is the latest dev build, usually matching the code in the "master" branch 8 | SET DOCKER_TAG=%DOCKER_IMAGE%:testing 9 | 10 | docker push %DOCKER_TAG% 11 | 12 | endlocal 13 | -------------------------------------------------------------------------------- /device-simulation/scripts/docker/publish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Note: use lowercase names for the Docker images 7 | DOCKER_IMAGE="azureiotpcs/device-simulation-dotnet" 8 | # "testing" is the latest dev build, usually matching the code in the "master" branch 9 | DOCKER_TAG="$DOCKER_IMAGE:testing" 10 | 11 | docker push $DOCKER_TAG 12 | -------------------------------------------------------------------------------- /device-telemetry/test/helpers/SlowTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface SlowTest { 10 | /* 11 | Category marker, usage: 12 | 13 | @Category({SlowTest.class, ...}) 14 | public void testName() { 15 | // test code 16 | } 17 | */ 18 | } 19 | -------------------------------------------------------------------------------- /device-telemetry/test/helpers/UnitTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface UnitTest { 10 | /* 11 | Category marker, usage: 12 | 13 | @Category({UnitTests.class, ...}) 14 | public void testName() { 15 | // test code 16 | } 17 | */ 18 | } 19 | -------------------------------------------------------------------------------- /iothub-manager/docs/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # For more info see https://help.github.com/articles/about-codeowners 2 | 3 | # Order is important; the last matching pattern takes the most precedence. 4 | 5 | LICENSE @timlaverty @dluc @ppathan 6 | 7 | .gitattributes @dluc @timlaverty 8 | .travis.yml @dluc @timlaverty 9 | 10 | scripts/ @dluc @timlaverty @ppathan 11 | 12 | app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/auth/ @dluc @timlaverty 13 | -------------------------------------------------------------------------------- /iothub-manager/scripts/iothub/list-hubs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | main() { 8 | check_dependencies 9 | login 10 | 11 | header "Azure IoT Hubs in the current subscription" 12 | az iot hub list | jq '.[] | {name: .name, resourcegroup: .resourcegroup, location: .location, subscription: .subscriptionid}' | jq . 13 | } 14 | 15 | main 16 | -------------------------------------------------------------------------------- /iothub-manager/test/helpers/SlowTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface SlowTest { 10 | /* 11 | Category marker, usage: 12 | 13 | @Category({SlowTest.class, ...}) 14 | public void testName() { 15 | // test code 16 | } 17 | */ 18 | } 19 | -------------------------------------------------------------------------------- /iothub-manager/test/helpers/UnitTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface UnitTest { 10 | /* 11 | Category marker, usage: 12 | 13 | @Category({UnitTests.class, ...}) 14 | public void testName() { 15 | // test code 16 | } 17 | */ 18 | } 19 | -------------------------------------------------------------------------------- /storage-adapter/scripts/iothub/list-hubs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | main() { 8 | check_dependencies 9 | login 10 | 11 | header "Azure IoT Hubs in the current subscription" 12 | az iot hub list | jq '.[] | {name: .name, resourcegroup: .resourcegroup, location: .location, subscription: .subscriptionid}' | jq . 13 | } 14 | 15 | main 16 | -------------------------------------------------------------------------------- /storage-adapter/test/helpers/SlowTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface SlowTest { 10 | /* 11 | Category marker, usage: 12 | 13 | @Category({SlowTest.class, ...}) 14 | public void testName() { 15 | // test code 16 | } 17 | */ 18 | } 19 | -------------------------------------------------------------------------------- /storage-adapter/test/helpers/UnitTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface UnitTest { 10 | /* 11 | Category marker, usage: 12 | 13 | @Category({UnitTests.class, ...}) 14 | public void testName() { 15 | // test code 16 | } 17 | */ 18 | } 19 | -------------------------------------------------------------------------------- /config/test/helpers/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface IntegrationTest { 10 | /* 11 | Category marker, usage: 12 | @Category({IntegrationTest.class, ...}) 13 | public void testName() { 14 | // test code 15 | } 16 | */ 17 | } 18 | -------------------------------------------------------------------------------- /device-telemetry/scripts/package: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 6 | source "$APP_HOME/scripts/.functions.sh" 7 | 8 | sbt_package() { 9 | check_dependency_java 10 | 11 | cd $APP_HOME 12 | chmod +x sbt 13 | ./sbt assembly && echo -n "Package available at: " && echo $(find target/scala-2.12 -name *.jar |grep assembly) 14 | } 15 | 16 | sbt_package 17 | 18 | set +e 19 | -------------------------------------------------------------------------------- /storage-adapter/.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # For more info see https://help.github.com/articles/about-codeowners 2 | 3 | # Order is important; the last matching pattern takes the most precedence. 4 | 5 | LICENSE @timlaverty @dluc @ppathan 6 | 7 | .gitattributes @dluc @timlaverty 8 | .travis.yml @dluc @timlaverty 9 | 10 | scripts/ @dluc @timlaverty @ppathan 11 | 12 | app/com/microsoft/azure/iotsolutions/storageadapter/webservice/auth/ @dluc @timlaverty 13 | -------------------------------------------------------------------------------- /device-simulation/scripts/docker/publish.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | @ECHO off & setlocal enableextensions enabledelayedexpansion 4 | 5 | :: Note: use lowercase names for the Docker images 6 | SET DOCKER_IMAGE="azureiotpcs/device-simulation-dotnet" 7 | :: "testing" is the latest dev build, usually matching the code in the "master" branch 8 | SET DOCKER_TAG=%DOCKER_IMAGE%:testing 9 | 10 | docker push %DOCKER_TAG% 11 | 12 | endlocal 13 | -------------------------------------------------------------------------------- /device-telemetry/test/helpers/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface IntegrationTest { 10 | /* 11 | Category marker, usage: 12 | @Category({IntegrationTest.class, ...}) 13 | public void testName() { 14 | // test code 15 | } 16 | */ 17 | } 18 | -------------------------------------------------------------------------------- /iothub-manager/test/helpers/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface IntegrationTest { 10 | /* 11 | Category marker, usage: 12 | @Category({IntegrationTest.class, ...}) 13 | public void testName() { 14 | // test code 15 | } 16 | */ 17 | } 18 | -------------------------------------------------------------------------------- /scripts/git/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 5 | 6 | failed() { 7 | echo "Git hooks setup failed" 8 | exit 1 9 | } 10 | 11 | cd $APP_HOME/.git || failed 12 | mkdir -p hooks || failed 13 | cd hooks || failed 14 | 15 | echo "Adding pre-commit hook..." 16 | rm -f pre-commit 17 | cp -p $APP_HOME/scripts/git/pre-commit-runner.sh ./pre-commit || failed 18 | 19 | echo "Done." 20 | -------------------------------------------------------------------------------- /storage-adapter/test/helpers/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package helpers; 4 | 5 | /** 6 | * Use this flag to allow running a subset of tests from the test explorer 7 | * and the command line. 8 | */ 9 | public interface IntegrationTest { 10 | /* 11 | Category marker, usage: 12 | @Category({IntegrationTest.class, ...}) 13 | public void testName() { 14 | // test code 15 | } 16 | */ 17 | } 18 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/models/actions/IActionSettings.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.models.actions; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | import java.util.TreeMap; 8 | 9 | @ImplementedBy(EmailActionSettings.class) 10 | public interface IActionSettings { 11 | ActionType getType(); 12 | 13 | TreeMap getSettings(); 14 | } 15 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/v1/controllers/README.md: -------------------------------------------------------------------------------- 1 | Web service controllers 2 | ======================= 3 | 4 | ## Guidelines 5 | 6 | * Always access external services through logic in the service layer. 7 | * Consume Azure IoT SDK code through the service layer, i.e. do not reference 8 | classes from the Azure IoT SDK (or other SDKs). 9 | 10 | ## Conventions 11 | 12 | * Version controllers and models together (e.v. under 'v1' package). 13 | -------------------------------------------------------------------------------- /scripts/local/launch/os/osx/set-env-uri.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | launchctl setenv PCS_TELEMETRY_WEBSERVICE_URL "http://localhost:9004/v1" 4 | launchctl setenv PCS_CONFIG_WEBSERVICE_URL "http://localhost:9005/v1" 5 | launchctl setenv PCS_IOTHUBMANAGER_WEBSERVICE_URL "http://localhost:9002/v1" 6 | launchctl setenv PCS_STORAGEADAPTER_WEBSERVICE_URL "http://localhost:9022/v1" 7 | launchctl setenv PCS_AUTH_WEBSERVICE_URL "http://localhost:9001/v1" 8 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/README.md: -------------------------------------------------------------------------------- 1 | Service layer 2 | ============= 3 | 4 | ## Guidelines 5 | 6 | * The service layer is responsible for the business logic of the microservice 7 | and for dealing with external dependencies like storage, IoT Hub, etc. 8 | * The service layer has no knowledge of the web service or other entry points. 9 | 10 | ## Conventions 11 | 12 | * Configuration is injected into the service layer by the entry point projects. 13 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/external/PackageValidation/EdgePackageValidator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.external.PackageValidation; 4 | 5 | public class EdgePackageValidator extends PackageValidator{ 6 | 7 | // TODO: Implement validation for Edge packages 8 | @Override 9 | public Boolean validate() { 10 | return true; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/runtime/IActionsConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.runtime; 4 | 5 | public interface IActionsConfig { 6 | 7 | String getOffice365LogicAppUrl(); 8 | 9 | String getResourceGroup(); 10 | 11 | String getSubscriptionId(); 12 | 13 | String getManagementApiVersion(); 14 | 15 | String getArmEndpointUrl(); 16 | } 17 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/runtime/IConfigData.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.iotsolutions.uiconfig.services.runtime; 2 | 3 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.InvalidConfigurationException; 4 | 5 | public interface IConfigData { 6 | String getString(String key); 7 | boolean getBool(String key); 8 | int getInt(String key) throws InvalidConfigurationException; 9 | boolean hasPath(String path); 10 | } 11 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/actionsagent/IAgent.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.actionsagent; 4 | 5 | import java.util.concurrent.CompletionStage; 6 | 7 | /** 8 | * Agent running for ever in the background 9 | */ 10 | public interface IAgent { 11 | /** 12 | * @return the new CompletionStage 13 | */ 14 | CompletionStage runAsync(); 15 | } 16 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/README.md: -------------------------------------------------------------------------------- 1 | Service layer 2 | ============= 3 | 4 | ## Guidelines 5 | 6 | * The service layer is responsible for the business logic of the microservice 7 | and for dealing with external dependencies like storage 8 | * The service layer has no knowledge of the web service or other entry points. 9 | 10 | ## Conventions 11 | 12 | * Configuration is injected into the service layer by the entry point projects. 13 | -------------------------------------------------------------------------------- /asa-manager/scripts/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.0.3-runtime-jessie 2 | 3 | MAINTAINER Devis Lucato (https://github.com/dluc) 4 | 5 | LABEL Tags="Azure,IoT,Solutions,ASA,Azure Stream Analytics,.NET" 6 | 7 | COPY . /app/ 8 | WORKDIR /app 9 | 10 | RUN \ 11 | # Ensures the entry point is executable 12 | chmod ugo+x /app/run.sh && \ 13 | # Clean up destination folder 14 | rm -f /app/Dockerfile /app/.dockerignore 15 | 16 | ENTRYPOINT ["/bin/bash", "/app/run.sh"] 17 | -------------------------------------------------------------------------------- /config/.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # For more info see https://help.github.com/articles/about-codeowners 2 | 3 | # Order is important; the last matching pattern takes the most precedence. 4 | 5 | LICENSE @timlaverty @dluc @ppathan 6 | 7 | .gitattributes @dluc @timlaverty 8 | .travis.yml @dluc @timlaverty 9 | 10 | scripts/ @dluc @timlaverty @ppathan 11 | 12 | WebService/Auth/ @dluc @timlaverty 13 | 14 | app/com/microsoft/azure/iotsolutions/uiconfig/webservice/auth/ @dluc @timlaverty 15 | -------------------------------------------------------------------------------- /config/app/resources/content/DefaultLogo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Asset 8 4 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/v1/controllers/README.md: -------------------------------------------------------------------------------- 1 | Web service controllers 2 | ======================= 3 | 4 | ## Guidelines 5 | 6 | * Always access external services through logic in the service layer. 7 | * Consume Azure IoT SDK code through the service layer, i.e. do not reference 8 | classes from the Azure IoT SDK (or other SDKs). 9 | 10 | ## Conventions 11 | 12 | * Version controllers and models together (e.v. under 'v1' package). 13 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/webservice/v1/controllers/README.md: -------------------------------------------------------------------------------- 1 | Web service controllers 2 | ======================= 3 | 4 | ## Guidelines 5 | 6 | * Always access external services through logic in the service layer. 7 | * Consume Azure IoT SDK code through the service layer, i.e. do not reference 8 | classes from the Azure IoT SDK (or other SDKs). 9 | 10 | ## Conventions 11 | 12 | * Version controllers and models together (e.v. under 'v1' package). 13 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/README.md: -------------------------------------------------------------------------------- 1 | Service layer 2 | ============= 3 | 4 | ## Guidelines 5 | 6 | * The service layer is responsible for the business logic of the microservice 7 | and for dealing with external dependencies like storage, IoT Hub, etc. 8 | * The service layer has no knowledge of the web service or other entry points. 9 | 10 | ## Conventions 11 | 12 | * Configuration is injected into the service layer by the entry point projects. 13 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/README.md: -------------------------------------------------------------------------------- 1 | Service layer 2 | ============= 3 | 4 | ## Guidelines 5 | 6 | * The service layer is responsible for the business logic of the microservice 7 | and for dealing with external dependencies like storage, IoT Hub, etc. 8 | * The service layer has no knowledge of the web service or other entry points. 9 | 10 | ## Conventions 11 | 12 | * Configuration is injected into the service layer by the entry point projects. 13 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/external/PackageValidation/FirmwareValidator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.external.PackageValidation; 4 | 5 | public class FirmwareValidator extends PackageValidator { 6 | 7 | // TODO: Implement validation for Firmware Update for Firmware packages 8 | @Override 9 | public Boolean validate() { 10 | return true; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/local/launch/start-dotnet-only-services.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | set BAT_DIR=%~dp0 3 | cd %BAT_DIR% 4 | cd ..\..\..\ 5 | set APP_HOME=%cd% 6 | 7 | call %APP_HOME%\scripts\local\launch\set_env.cmd 8 | call %APP_HOME%\scripts\local\launch\.env_uris.cmd 9 | 10 | cd %APP_HOME%\device-simulation\scripts\docker 11 | START "" run.cmd 12 | cd %APP_HOME%\asa-manager\scripts\docker 13 | START "" run.cmd 14 | cd %APP_HOME%\auth\scripts\docker 15 | START "" run.cmd 16 | 17 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/models/README.md: -------------------------------------------------------------------------------- 1 | Service layer models 2 | ==================== 3 | 4 | ## Guidelines 5 | 6 | * Do not reference classes from the "webservice" package. 7 | * Ensure datetime values are transfered using UTC timezone. 8 | * Use `DateTime.parse(lastActivity, ISODateTimeFormat.dateTimeParser().withZoneUTC())` 9 | to parse datetime values returned by Azure IoT SDK. 10 | 11 | ## Conventions 12 | 13 | * For DateTime fields use org.joda.time.DateTime. 14 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/external/ValueListApiModel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.external; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | import java.util.Hashtable; 8 | 9 | public class ValueListApiModel { 10 | 11 | public Iterable Items; 12 | 13 | @JsonProperty("$metadata") 14 | public Hashtable Metadata; 15 | } 16 | -------------------------------------------------------------------------------- /config/scripts/docker/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/.functions.sh" 8 | 9 | sbt_build_docker_image() { 10 | check_dependency_docker 11 | 12 | cd $APP_HOME 13 | chmod +x sbt 14 | ./sbt docker:publishLocal 15 | } 16 | 17 | sbt_build_docker_image 18 | 19 | set +e 20 | -------------------------------------------------------------------------------- /device-simulation/scripts/env-vars-check.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | @ECHO off & setlocal enableextensions enabledelayedexpansion 4 | 5 | IF "%PCS_IOTHUB_CONNSTRING%" == "" ( 6 | echo Error: the PCS_IOTHUB_CONNSTRING environment variable is not defined. 7 | exit /B 1 8 | ) 9 | 10 | IF "%PCS_STORAGEADAPTER_WEBSERVICE_URL%" == "" ( 11 | echo Error: the PCS_STORAGEADAPTER_WEBSERVICE_URL environment variable is not defined. 12 | exit /B 1 13 | ) 14 | 15 | endlocal 16 | -------------------------------------------------------------------------------- /device-telemetry/.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # For more info see https://help.github.com/articles/about-codeowners 2 | 3 | # Order is important; the last matching pattern takes the most precedence. 4 | 5 | LICENSE @jillcary @dluc @timlaverty @ppathan 6 | 7 | .gitattributes @dluc @timlaverty 8 | .travis.yml @dluc @timlaverty 9 | 10 | scripts/ @dluc @timlaverty @ppathan 11 | 12 | WebService/Auth/ @dluc @timlaverty 13 | 14 | app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/auth/ @dluc @timlaverty -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/runtime/IConfigData.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.iotsolutions.storageadapter.services.runtime; 2 | 3 | import com.microsoft.azure.iotsolutions.storageadapter.services.exceptions.InvalidConfigurationException; 4 | 5 | public interface IConfigData { 6 | String getString(String key); 7 | boolean getBool(String key); 8 | int getInt(String key) throws InvalidConfigurationException; 9 | boolean hasPath(String path); 10 | } 11 | -------------------------------------------------------------------------------- /config/scripts/docker/publish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/.functions.sh" 8 | 9 | sbt_publish_docker_image() { 10 | check_dependency_docker 11 | 12 | cd $APP_HOME 13 | chmod +x sbt 14 | ./sbt docker:publish 15 | } 16 | 17 | sbt_publish_docker_image 18 | 19 | set +e 20 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/runtime/IConfigData.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.runtime; 2 | 3 | import com.microsoft.azure.iotsolutions.devicetelemetry.services.exceptions.InvalidConfigurationException; 4 | 5 | public interface IConfigData { 6 | String getString(String key); 7 | boolean getBool(String key); 8 | int getInt(String key) throws InvalidConfigurationException; 9 | boolean hasPath(String path); 10 | } 11 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/models/README.md: -------------------------------------------------------------------------------- 1 | Service layer models 2 | ==================== 3 | 4 | ## Guidelines 5 | 6 | * Do not reference classes from the "webservice" package. 7 | * Ensure datetime values are transfered using UTC timezone. 8 | * Use `DateTime.parse(lastActivity, ISODateTimeFormat.dateTimeParser().withZoneUTC())` 9 | to parse datetime values returned by Azure IoT SDK. 10 | 11 | ## Conventions 12 | 13 | * For DateTime fields use org.joda.time.DateTime. 14 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/models/README.md: -------------------------------------------------------------------------------- 1 | Service layer models 2 | ==================== 3 | 4 | ## Guidelines 5 | 6 | * Do not reference classes from the "webservice" package. 7 | * Ensure datetime values are transfered using UTC timezone. 8 | * Use `DateTime.parse(lastActivity, ISODateTimeFormat.dateTimeParser().withZoneUTC())` 9 | to parse datetime values returned by Azure IoT SDK. 10 | 11 | ## Conventions 12 | 13 | * For DateTime fields use org.joda.time.DateTime. 14 | -------------------------------------------------------------------------------- /storage-adapter/scripts/docker/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/.functions.sh" 8 | 9 | sbt_build_docker_image() { 10 | check_dependency_docker 11 | 12 | cd $APP_HOME 13 | chmod +x sbt 14 | ./sbt docker:publishLocal 15 | } 16 | 17 | sbt_build_docker_image 18 | 19 | set +e 20 | -------------------------------------------------------------------------------- /storage-adapter/scripts/docker/publish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/.functions.sh" 8 | 9 | sbt_publish_docker_image() { 10 | check_dependency_docker 11 | 12 | cd $APP_HOME 13 | chmod +x sbt 14 | ./sbt docker:publish 15 | } 16 | 17 | sbt_publish_docker_image 18 | 19 | set +e 20 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/external/ValueListApiModel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.external; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | import java.util.Hashtable; 8 | 9 | public class ValueListApiModel { 10 | 11 | public Iterable Items; 12 | 13 | @JsonProperty("$metadata") 14 | public Hashtable Metadata; 15 | } 16 | -------------------------------------------------------------------------------- /iothub-manager/scripts/docker/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | 5 | set -e 6 | 7 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 8 | source "$APP_HOME/scripts/.functions.sh" 9 | 10 | sbt_build_docker_image() { 11 | check_dependency_docker 12 | 13 | cd $APP_HOME 14 | chmod +x sbt 15 | ./sbt docker:publishLocal 16 | } 17 | 18 | sbt_build_docker_image 19 | 20 | set +e 21 | -------------------------------------------------------------------------------- /iothub-manager/scripts/docker/publish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | 5 | set -e 6 | 7 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 8 | source "$APP_HOME/scripts/.functions.sh" 9 | 10 | sbt_publish_docker_image() { 11 | check_dependency_docker 12 | 13 | cd $APP_HOME 14 | chmod +x sbt 15 | ./sbt docker:publish 16 | } 17 | 18 | sbt_publish_docker_image 19 | 20 | set +e 21 | -------------------------------------------------------------------------------- /iothub-manager/scripts/clean-up: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash -e 2 | 3 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 4 | source "$APP_HOME/scripts/.functions.sh" 5 | 6 | if [[ ${#APP_HOME} -lt 20 ]]; then 7 | error "Unable to detect current folder. Aborting." 8 | exit -1 9 | fi 10 | 11 | cd $APP_HOME 12 | 13 | header "Removing temporary folders and files..." 14 | 15 | rm -fR ./target/ 16 | rm -fR ./logs/ 17 | rm -fR ./project/target/ 18 | rm -fR ./project/project/ 19 | 20 | echo -e "\nDone" 21 | 22 | set +e 23 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/ISeed.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.ExternalDependencyException; 7 | 8 | import java.util.concurrent.CompletionStage; 9 | 10 | @ImplementedBy(Seed.class) 11 | public interface ISeed { 12 | CompletionStage trySeedAsync() throws ExternalDependencyException; 13 | } 14 | -------------------------------------------------------------------------------- /config/scripts/env-vars-check: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | 4 | if [[ -z "$PCS_KEYVAULT_NAME" ]]; then 5 | echo "Error: the PCS_KEYVAULT_NAME environment variable is not defined." 6 | exit 1 7 | fi 8 | 9 | if [[ -z "$PCS_AAD_APPID" ]]; then 10 | echo "Error: the PCS_AAD_APPID environment variable is not defined." 11 | exit 1 12 | fi 13 | 14 | if [[ -z "$PCS_AAD_APPSECRET" ]]; then 15 | echo "Error: the PCS_AAD_APPSECRET environment variable is not defined." 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /iothub-manager/test/com/microsoft/azure/iotsolutions/iothubmanager/webservice/runtime/ConfigTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.runtime; 4 | 5 | import org.junit.After; 6 | import org.junit.Before; 7 | 8 | public class ConfigTest { 9 | 10 | @Before 11 | public void setUp() { 12 | // something before every test 13 | } 14 | 15 | @After 16 | public void tearDown() { 17 | // something after every test 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /scripts/git/setup.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | setlocal 3 | 4 | :: strlen("\scripts\git\") => 13 5 | SET APP_HOME=%~dp0 6 | SET APP_HOME=%APP_HOME:~0,-13% 7 | 8 | cd %APP_HOME% 9 | 10 | echo Adding pre-commit hook... 11 | 12 | mkdir .git\hooks\ 2> nul 13 | del /F .git\hooks\pre-commit 2> nul 14 | copy scripts\git\pre-commit-runner.sh .git\hooks\pre-commit 15 | IF NOT ERRORLEVEL 0 GOTO FAIL 16 | 17 | echo Done. 18 | 19 | :: - - - - - - - - - - - - - - 20 | goto :END 21 | 22 | :FAIL 23 | echo Command failed 24 | endlocal 25 | exit /B 1 26 | 27 | :END 28 | endlocal -------------------------------------------------------------------------------- /device-telemetry/scripts/clean-up: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 6 | source "$APP_HOME/scripts/.functions.sh" 7 | 8 | if [[ ${#APP_HOME} -lt 20 ]]; then 9 | error "Unable to detect current folder. Aborting." 10 | exit -1 11 | fi 12 | 13 | cd $APP_HOME 14 | 15 | header "Removing temporary folders and files..." 16 | 17 | rm -fR ./target/ 18 | rm -fR ./logs/ 19 | rm -fR ./project/target/ 20 | rm -fR ./project/project/ 21 | 22 | echo -e "\nDone" 23 | 24 | set +e 25 | -------------------------------------------------------------------------------- /device-telemetry/scripts/env-vars-check: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | 4 | if [[ -z "$PCS_KEYVAULT_NAME" ]]; then 5 | echo "Error: the PCS_KEYVAULT_NAME environment variable is not defined." 6 | exit 1 7 | fi 8 | 9 | if [[ -z "$PCS_AAD_APPID" ]]; then 10 | echo "Error: the PCS_AAD_APPID environment variable is not defined." 11 | exit 1 12 | fi 13 | 14 | if [[ -z "$PCS_AAD_APPSECRET" ]]; then 15 | echo "Error: the PCS_AAD_APPSECRET environment variable is not defined." 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /docs/CODEOWNER: -------------------------------------------------------------------------------- 1 | 2 | # For more info see https://help.github.com/articles/about-codeowners 3 | 4 | # Order is important; the last matching pattern takes the most precedence. 5 | 6 | * @timlaverty @dluc @ppathan 7 | 8 | LICENSE @timlaverty @dluc @ppathan 9 | iothub-manager @molly-moen @sushilraje 10 | device-telemetry @molly-moen @jillcary 11 | storage-adapter @sushilraje @isaac73 12 | asa-manager @zhang-hua @molly-moen 13 | auth @elvinm @jillcary 14 | config @isaac73 @zhang-hua 15 | -------------------------------------------------------------------------------- /iothub-manager/scripts/env-vars-check: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | 4 | if [[ -z "$PCS_KEYVAULT_NAME" ]]; then 5 | echo "Error: the PCS_KEYVAULT_NAME environment variable is not defined." 6 | exit 1 7 | fi 8 | 9 | if [[ -z "$PCS_AAD_APPID" ]]; then 10 | echo "Error: the PCS_AAD_APPID environment variable is not defined." 11 | exit 1 12 | fi 13 | 14 | if [[ -z "$PCS_AAD_APPSECRET" ]]; then 15 | echo "Error: the PCS_AAD_APPSECRET environment variable is not defined." 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /storage-adapter/scripts/env-vars-check: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | 4 | if [[ -z "$PCS_KEYVAULT_NAME" ]]; then 5 | echo "Error: the PCS_KEYVAULT_NAME environment variable is not defined." 6 | exit 1 7 | fi 8 | 9 | if [[ -z "$PCS_AAD_APPID" ]]; then 10 | echo "Error: the PCS_AAD_APPID environment variable is not defined." 11 | exit 1 12 | fi 13 | 14 | if [[ -z "$PCS_AAD_APPSECRET" ]]; then 15 | echo "Error: the PCS_AAD_APPSECRET environment variable is not defined." 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /config/scripts/package: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/.functions.sh" 8 | 9 | sbt_package() { 10 | check_dependency_java 11 | 12 | cd $APP_HOME 13 | chmod +x sbt 14 | ./sbt assembly && echo -n "Package available at: " && echo $(find target/scala-2.12 -name *.jar |grep assembly) 15 | } 16 | 17 | sbt_package 18 | 19 | set +e 20 | -------------------------------------------------------------------------------- /asa-manager/scripts/asa/functions/applyRuleFilter.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // This function is called in the shape of 'udf.applyRuleFilter(record)' 3 | // from ASA query. The JavaScript code snippet encoded as one line string 4 | // in '__rulefilterjs' will be used to construct a Function callback and 5 | // evaluated by ASA and return the result to the ASA query to filter the 6 | // incoming record. 7 | function main(record) { 8 | let ruleFunction = new Function('record', record.__rulefilterjs); 9 | return ruleFunction(record); 10 | } -------------------------------------------------------------------------------- /config/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto-detect text files, ensure they use LF. 2 | * text=auto eol=lf 3 | 4 | # Bash scripts 5 | sbt text eol=lf 6 | *.sh text eol=lf 7 | *.bash text eol=lf 8 | scripts/build text eol=lf 9 | scripts/clean-up text eol=lf 10 | scripts/compile text eol=lf 11 | scripts/env-vars-check text eol=lf 12 | scripts/env-vars-setup text eol=lf 13 | scripts/package text eol=lf 14 | scripts/run text eol=lf 15 | scripts/sbt-dist/bin/sbt text eol=lf 16 | scripts/docker/build text eol=lf 17 | scripts/docker/publish text eol=lf 18 | scripts/docker/run text eol=lf 19 | -------------------------------------------------------------------------------- /config/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Type of change? 2 | 3 | - [ ] Bug fix 4 | - [ ] New feature 5 | - [ ] Enhancement 6 | - [ ] Breaking change (breaks backward compatibility) 7 | 8 | # Description, Context, Motivation 9 | 10 | ... 11 | 12 | **Checklist:** 13 | 14 | - [ ] All tests passed 15 | - [ ] The code follows the code style and conventions of this project 16 | - [ ] The change requires a change to the documentation 17 | - [ ] I have updated the documentation accordingly 18 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/auth/IJwtValidation.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.auth; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | @ImplementedBy(OpenIdConnectJwtValidation.class) 8 | public interface IJwtValidation { 9 | Boolean validateToken(String token) throws InvalidConfigurationException, ExternalDependencyException; 10 | UserClaims getUserClaims(String token) throws NotAuthorizedException; 11 | } 12 | -------------------------------------------------------------------------------- /iothub-manager/iothub-manager.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/external/PackageValidation/IPackageValidator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.external.PackageValidation; 4 | 5 | import com.fasterxml.jackson.databind.JsonNode; 6 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.InvalidInputException; 7 | 8 | public interface IPackageValidator { 9 | JsonNode getPackageContent(String pckg) throws InvalidInputException; 10 | 11 | Boolean validate(); 12 | } 13 | -------------------------------------------------------------------------------- /iothub-manager/docs/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Type of change? 2 | 3 | - [ ] Bug fix 4 | - [ ] New feature 5 | - [ ] Enhancement 6 | - [ ] Breaking change (breaks backward compatibility) 7 | 8 | # Description, Context, Motivation 9 | 10 | ... 11 | 12 | **Checklist:** 13 | 14 | - [ ] All tests passed 15 | - [ ] The code follows the code style and conventions of this project 16 | - [ ] The change requires a change to the documentation 17 | - [ ] I have updated the documentation accordingly 18 | -------------------------------------------------------------------------------- /storage-adapter/scripts/package: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/.functions.sh" 8 | 9 | sbt_package() { 10 | check_dependency_java 11 | 12 | cd $APP_HOME 13 | chmod +x sbt 14 | ./sbt assembly && echo -n "Package available at: " && echo $(find target/scala-2.12 -name *.jar |grep assembly) 15 | } 16 | 17 | sbt_package 18 | 19 | set +e 20 | -------------------------------------------------------------------------------- /device-telemetry/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto-detect text files, ensure they use LF. 2 | * text=auto eol=lf 3 | 4 | # Bash scripts 5 | sbt text eol=lf 6 | *.sh text eol=lf 7 | *.bash text eol=lf 8 | scripts/build text eol=lf 9 | scripts/clean-up text eol=lf 10 | scripts/compile text eol=lf 11 | scripts/env-vars-check text eol=lf 12 | scripts/env-vars-setup text eol=lf 13 | scripts/package text eol=lf 14 | scripts/run text eol=lf 15 | scripts/sbt-dist/bin/sbt text eol=lf 16 | scripts/docker/build text eol=lf 17 | scripts/docker/publish text eol=lf 18 | scripts/docker/run text eol=lf 19 | -------------------------------------------------------------------------------- /device-telemetry/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Type of change? 2 | 3 | - [ ] Bug fix 4 | - [ ] New feature 5 | - [ ] Enhancement 6 | - [ ] Breaking change (breaks backward compatibility) 7 | 8 | # Description, Context, Motivation 9 | 10 | ... 11 | 12 | **Checklist:** 13 | 14 | - [ ] All tests passed 15 | - [ ] The code follows the code style and conventions of this project 16 | - [ ] The change requires a change to the documentation 17 | - [ ] I have updated the documentation accordingly 18 | -------------------------------------------------------------------------------- /device-telemetry/test/data/EmailTemplate.html: -------------------------------------------------------------------------------- 1 |

${subject}

Details

Time Triggered: ${alarmDate}

Rule Id: ${ruleId}

Rule Description: ${ruleDescription}

Severity: ${ruleSeverity}

Device Id: ${deviceId}

Notes

${notes}

See alert and device details here

-------------------------------------------------------------------------------- /storage-adapter/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto-detect text files, ensure they use LF. 2 | * text=auto eol=lf 3 | 4 | # Bash scripts 5 | sbt text eol=lf 6 | *.sh text eol=lf 7 | *.bash text eol=lf 8 | scripts/build text eol=lf 9 | scripts/clean-up text eol=lf 10 | scripts/compile text eol=lf 11 | scripts/env-vars-check text eol=lf 12 | scripts/env-vars-setup text eol=lf 13 | scripts/package text eol=lf 14 | scripts/run text eol=lf 15 | scripts/sbt-dist/bin/sbt text eol=lf 16 | scripts/docker/build text eol=lf 17 | scripts/docker/publish text eol=lf 18 | scripts/docker/run text eol=lf 19 | -------------------------------------------------------------------------------- /storage-adapter/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Type of change? 2 | 3 | - [ ] Bug fix 4 | - [ ] New feature 5 | - [ ] Enhancement 6 | - [ ] Breaking change (breaks backward compatibility) 7 | 8 | # Description, Context, Motivation 9 | 10 | ... 11 | 12 | **Checklist:** 13 | 14 | - [ ] All tests passed 15 | - [ ] The code follows the code style and conventions of this project 16 | - [ ] The change requires a change to the documentation 17 | - [ ] I have updated the documentation accordingly 18 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/runtime/IServicesConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.runtime; 4 | 5 | public interface IServicesConfig { 6 | 7 | String getAzureMapsKey(); 8 | 9 | String getSeedTemplate(); 10 | 11 | String getStorageAdapterApiUrl(); 12 | 13 | String getDeviceSimulationApiUrl(); 14 | 15 | String getTelemetryApiUrl(); 16 | 17 | String getUserManagementApiUrl(); 18 | 19 | IActionsConfig getActionsConfig(); 20 | } 21 | -------------------------------------------------------------------------------- /device-telemetry/app/resources/data/EmailTemplate.html: -------------------------------------------------------------------------------- 1 |

${subject}

Details

Time Triggered: ${alarmDate}

Rule Id: ${ruleId}

Rule Description: ${ruleDescription}

Severity: ${ruleSeverity}

Device Id: ${deviceId}

Notes

${notes}

See alert and device details here

-------------------------------------------------------------------------------- /iothub-manager/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto-detect text files, ensure they use LF. 2 | * text=auto eol=lf 3 | 4 | # Bash scripts 5 | sbt text eol=lf 6 | *.sh text eol=lf 7 | *.bash text eol=lf 8 | scripts/build text eol=lf 9 | scripts/clean-up text eol=lf 10 | scripts/compile text eol=lf 11 | scripts/env-vars-check text eol=lf 12 | scripts/env-vars-setup text eol=lf 13 | scripts/package text eol=lf 14 | scripts/run text eol=lf 15 | scripts/sbt-dist/bin/sbt text eol=lf 16 | 17 | scripts/docker/build text eol=lf 18 | scripts/docker/publish text eol=lf 19 | scripts/docker/run text eol=lf 20 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/http/IHttpResponse.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.http; 4 | 5 | import org.apache.http.Header; 6 | 7 | public interface IHttpResponse { 8 | 9 | int getStatusCode(); 10 | 11 | Header[] getHeaders(); 12 | 13 | String getContent(); 14 | 15 | boolean getIsRetriableError(); 16 | 17 | default boolean isSuccessStatusCode() { 18 | return (getStatusCode() >= 200) && (getStatusCode() <= 299); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/IStatusService.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.uiconfig.services.models.StatusServiceModel; 7 | 8 | @ImplementedBy(StatusService.class) 9 | public interface IStatusService { 10 | /** 11 | * Get status of dependent services. 12 | * 13 | * @return Connection StatusServiceModel 14 | */ 15 | StatusServiceModel getStatus(); 16 | } 17 | -------------------------------------------------------------------------------- /iothub-manager/iothub-manager-java.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /scripts/docker/README.md: -------------------------------------------------------------------------------- 1 | How to launch the solution using Docker Compose 2 | =============================================== 3 | 4 | 1. Install Docker and Docker Compose 5 | 1. https://docs.docker.com/engine/installation 6 | 2. https://docs.docker.com/compose/install 7 | 2. Set all the environment variables in the 8 | docker-compose.yml file, directly in the file 9 | or in your system. 10 | 3. Open a console and go into the folder containing 11 | the [docker-compose.yml](docker-compose.yml) file. 12 | 4. Run `docker-compose up` 13 | 5. Open the browser at http://127.0.0.1:10080 14 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/exceptions/SeedException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.exceptions; 4 | 5 | /** 6 | * Checked exception for invalid user input 7 | */ 8 | public class SeedException extends BaseException { 9 | public SeedException() { 10 | } 11 | 12 | public SeedException(String message) { 13 | super(message); 14 | } 15 | 16 | public SeedException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/auth/Authorize.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.webservice.auth; 4 | 5 | import play.mvc.*; 6 | import java.lang.annotation.ElementType; 7 | import java.lang.annotation.Retention; 8 | import java.lang.annotation.RetentionPolicy; 9 | import java.lang.annotation.Target; 10 | 11 | @With(AuthorizeAction.class) 12 | @Target({ElementType.TYPE, ElementType.METHOD}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface Authorize { 15 | String value(); 16 | } -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/exceptions/NotAuthorizedException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.exceptions; 4 | 5 | public class NotAuthorizedException extends Exception { 6 | public NotAuthorizedException() { 7 | } 8 | 9 | public NotAuthorizedException(String message) { 10 | super(message); 11 | } 12 | 13 | public NotAuthorizedException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/wrappers/IFactory.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services.wrappers; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.documentdb.DocumentClientException; 7 | import com.microsoft.azure.iotsolutions.storageadapter.services.exceptions.CreateResourceException; 8 | 9 | @ImplementedBy(DocumentClientFactory.class) 10 | public interface IFactory { 11 | T create() throws CreateResourceException; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /config/scripts/env-vars-check.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | @ECHO off & setlocal enableextensions enabledelayedexpansion 4 | 5 | IF "%PCS_KEYVAULT_NAME%" == "" ( 6 | echo Error: the PCS_IOTHUB_CONNSTRING environment variable is not defined. 7 | exit /B 1 8 | ) 9 | 10 | IF "%PCS_AAD_APPID%" == "" ( 11 | echo Error: the PCS_AAD_APPID environment variable is not defined. 12 | exit /B 1 13 | ) 14 | 15 | IF "%PCS_AAD_APPSECRET%" == "" ( 16 | echo Error: the PCS_AAD_APPSECRET environment variable is not defined. 17 | exit /B 1 18 | ) 19 | 20 | endlocal 21 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/models/ConfigType.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.iotsolutions.iothubmanager.services.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonValue; 4 | 5 | public enum ConfigType { 6 | firmware("Firmware"); 7 | 8 | private final String value; 9 | 10 | ConfigType(String value) { 11 | this.value = value; 12 | } 13 | 14 | @JsonValue 15 | public String getValue() { 16 | return value; 17 | } 18 | 19 | public String toString() { 20 | return getValue(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /device-telemetry/scripts/env-vars-check.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | @ECHO off & setlocal enableextensions enabledelayedexpansion 4 | 5 | IF "%PCS_KEYVAULT_NAME%" == "" ( 6 | echo Error: the PCS_IOTHUB_CONNSTRING environment variable is not defined. 7 | exit /B 1 8 | ) 9 | 10 | IF "%PCS_AAD_APPID%" == "" ( 11 | echo Error: the PCS_AAD_APPID environment variable is not defined. 12 | exit /B 1 13 | ) 14 | 15 | IF "%PCS_AAD_APPSECRET%" == "" ( 16 | echo Error: the PCS_AAD_APPSECRET environment variable is not defined. 17 | exit /B 1 18 | ) 19 | 20 | endlocal 21 | -------------------------------------------------------------------------------- /iothub-manager/scripts/env-vars-check.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | @ECHO off & setlocal enableextensions enabledelayedexpansion 4 | 5 | IF "%PCS_KEYVAULT_NAME%" == "" ( 6 | echo Error: the PCS_IOTHUB_CONNSTRING environment variable is not defined. 7 | exit /B 1 8 | ) 9 | 10 | IF "%PCS_AAD_APPID%" == "" ( 11 | echo Error: the PCS_AAD_APPID environment variable is not defined. 12 | exit /B 1 13 | ) 14 | 15 | IF "%PCS_AAD_APPSECRET%" == "" ( 16 | echo Error: the PCS_AAD_APPSECRET environment variable is not defined. 17 | exit /B 1 18 | ) 19 | 20 | endlocal 21 | -------------------------------------------------------------------------------- /scripts/local/launch/start.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | :: This script will install pcs-cli on this machine. 3 | :: For more info on pcs-cli visit (). 4 | 5 | @ECHO OFF 6 | echo Have you created required Azure resources ([Y]es/[N]o)? 7 | set /p answer=Enter selection: 8 | if "%answer%" == "Y" ( 9 | echo Please set the env variables on your machine. You need not run this script again. 10 | ) else if "%answer%" == "N" ( 11 | echo Setting up Azure resources... 12 | call helpers\"create-azure-resources" 13 | ) else ( 14 | echo "Incorrect option. Please re-run the script." 15 | ) -------------------------------------------------------------------------------- /storage-adapter/scripts/env-vars-check.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | @ECHO off & setlocal enableextensions enabledelayedexpansion 4 | 5 | IF "%PCS_KEYVAULT_NAME%" == "" ( 6 | echo Error: the PCS_IOTHUB_CONNSTRING environment variable is not defined. 7 | exit /B 1 8 | ) 9 | 10 | IF "%PCS_AAD_APPID%" == "" ( 11 | echo Error: the PCS_AAD_APPID environment variable is not defined. 12 | exit /B 1 13 | ) 14 | 15 | IF "%PCS_AAD_APPSECRET%" == "" ( 16 | echo Error: the PCS_AAD_APPSECRET environment variable is not defined. 17 | exit /B 1 18 | ) 19 | 20 | endlocal 21 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/IActions.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.ExternalDependencyException; 7 | import com.microsoft.azure.iotsolutions.uiconfig.services.models.actions.IActionSettings; 8 | 9 | import java.util.List; 10 | 11 | @ImplementedBy(Actions.class) 12 | public interface IActions { 13 | List getList() throws ExternalDependencyException; 14 | } 15 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/models/DeploymentServiceListModel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.models; 4 | 5 | import java.util.List; 6 | 7 | public class DeploymentServiceListModel { 8 | private final List items; 9 | 10 | public DeploymentServiceListModel(List items) { 11 | this.items = items; 12 | } 13 | 14 | public List getItems() { 15 | return this.items; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/runtime/IConfigData.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.iotsolutions.iothubmanager.services.runtime; 2 | 3 | import com.microsoft.azure.iotsolutions.iothubmanager.services.exceptions.InvalidConfigurationException; 4 | import java.util.List; 5 | 6 | public interface IConfigData { 7 | String getString(String key); 8 | boolean getBool(String key); 9 | int getInt(String key) throws InvalidConfigurationException; 10 | boolean hasPath(String path); 11 | List getStringList(String key) throws InvalidConfigurationException; 12 | } 13 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/v1/models/MethodResultApiModel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.v1.models; 4 | 5 | import com.microsoft.azure.iotsolutions.iothubmanager.services.models.MethodResultServiceModel; 6 | 7 | public class MethodResultApiModel extends MethodResultServiceModel { 8 | 9 | public MethodResultApiModel(MethodResultServiceModel model) { 10 | this.setStatus(model.getStatus()); 11 | this.setJsonPayload(model.getJsonPayload()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /scripts/iothub/show-hub.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | RESOURCE_GROUP="$1" 8 | HUB_NAME="$2" 9 | 10 | check_input() { 11 | if [[ -z "$RESOURCE_GROUP" || -z "$HUB_NAME" ]]; then 12 | announce "Usage: ./show-hub.sh RESOURCE_GROUP HUB_NAME" 13 | echo "Use './list-hubs.sh' to see the list of hubs." 14 | exit -1 15 | fi 16 | } 17 | 18 | main() { 19 | check_input 20 | check_dependencies 21 | login 22 | show_hub_details "$RESOURCE_GROUP" "$HUB_NAME" 23 | } 24 | 25 | main 26 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/IStatusService.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.storageadapter.services.models.StatusServiceModel; 7 | 8 | @ImplementedBy(StatusService.class) 9 | public interface IStatusService { 10 | /** 11 | * Get status of dependent services. 12 | * 13 | * @return Connection StatusServiceModel 14 | */ 15 | StatusServiceModel getStatus(); 16 | } 17 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/auth/IJwtValidation.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.webservice.auth; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.uiconfig.webservice.auth.exceptions.*; 7 | 8 | @ImplementedBy(OpenIdConnectJwtValidation.class) 9 | public interface IJwtValidation { 10 | Boolean validateToken(String token) throws InvalidConfigurationException, ExternalDependencyException; 11 | UserClaims getUserClaims(String token) throws NotAuthorizedException; 12 | } 13 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/auth/Authorize.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.auth; 4 | 5 | import play.mvc.*; 6 | 7 | import java.lang.annotation.ElementType; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | @With(AuthorizeAction.class) 13 | @Target({ElementType.TYPE, ElementType.METHOD}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface Authorize { 16 | String value(); 17 | } -------------------------------------------------------------------------------- /device-telemetry/device-telemetry.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/auth/Authorize.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.auth; 4 | 5 | import play.mvc.*; 6 | 7 | import java.lang.annotation.ElementType; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | @With(AuthorizeAction.class) 13 | @Target({ElementType.TYPE, ElementType.METHOD}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface Authorize { 16 | String value(); 17 | } 18 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/DevicePropertyCallBack.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.iotsolutions.iothubmanager.services; 2 | 3 | import com.microsoft.azure.iotsolutions.iothubmanager.services.exceptions.ExternalDependencyException; 4 | import com.microsoft.azure.iotsolutions.iothubmanager.services.models.DevicePropertyServiceModel; 5 | 6 | import java.util.concurrent.CompletionStage; 7 | 8 | public interface DevicePropertyCallBack { 9 | public CompletionStage updateCache(DevicePropertyServiceModel devices) 10 | throws InterruptedException, ExternalDependencyException; 11 | } 12 | -------------------------------------------------------------------------------- /iothub-manager/scripts/iothub/show-hub.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | RESOURCE_GROUP="$1" 8 | HUB_NAME="$2" 9 | 10 | check_input() { 11 | if [[ -z "$RESOURCE_GROUP" || -z "$HUB_NAME" ]]; then 12 | announce "Usage: ./show-hub.sh RESOURCE_GROUP HUB_NAME" 13 | echo "Use './list-hubs.sh' to see the list of hubs." 14 | exit -1 15 | fi 16 | } 17 | 18 | main() { 19 | check_input 20 | check_dependencies 21 | login 22 | show_hub_details "$RESOURCE_GROUP" "$HUB_NAME" 23 | } 24 | 25 | main 26 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/models/actions/ActionType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.models.actions; 4 | 5 | public enum ActionType { 6 | Email; 7 | 8 | // Parse ActionType from incasesitive string value 9 | public static ActionType from(String value) { 10 | for (ActionType v : values()) { 11 | if (v.name().equalsIgnoreCase(value)) return v; 12 | } 13 | throw new IllegalArgumentException(String.format("ActionType(%s)", value)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /storage-adapter/scripts/iothub/show-hub.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | RESOURCE_GROUP="$1" 8 | HUB_NAME="$2" 9 | 10 | check_input() { 11 | if [[ -z "$RESOURCE_GROUP" || -z "$HUB_NAME" ]]; then 12 | announce "Usage: ./show-hub.sh RESOURCE_GROUP HUB_NAME" 13 | echo "Use './list-hubs.sh' to see the list of hubs." 14 | exit -1 15 | fi 16 | } 17 | 18 | main() { 19 | check_input 20 | check_dependencies 21 | login 22 | show_hub_details "$RESOURCE_GROUP" "$HUB_NAME" 23 | } 24 | 25 | main 26 | -------------------------------------------------------------------------------- /config/test/README.md: -------------------------------------------------------------------------------- 1 | Unit Tests 2 | ========== 3 | 4 | ## Guidelines 5 | 6 | * Store here functional and integration tests, e.g. tests which require network 7 | access, storage read/write operations, etc. 8 | * Functional and Integration tests typically requires confuiguration settings, 9 | which should be provided similarly to the entry point application. 10 | 11 | ## Conventions 12 | 13 | * For each class create a test class with "Test" suffix. 14 | * Flag all the tests with a packageType, e.g. `@Category({UnitTest.class})` 15 | * Store the Integration Tests under `it/` and use the 16 | `@Category({IntegrationTest.class})` attribute 17 | -------------------------------------------------------------------------------- /device-simulation/scripts/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.0.3-runtime-jessie 2 | 3 | MAINTAINER Devis Lucato (https://github.com/dluc) 4 | 5 | LABEL Tags="Azure,IoT,Solutions,Simulation,.NET" 6 | 7 | ARG user=pcsuser 8 | 9 | RUN useradd -m -s /bin/bash -U $user 10 | 11 | COPY . /app/ 12 | RUN chown -R $user.$user /app 13 | WORKDIR /app 14 | 15 | RUN \ 16 | # Ensures the entry point is executable 17 | chmod ugo+x /app/run.sh && \ 18 | # Clean up destination folder 19 | rm -f /app/Dockerfile /app/.dockerignore 20 | 21 | VOLUME ["/app/data"] 22 | 23 | ENTRYPOINT ["/bin/bash", "/app/run.sh"] 24 | 25 | USER $user 26 | -------------------------------------------------------------------------------- /device-telemetry/test/README.md: -------------------------------------------------------------------------------- 1 | Unit Tests 2 | ========== 3 | 4 | ## Guidelines 5 | 6 | * Store here functional and integration tests, e.g. tests which require network 7 | access, storage read/write operations, etc. 8 | * Functional and Integration tests typically requires confuiguration settings, 9 | which should be provided similarly to the entry point application. 10 | 11 | ## Conventions 12 | 13 | * For each class create a test class with "Test" suffix. 14 | * Flag all the tests with a type, e.g. `@Category({UnitTest.class})` 15 | * Store the Integration Tests under `it/` and use the 16 | `@Category({IntegrationTest.class})` attribute 17 | -------------------------------------------------------------------------------- /storage-adapter/test/README.md: -------------------------------------------------------------------------------- 1 | Unit Tests 2 | ========== 3 | 4 | ## Guidelines 5 | 6 | * Store here functional and integration tests, e.g. tests which require network 7 | access, storage read/write operations, etc. 8 | * Functional and Integration tests typically requires confuiguration settings, 9 | which should be provided similarly to the entry point application. 10 | 11 | ## Conventions 12 | 13 | * For each class create a test class with "Test" suffix. 14 | * Flag all the tests with a type, e.g. `@Category({UnitTest.class})` 15 | * Store the Integration Tests under `it/` and use the 16 | `@Category({IntegrationTest.class})` attribute 17 | -------------------------------------------------------------------------------- /config/scripts/clean-up: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/.functions.sh" 8 | 9 | if [[ ${#APP_HOME} -lt 20 ]]; then 10 | error "Unable to detect current folder. Aborting." 11 | exit -1 12 | fi 13 | 14 | cd $APP_HOME 15 | 16 | header "Removing temporary folders and files..." 17 | 18 | rm -fR ./target/ 19 | rm -fR ./logs/ 20 | rm -fR ./project/target/ 21 | rm -fR ./project/project/ 22 | 23 | echo -e "\nDone" 24 | 25 | set +e 26 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/v1/models/AlarmStatus.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.v1.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | public class AlarmStatus { 8 | public final String status; 9 | 10 | public AlarmStatus() { 11 | this.status = null; 12 | } 13 | 14 | public AlarmStatus(String status) { 15 | this.status = status; 16 | } 17 | 18 | @JsonProperty("Status") 19 | public String getStatus() { return this.status; } 20 | } 21 | -------------------------------------------------------------------------------- /iothub-manager/test/README.md: -------------------------------------------------------------------------------- 1 | Unit Tests 2 | ========== 3 | 4 | ## Guidelines 5 | 6 | * Store here functional and integration tests, e.g. tests which require network 7 | access, storage read/write operations, etc. 8 | * Functional and Integration tests typically requires configuration settings, 9 | which should be provided similarly to the entry point application. 10 | 11 | ## Conventions 12 | 13 | * For each class create a test class with "Test" suffix. 14 | * Flag all the tests with a packageType, e.g. `@Category({UnitTest.class})` 15 | * Store the Integration Tests under `it/` and use the 16 | `@Category({IntegrationTest.class})` attribute 17 | -------------------------------------------------------------------------------- /asa-manager/scripts/asa/functions/removeUnusedProperties.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // This function is called in the shape of 'udf.removeUnusedProperties(record)' 3 | // from ASA query. Those unused properties will be removed from record for the 4 | // next step of ASA query. 5 | function main(record) { 6 | if (record) { 7 | record.IoTHub && delete record.IoTHub; 8 | record.PartitionId && delete record.PartitionId; 9 | record.EventEnqueuedUtcTime && delete record.EventEnqueuedUtcTime; 10 | record.EventProcessedUtcTime && delete record.EventProcessedUtcTime; 11 | } 12 | return record; 13 | } -------------------------------------------------------------------------------- /storage-adapter/scripts/clean-up: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/.functions.sh" 8 | 9 | if [[ ${#APP_HOME} -lt 20 ]]; then 10 | error "Unable to detect current folder. Aborting." 11 | exit -1 12 | fi 13 | 14 | cd $APP_HOME 15 | 16 | header "Removing temporary folders and files..." 17 | 18 | rm -fR ./target/ 19 | rm -fR ./logs/ 20 | rm -fR ./project/target/ 21 | rm -fR ./project/project/ 22 | 23 | echo -e "\nDone" 24 | 25 | set +e 26 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/exceptions/ExternalDependencyException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.exceptions; 4 | 5 | /** 6 | * Checked exception for invalid user input 7 | */ 8 | public class ExternalDependencyException extends BaseException { 9 | public ExternalDependencyException() { 10 | } 11 | 12 | public ExternalDependencyException(String message) { 13 | super(message); 14 | } 15 | 16 | public ExternalDependencyException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /device-simulation/scripts/env-vars-setup.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | :: Prepare the environment variables used by the application. 4 | :: 5 | :: For more information about finding IoT Hub settings, more information here: 6 | :: 7 | :: * https://docs.microsoft.com/azure/iot-hub/iot-hub-create-through-portal#endpoints 8 | :: * https://docs.microsoft.com/azure/iot-hub/iot-hub-csharp-csharp-getstarted 9 | :: 10 | 11 | :: Azure IoT Hub Connection string 12 | SETX PCS_IOTHUB_CONNSTRING "your Azure IoT Hub connection string" 13 | 14 | :: Endpoint to reach the storage adapter 15 | SETX PCS_STORAGEADAPTER_WEBSERVICE_URL "http://127.0.0.1:9022/v1" 16 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/runtime/DiagnosticsConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.runtime; 4 | 5 | public class DiagnosticsConfig { 6 | private final String apiUrl; 7 | private final int maxLogRetries; 8 | 9 | public DiagnosticsConfig(String apiUrl, int maxLogRetries) 10 | { 11 | this.apiUrl = apiUrl; 12 | this.maxLogRetries = maxLogRetries; 13 | } 14 | 15 | public String getApiUrl() { return this.apiUrl; } 16 | 17 | public int getMaxLogRetries() { return this.maxLogRetries; } 18 | } 19 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/exceptions/ExternalDependencyException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.exceptions; 4 | 5 | /** 6 | * Checked exception for invalid user input 7 | */ 8 | public class ExternalDependencyException extends Exception { 9 | public ExternalDependencyException() { 10 | } 11 | 12 | public ExternalDependencyException(String message) { 13 | super(message); 14 | } 15 | 16 | public ExternalDependencyException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/models/ConfigType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonValue; 6 | 7 | public enum ConfigType { 8 | firmware("Firmware"), 9 | custom("Custom"); 10 | 11 | private final String value; 12 | 13 | ConfigType(String value) { 14 | this.value = value; 15 | } 16 | 17 | @JsonValue 18 | public String getValue() { 19 | return value; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return getValue(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/auth/exceptions/NotAuthorizedException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.webservice.auth.exceptions; 4 | 5 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.BaseException; 6 | 7 | public class NotAuthorizedException extends BaseException { 8 | 9 | public NotAuthorizedException(){ 10 | } 11 | 12 | public NotAuthorizedException(String message) { 13 | super(message); 14 | } 15 | 16 | public NotAuthorizedException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/IStatusService.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.iothubmanager.services.models.StatusServiceModel; 7 | 8 | @ImplementedBy(StatusService.class) 9 | public interface IStatusService { 10 | /** 11 | * Get status of dependent services. 12 | * 13 | * @param authRequired boolean 14 | * 15 | * @return Connection StatusServiceModel 16 | */ 17 | StatusServiceModel getStatus(boolean authRequired); 18 | } 19 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/auth/NotAuthorizedException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.auth; 4 | 5 | /** 6 | * This exception is thrown when the user is not authorized to perform the action. 7 | */ 8 | public class NotAuthorizedException extends Exception { 9 | public NotAuthorizedException() { 10 | } 11 | 12 | public NotAuthorizedException(String message) { 13 | super(message); 14 | } 15 | 16 | public NotAuthorizedException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /device-simulation/scripts/env-vars-setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | 4 | # Prepare the environment variables used by the application. 5 | # 6 | # For more information about finding IoT Hub settings, more information here: 7 | # 8 | # * https://docs.microsoft.com/azure/iot-hub/iot-hub-create-through-portal#endpoints 9 | # * https://docs.microsoft.com/azure/iot-hub/iot-hub-csharp-csharp-getstarted 10 | # 11 | 12 | # Azure IoT Hub Connection string 13 | export PCS_IOTHUB_CONNSTRING="your Azure IoT Hub connection string" 14 | 15 | # Endpoint to reach the storage adapter 16 | export PCS_STORAGEADAPTER_WEBSERVICE_URL="http://127.0.0.1:9022/v1" 17 | -------------------------------------------------------------------------------- /auth/scripts/travis: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Example usage (see "travis help" for more information): 4 | # travis help 5 | # travis login --pro 6 | # travis whoami --pro 7 | # travis accounts --pro 8 | # travis history 9 | # travis monitor --pro 10 | # travis settings 11 | # travis show 12 | # travis status 13 | # travis token --pro 14 | # travis whatsup --pro 15 | 16 | set -e 17 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 18 | cd $APP_HOME 19 | 20 | mkdir -p .travis 21 | 22 | docker run -it \ 23 | -v $APP_HOME/.travis:/root/.travis \ 24 | -v $APP_HOME:/opt/code \ 25 | azureiotpcs/travis-cli:1.8.8 /root/bin/travis.sh $* 26 | 27 | set +e 28 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/models/PackageType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonValue; 6 | 7 | public enum PackageType { 8 | edgeManifest("EdgeManifest"), 9 | deviceConfiguration("DeviceConfiguration"); 10 | 11 | private String value; 12 | 13 | PackageType(String value) { 14 | this.value = value; 15 | } 16 | 17 | @JsonValue 18 | public String getValue() { 19 | return value; 20 | } 21 | 22 | public String toString() { 23 | return getValue(); 24 | } 25 | } -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/IStatusService.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.devicetelemetry.services.models.StatusServiceModel; 7 | 8 | @ImplementedBy(StatusService.class) 9 | public interface IStatusService { 10 | /** 11 | * Get status of dependent services. 12 | * 13 | * @param authRequired boolean 14 | * 15 | * @return Connection StatusServiceModel 16 | */ 17 | StatusServiceModel getStatus(boolean authRequired); 18 | } 19 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/external/IDiagnosticsClient.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.external; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | import java.util.Dictionary; 8 | import java.util.concurrent.CompletionStage; 9 | 10 | @ImplementedBy(DiagnosticsClient.class) 11 | public interface IDiagnosticsClient { 12 | CompletionStage logEventAsync(String eventName); 13 | 14 | CompletionStage logEventAsync(String eventName, Dictionary eventProperties); 15 | 16 | boolean canWriteToDiagnostics(); 17 | } 18 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/runtime/IServicesConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services.runtime; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | @ImplementedBy(ServicesConfig.class) 8 | public interface IServicesConfig { 9 | 10 | /** 11 | * Get Document connection string. 12 | * 13 | * @return Connection string 14 | */ 15 | String getDocumentDBConnectionString(); 16 | 17 | /** 18 | * Get Container Name 19 | * 20 | * @return Container Name string 21 | */ 22 | String getContainerName(); 23 | } 24 | -------------------------------------------------------------------------------- /config/test/helpers/Random.java: -------------------------------------------------------------------------------- 1 | package helpers; 2 | 3 | public class Random { 4 | 5 | private java.util.Random rand = null; 6 | 7 | public Random() { 8 | rand = new java.util.Random(); 9 | } 10 | 11 | public String NextString() { 12 | return NextString(32, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); 13 | } 14 | 15 | public String NextString(int length, String characters) { 16 | StringBuilder builder = new StringBuilder(); 17 | while (builder.length() < length) { 18 | builder.append(characters.charAt(rand.nextInt(characters.length()))); 19 | } 20 | return builder.toString(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/test/com/microsoft/azure/iotsolutions/uiconfig/webservice/runtime/ConfigTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.webservice.runtime; 4 | 5 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.InvalidConfigurationException; 6 | import org.junit.After; 7 | import org.junit.Before; 8 | 9 | public class ConfigTest { 10 | 11 | private Config config = null; 12 | 13 | @Before 14 | public void setUp() throws InvalidConfigurationException { 15 | config = new Config(); 16 | } 17 | 18 | @After 19 | public void tearDown() { 20 | // something after every test 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/auth/exceptions/NotAuthorizedException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.auth.exceptions; 4 | 5 | /** 6 | * This exception is thrown when the user is not authorized to perform the action. 7 | */ 8 | public class NotAuthorizedException extends Exception { 9 | public NotAuthorizedException() { 10 | } 11 | 12 | public NotAuthorizedException(String message) { 13 | super(message); 14 | } 15 | 16 | public NotAuthorizedException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/v1/Version.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.v1; 4 | 5 | /** 6 | * Web service API version 1 information. 7 | */ 8 | public final class Version { 9 | /** 10 | * Number used for routing HTTP requests. 11 | */ 12 | public static final String NUMBER = "1"; 13 | 14 | /** 15 | * Full path used in the URL 16 | */ 17 | public static final String PATH = "v" + NUMBER; 18 | 19 | /** 20 | * Date when the API version has been published. 21 | */ 22 | public static final String DATE = "201706"; 23 | } 24 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/models/PackageType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonValue; 6 | 7 | public enum PackageType { 8 | edgeManifest("EdgeManifest"), 9 | deviceConfiguration("DeviceConfiguration"); 10 | 11 | private final String value; 12 | 13 | PackageType(String value) { 14 | this.value = value; 15 | } 16 | 17 | @JsonValue 18 | public String getValue() { 19 | return value; 20 | } 21 | 22 | public String toString() { 23 | return getValue(); 24 | } 25 | } -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/v1/Version.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.webservice.v1; 4 | 5 | /** 6 | * Web service API version 1 information. 7 | */ 8 | public final class Version { 9 | 10 | /** 11 | * Date when the API version has been published. 12 | */ 13 | public static final String DATE = "201707"; 14 | 15 | /** 16 | * Date when the API version has been published. 17 | */ 18 | public static final String Number= "1"; 19 | 20 | /** 21 | * Date when the API version has been published. 22 | */ 23 | public static final String Path = "v" + Number; 24 | } 25 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/models/CalculationType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonValue; 6 | 7 | public enum CalculationType { 8 | AVERAGE("Average"), 9 | INSTANT("Instant"); 10 | 11 | private String value = null; 12 | 13 | CalculationType(String calculationStr) { 14 | this.value = calculationStr; 15 | } 16 | 17 | @JsonValue 18 | public String getValue() { 19 | return value; 20 | } 21 | 22 | public String toString() { 23 | return getValue(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/KeyValueDocument.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services; 4 | 5 | import com.microsoft.azure.iotsolutions.storageadapter.services.helpers.DocumentIdHelper; 6 | 7 | class KeyValueDocument { 8 | public String id; 9 | public String CollectionId; 10 | public String Key; 11 | public String Data; 12 | 13 | public KeyValueDocument(String collectionId, String key, String data) { 14 | id = DocumentIdHelper.GenerateId(collectionId, key); 15 | CollectionId = collectionId; 16 | Key = key; 17 | Data = data; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/webservice/v1/Version.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.webservice.v1; 4 | 5 | /** 6 | * Web service API version 1 information. 7 | */ 8 | public final class Version { 9 | 10 | /** 11 | * Number used for routing HTTP requests. 12 | */ 13 | public static final String Number = "1"; 14 | 15 | /** 16 | * Name used for routing HTTP requests. 17 | */ 18 | public static final String Path = "v" + Number; 19 | 20 | /** 21 | * Date when the API version has been published. 22 | */ 23 | public static final String DATE = "201707"; 24 | } 25 | -------------------------------------------------------------------------------- /auth/scripts/env-vars-setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Usage: source ./scripts/env-vars-setup 4 | # 5 | # IMPORTANT NOTES: 6 | # * use "source" in front of the script path, so that variables are exported in your shell 7 | # * the variables are set only in the current shell, run this script every time, or automate 8 | # the setup using your `~/.bash_profile`. 9 | 10 | # Prepare the environment variables used by the application. 11 | 12 | # The OpenId tokens issuer URL, e.g. https://sts.windows.net/12000000-3400-5600-0000-780000000000/ 13 | export PCS_AUTH_ISSUER="{enter the token issuer URL here}" 14 | 15 | # The intended audience of the tokens, e.g. your Client Id 16 | export PCS_AUTH_AUDIENCE="{enter the tokens audience here}" 17 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/models/SeverityType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonValue; 6 | 7 | public enum SeverityType { 8 | CRITICAL("Critical"), 9 | WARNING("Warning"), 10 | INFO("Info"); 11 | 12 | private String value = null; 13 | 14 | SeverityType(String severityStr) { 15 | this.value = severityStr; 16 | } 17 | 18 | @JsonValue 19 | public String getValue() { 20 | return value; 21 | } 22 | 23 | public String toString() { 24 | return getValue(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /scripts/local/launch/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # This script will install pcs-cli on this machine. 4 | # For more info on pcs-cli visit (). 5 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../../ && pwd )" 2> /dev/null 6 | read -p "Have you created required Azure resources (Y/N)?" yn 7 | case $yn in 8 | "Y"|"y"|"Yes"|"yes") 9 | echo -e "Please set the env variables on your machine. You need not run this script again."; 10 | exit 0 11 | ;; 12 | "N"|"n"|"No"|"no") 13 | echo "Setting up Azure resources." 14 | $APP_HOME/scripts/local/launch/helpers/create-azure-resources.sh; 15 | ;; 16 | *) 17 | echo "Incorrect option. Please re-run the script." 18 | exit 0 19 | ;; 20 | esac -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/external/IDeviceSimulationClient.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.external; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.ExternalDependencyException; 7 | 8 | import java.util.concurrent.CompletionStage; 9 | 10 | @ImplementedBy(DeviceSimulationClient.class) 11 | public interface IDeviceSimulationClient { 12 | CompletionStage getSimulationAsync() throws ExternalDependencyException; 13 | 14 | CompletionStage updateSimulationAsync(SimulationApiModel model) throws ExternalDependencyException; 15 | } 16 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/exceptions/TimeSeriesParseException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * This exception is thrown when parsing response from Time Series Insights. 8 | */ 9 | public class TimeSeriesParseException extends Exception { 10 | public TimeSeriesParseException() { 11 | } 12 | 13 | public TimeSeriesParseException(String message) { 14 | super(message); 15 | } 16 | 17 | public TimeSeriesParseException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/exceptions/CreateResourceException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | *

8 | * This exception is thrown when a client attempts to create a resource 9 | */ 10 | public class CreateResourceException extends Exception { 11 | public CreateResourceException() { 12 | } 13 | 14 | public CreateResourceException(String message) { 15 | super(message); 16 | } 17 | 18 | public CreateResourceException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/exceptions/NotAuthorizedException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.exceptions; 4 | 5 | /** 6 | * Exception for authorization errors. 7 | * 8 | * This exception is thrown when the user or the application 9 | * is not authorized to perform an action. 10 | */ 11 | public class NotAuthorizedException extends BaseException { 12 | public NotAuthorizedException() { 13 | } 14 | 15 | public NotAuthorizedException(String message) { 16 | super(message); 17 | } 18 | 19 | public NotAuthorizedException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /auth/scripts/travis.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off & setlocal enableextensions enabledelayedexpansion 2 | 3 | :: Example usage (see "travis help" for more information: 4 | :: travis help 5 | :: travis login --pro 6 | :: travis whoami --pro 7 | :: travis accounts --pro 8 | :: travis history 9 | :: travis monitor --pro 10 | :: travis settings 11 | :: travis show 12 | :: travis status 13 | :: travis token --pro 14 | :: travis whatsup --pro 15 | 16 | :: strlen("\scripts\") => 9 17 | SET APP_HOME=%~dp0 18 | SET APP_HOME=%APP_HOME:~0,-9% 19 | cd %APP_HOME% 20 | 21 | mkdir .travis 2>NUL 22 | 23 | docker run -it ^ 24 | -v %APP_HOME%\.travis:/root/.travis ^ 25 | -v %APP_HOME%:/opt/code ^ 26 | azureiotpcs/travis-cli:1.8.8 /root/bin/travis.sh %* 27 | 28 | endlocal 29 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/external/DeviceModelRef.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.external; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | public class DeviceModelRef { 8 | 9 | private String Id; 10 | 11 | private int Count; 12 | 13 | @JsonProperty("Id") 14 | public String getId() { 15 | return Id; 16 | } 17 | 18 | public void setId(String id) { 19 | Id = id; 20 | } 21 | 22 | @JsonProperty("Count") 23 | public int getCount() { 24 | return Count; 25 | } 26 | 27 | public void setCount(int count) { 28 | Count = count; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/exceptions/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client is requesting a resource that 9 | * doesn't exist yet. 10 | */ 11 | public class ResourceNotFoundException extends BaseException { 12 | public ResourceNotFoundException() { 13 | } 14 | 15 | public ResourceNotFoundException(String message) { 16 | super(message); 17 | } 18 | 19 | public ResourceNotFoundException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/scripts/clean-up.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off & setlocal enableextensions enabledelayedexpansion 2 | 3 | :: strlen("\scripts\") => 9 4 | SET APP_HOME=%~dp0 5 | SET APP_HOME=%APP_HOME:~0,-9% 6 | if "%APP_HOME:~20%" == "" ( 7 | echo Unable to detect current folder. Aborting. 8 | GOTO FAIL 9 | ) 10 | 11 | :: Clean up folders containing temporary files 12 | echo Removing temporary folders and files... 13 | cd %APP_HOME% 14 | IF %ERRORLEVEL% NEQ 0 GOTO FAIL 15 | 16 | rmdir /s /q .\target\ 17 | rmdir /s /q .\logs\ 18 | rmdir /s /q .\project\target\ 19 | rmdir /s /q .\project\project\ 20 | 21 | echo Done. 22 | 23 | :: - - - - - - - - - - - - - - 24 | goto :END 25 | 26 | :FAIL 27 | echo Command failed 28 | endlocal 29 | exit /B 1 30 | 31 | :END 32 | endlocal 33 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/external/IDeviceTelemetryClient.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.external; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.ExternalDependencyException; 7 | 8 | import java.io.UnsupportedEncodingException; 9 | import java.net.URISyntaxException; 10 | import java.util.concurrent.CompletionStage; 11 | 12 | @ImplementedBy(DeviceTelemetryClient.class) 13 | public interface IDeviceTelemetryClient { 14 | CompletionStage updateRuleAsync(RuleApiModel rule, String etag) throws UnsupportedEncodingException, ExternalDependencyException, URISyntaxException; 15 | } 16 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/auth/exceptions/InvalidConfigurationException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.webservice.auth.exceptions; 4 | 5 | /** 6 | * This exception is thrown when something is wrong in the 7 | * service configuration. 8 | */ 9 | public class InvalidConfigurationException extends Exception { 10 | 11 | public InvalidConfigurationException() { 12 | super(); 13 | } 14 | 15 | public InvalidConfigurationException(String message) { 16 | super(message); 17 | } 18 | 19 | public InvalidConfigurationException(String message, Exception innerException) { 20 | super(message, innerException); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/v1/exceptions/BadRequestException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.webservice.v1.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown by a controller when the input validation 9 | * fails. The client should fix the request before retrying. 10 | */ 11 | public class BadRequestException extends Exception { 12 | public BadRequestException() { 13 | } 14 | 15 | public BadRequestException(String message) { 16 | super(message); 17 | } 18 | 19 | public BadRequestException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/exceptions/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * This exception is thrown when a client is requesting a resource that 8 | * doesn't exist yet. 9 | */ 10 | public class ResourceNotFoundException extends Exception { 11 | public ResourceNotFoundException() { 12 | } 13 | 14 | public ResourceNotFoundException(String message) { 15 | super(message); 16 | } 17 | 18 | public ResourceNotFoundException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /device-telemetry/scripts/clean-up.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off & setlocal enableextensions enabledelayedexpansion 2 | 3 | :: strlen("\scripts\") => 9 4 | SET APP_HOME=%~dp0 5 | SET APP_HOME=%APP_HOME:~0,-9% 6 | if "%APP_HOME:~20%" == "" ( 7 | echo Unable to detect current folder. Aborting. 8 | GOTO FAIL 9 | ) 10 | 11 | :: Clean up folders containing temporary files 12 | echo Removing temporary folders and files... 13 | cd %APP_HOME% 14 | IF %ERRORLEVEL% NEQ 0 GOTO FAIL 15 | 16 | rmdir /s /q .\target\ 17 | rmdir /s /q .\logs\ 18 | rmdir /s /q .\project\target\ 19 | rmdir /s /q .\project\project\ 20 | 21 | echo Done. 22 | 23 | :: - - - - - - - - - - - - - - 24 | goto :END 25 | 26 | :FAIL 27 | echo Command failed 28 | endlocal 29 | exit /B 1 30 | 31 | :END 32 | endlocal 33 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/auth/ExternalDependencyException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.auth; 4 | 5 | /** 6 | * This exception is thrown when something goes wrong when talking 7 | * with an external dependency. 8 | */ 9 | public class ExternalDependencyException extends Exception { 10 | 11 | public ExternalDependencyException() { 12 | super(); 13 | } 14 | 15 | public ExternalDependencyException(String message) { 16 | super(message); 17 | } 18 | 19 | public ExternalDependencyException(String message, Exception innerException) { 20 | super(message, innerException); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/auth/InvalidConfigurationException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.auth; 4 | 5 | /** 6 | * This exception is thrown when something is wrong in the 7 | * service configuration. 8 | */ 9 | public class InvalidConfigurationException extends Exception { 10 | 11 | public InvalidConfigurationException() { 12 | super(); 13 | } 14 | 15 | public InvalidConfigurationException(String message) { 16 | super(message); 17 | } 18 | 19 | public InvalidConfigurationException(String message, Exception innerException) { 20 | super(message, innerException); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iothub-manager/scripts/clean-up.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off & setlocal enableextensions enabledelayedexpansion 2 | 3 | :: strlen("\scripts\") => 9 4 | SET APP_HOME=%~dp0 5 | SET APP_HOME=%APP_HOME:~0,-9% 6 | if "%APP_HOME:~20%" == "" ( 7 | echo Unable to detect current folder. Aborting. 8 | GOTO FAIL 9 | ) 10 | 11 | :: Clean up folders containing temporary files 12 | echo Removing temporary folders and files... 13 | cd %APP_HOME% 14 | IF %ERRORLEVEL% NEQ 0 GOTO FAIL 15 | 16 | rmdir /s /q .\target\ 17 | rmdir /s /q .\logs\ 18 | rmdir /s /q .\project\target\ 19 | rmdir /s /q .\project\project\ 20 | 21 | echo Done. 22 | 23 | :: - - - - - - - - - - - - - - 24 | goto :END 25 | 26 | :FAIL 27 | echo Command failed 28 | endlocal 29 | exit /B 1 30 | 31 | :END 32 | endlocal 33 | -------------------------------------------------------------------------------- /storage-adapter/scripts/clean-up.cmd: -------------------------------------------------------------------------------- 1 | @ECHO off & setlocal enableextensions enabledelayedexpansion 2 | 3 | :: strlen("\scripts\") => 9 4 | SET APP_HOME=%~dp0 5 | SET APP_HOME=%APP_HOME:~0,-9% 6 | if "%APP_HOME:~20%" == "" ( 7 | echo Unable to detect current folder. Aborting. 8 | GOTO FAIL 9 | ) 10 | 11 | :: Clean up folders containing temporary files 12 | echo Removing temporary folders and files... 13 | cd %APP_HOME% 14 | IF %ERRORLEVEL% NEQ 0 GOTO FAIL 15 | 16 | rmdir /s /q .\target\ 17 | rmdir /s /q .\logs\ 18 | rmdir /s /q .\project\target\ 19 | rmdir /s /q .\project\project\ 20 | 21 | echo Done. 22 | 23 | :: - - - - - - - - - - - - - - 24 | goto :END 25 | 26 | :FAIL 27 | echo Command failed 28 | endlocal 29 | exit /B 1 30 | 31 | :END 32 | endlocal 33 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/IStorageMutex.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.BaseException; 7 | 8 | import java.util.concurrent.CompletionStage; 9 | import java.util.concurrent.ExecutionException; 10 | 11 | @ImplementedBy(StorageMutex.class) 12 | public interface IStorageMutex { 13 | 14 | CompletionStage enterAsync(String collectionId, String key, int timeout) throws BaseException, ExecutionException, InterruptedException; 15 | 16 | CompletionStage leaveAsync(String collectionId, String key) throws BaseException; 17 | } 18 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/auth/exceptions/ExternalDependencyException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.webservice.auth.exceptions; 4 | 5 | /** 6 | * This exception is thrown when something goes wrong when talking 7 | * with an external dependency. 8 | */ 9 | public class ExternalDependencyException extends Exception { 10 | 11 | public ExternalDependencyException() { 12 | super(); 13 | } 14 | 15 | public ExternalDependencyException(String message) { 16 | super(message); 17 | } 18 | 19 | public ExternalDependencyException(String message, Exception innerException) { 20 | super(message, innerException); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/exceptions/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client is requesting a resource that 9 | * doesn't exist yet. 10 | */ 11 | public class ResourceNotFoundException extends Exception { 12 | public ResourceNotFoundException() { 13 | } 14 | 15 | public ResourceNotFoundException(String message) { 16 | super(message); 17 | } 18 | 19 | public ResourceNotFoundException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/exceptions/BadRequestException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.exceptions; 4 | 5 | /** 6 | * This exception is thrown by a controller when the input validation 7 | * fails. The client should fix the request before retrying. 8 | */ 9 | public class BadRequestException extends Exception { 10 | 11 | public BadRequestException () { 12 | super(); 13 | } 14 | 15 | public BadRequestException(String message) { 16 | super(message); 17 | } 18 | 19 | public BadRequestException(String message, Exception innerException){ 20 | super(message, innerException); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/exceptions/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client is requesting a resource that 9 | * doesn't exist yet. 10 | */ 11 | public class ResourceNotFoundException extends Exception { 12 | public ResourceNotFoundException() { 13 | } 14 | 15 | public ResourceNotFoundException(String message) { 16 | super(message); 17 | } 18 | 19 | public ResourceNotFoundException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/models/DeviceGroup.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.models; 4 | 5 | public class DeviceGroup { 6 | private final String id; 7 | private final String name; 8 | private final String query; 9 | 10 | public DeviceGroup(String id, String name, String query) { 11 | this.id = id; 12 | this.name = name; 13 | this.query = query; 14 | } 15 | 16 | public String getId() { 17 | return this.id; 18 | } 19 | 20 | public String getName() { 21 | return this.name; 22 | } 23 | 24 | public String getQuery() { 25 | return this.query; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /scripts/local/launch/start-dotnet-only-services.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | 4 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../../ && pwd )" 5 | 6 | source $APP_HOME/scripts/local/launch/set_env.sh 7 | source $APP_HOME/scripts/local/launch/.env_uris.sh 8 | 9 | set -e 10 | 11 | echo "Starting Device-Simulation MS ....." 12 | cd $APP_HOME/device-simulation/scripts/docker 13 | ./run >> $APP_HOME/scripts/local/device-simulation.txt & 14 | 15 | echo "Starting ASA-Manager MS ....." 16 | cd $APP_HOME/asa-manager/scripts/docker 17 | ./run >> $APP_HOME/scripts/local/asa-manager.txt & 18 | 19 | echo "Starting PCS-Auth MS ....." 20 | cd $APP_HOME/auth/scripts/docker 21 | ./run >> $APP_HOME/scripts/local/auth.txt & 22 | 23 | set +e 24 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/models/Theme.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | public class Theme { 8 | private String name; 9 | private String description; 10 | public static final Theme Default = new Theme(); 11 | 12 | static { 13 | Default.name = "My Solution"; 14 | Default.description = "My Solution Description"; 15 | } 16 | 17 | @JsonProperty("Name") 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | @JsonProperty("Description") 23 | public String getDescription() { 24 | return description; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/auth/UserClaims.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.webservice.auth; 4 | 5 | import java.util.List; 6 | 7 | public class UserClaims { 8 | private String userObjectId; 9 | private List Roles; 10 | 11 | public UserClaims() { 12 | } 13 | 14 | public String getUserObjectId() { 15 | return userObjectId; 16 | } 17 | 18 | public void setUserObjectId(String userObjectId) { 19 | this.userObjectId = userObjectId; 20 | } 21 | 22 | public List getRoles() { 23 | return Roles; 24 | } 25 | 26 | public void setRoles(List roles) { 27 | Roles = roles; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/v1/exceptions/BadRequestException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.v1.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * This exception is thrown by a controller when the input validation 8 | * fails. The client should fix the request before retrying. 9 | */ 10 | public class BadRequestException extends Exception { 11 | public BadRequestException() { 12 | } 13 | 14 | public BadRequestException(String message) { 15 | super(message); 16 | } 17 | 18 | public BadRequestException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/auth/exceptions/InvalidConfigurationException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.auth.exceptions; 4 | 5 | /** 6 | * This exception is thrown when something is wrong in the 7 | * service configuration. 8 | */ 9 | public class InvalidConfigurationException extends Exception { 10 | 11 | public InvalidConfigurationException() { 12 | super(); 13 | } 14 | 15 | public InvalidConfigurationException(String message) { 16 | super(message); 17 | } 18 | 19 | public InvalidConfigurationException(String message, Exception innerException) { 20 | super(message, innerException); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/webservice/v1/exceptions/BadRequestException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.webservice.v1.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown by a controller when the input validation 9 | * fails. The client should fix the request before retrying. 10 | */ 11 | public class BadRequestException extends Exception { 12 | public BadRequestException() { 13 | } 14 | 15 | public BadRequestException(String message) { 16 | super(message); 17 | } 18 | 19 | public BadRequestException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/auth/exceptions/ExternalDependencyException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.auth.exceptions; 4 | 5 | /** 6 | * This exception is thrown when something goes wrong when talking 7 | * with an external dependency. 8 | */ 9 | public class ExternalDependencyException extends Exception { 10 | 11 | public ExternalDependencyException() { 12 | super(); 13 | } 14 | 15 | public ExternalDependencyException(String message) { 16 | super(message); 17 | } 18 | 19 | public ExternalDependencyException(String message, Exception innerException) { 20 | super(message, innerException); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /config/scripts/docker/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Note: use lowercase names for the Docker images 7 | DOCKER_IMAGE="azureiotpcs/pcs-config-java" 8 | 9 | set -e 10 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 11 | source "$APP_HOME/scripts/.functions.sh" 12 | 13 | run_container() { 14 | check_dependency_docker 15 | 16 | $APP_HOME/scripts/env-vars-check 17 | 18 | echo "Starting Config web service ..." 19 | docker run -it -p 9005:9005 \ 20 | -e PCS_KEYVAULT_NAME \ 21 | -e PCS_AAD_APPID \ 22 | -e PCS_AAD_APPSECRET \ 23 | "$DOCKER_IMAGE:testing" 24 | } 25 | 26 | run_container 27 | 28 | set +e 29 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/runtime/IServicesConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.runtime; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | @ImplementedBy(ServicesConfig.class) 8 | public interface IServicesConfig { 9 | /** 10 | * Get key value storage dependency url 11 | */ 12 | String getKeyValueStorageUrl(); 13 | 14 | /** 15 | * Get user management dependency url 16 | */ 17 | String getUserManagementApiUrl(); 18 | 19 | MessagesConfig getMessagesConfig(); 20 | 21 | AlarmsConfig getAlarmsConfig(); 22 | 23 | ActionsConfig getActionsConfig(); 24 | 25 | DiagnosticsConfig getDiagnosticsConfig(); 26 | } 27 | -------------------------------------------------------------------------------- /asa-manager/scripts/asa/functions/applyRuleFilter.js.json: -------------------------------------------------------------------------------- 1 | { 2 | "JSCode": "// Copyright (c) Microsoft. All rights reserved.\n// This function is called in the shape of 'udf.applyRuleFilter(record)'\n// from ASA query. The JavaScript code snippet encoded as one line string\n// in '__rulefilterjs' will be used to construct a Function callback and\n// evaluated by ASA and return the result to the ASA query to filter the\n// incoming record.\nfunction main(record) {\n let ruleFunction = new Function('record', record.__rulefilterjs);\n return ruleFunction(record);\n}", 3 | "Name": "applyRuleFilter", 4 | "OutputType": "any", 5 | "Type": "Scalar", 6 | "FunctionInputs": [ 7 | { 8 | "DataType": "record", 9 | "IsConfigurationParameter": null 10 | } 11 | ], 12 | "ScriptType": "JSFunction" 13 | } -------------------------------------------------------------------------------- /asa-manager/scripts/travis: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Example usage (see "travis help" for more information): 7 | # travis help 8 | # travis login --pro 9 | # travis whoami --pro 10 | # travis accounts --pro 11 | # travis history 12 | # travis monitor --pro 13 | # travis settings 14 | # travis show 15 | # travis status 16 | # travis token --pro 17 | # travis whatsup --pro 18 | 19 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 20 | cd $APP_HOME 21 | 22 | mkdir -p .travis 23 | 24 | docker run -it \ 25 | -v $APP_HOME/.travis:/root/.travis \ 26 | -v $APP_HOME:/opt/code \ 27 | azureiotpcs/travis-cli:1.8.8 /root/bin/travis.sh $* 28 | 29 | set +e 30 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/exceptions/BaseException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.exceptions; 4 | 5 | /** 6 | * Checked exception for meaningful errors to client side. 7 | * 8 | * This base exception is thrown when a client is requesting a resource. 9 | * Define new exceptions as subclass of this base exception will make the 10 | * exception handling more graceful. 11 | */ 12 | public class BaseException extends Exception { 13 | public BaseException() { 14 | } 15 | 16 | public BaseException(String message) { 17 | super(message); 18 | } 19 | 20 | public BaseException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/exceptions/InvalidInputException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client sends a request badly formatted 9 | * or containing invalid values. The client should fix the request before 10 | * retrying. 11 | */ 12 | public class InvalidInputException extends BaseException { 13 | public InvalidInputException() { 14 | } 15 | 16 | public InvalidInputException(String message) { 17 | super(message); 18 | } 19 | 20 | public InvalidInputException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/auth/UserClaims.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.auth; 4 | 5 | import java.util.List; 6 | 7 | public class UserClaims { 8 | 9 | private String userObjectId; 10 | private List Roles; 11 | 12 | public UserClaims() { 13 | } 14 | 15 | public String getUserObjectId() { 16 | return userObjectId; 17 | } 18 | 19 | public void setUserObjectId(String userObjectId) { 20 | this.userObjectId = userObjectId; 21 | } 22 | 23 | public List getRoles() { 24 | return Roles; 25 | } 26 | 27 | public void setRoles(List roles) { 28 | Roles = roles; 29 | } 30 | } -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/auth/UserClaims.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.auth; 4 | 5 | import java.util.List; 6 | 7 | public class UserClaims { 8 | 9 | private String userObjectId; 10 | private List Roles; 11 | 12 | public UserClaims() { 13 | } 14 | 15 | public String getUserObjectId() { 16 | return userObjectId; 17 | } 18 | 19 | public void setUserObjectId(String userObjectId) { 20 | this.userObjectId = userObjectId; 21 | } 22 | 23 | public List getRoles() { 24 | return Roles; 25 | } 26 | 27 | public void setRoles(List roles) { 28 | Roles = roles; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /scripts/iothub/select-subscription.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | SUBSCRIPTION_ID="$1" 8 | 9 | check_input() { 10 | if [[ -z "$SUBSCRIPTION_ID" ]]; then 11 | announce "Usage: ./select-subscription.sh SUBSCRIPTION_ID" 12 | echo "Use './list-subscriptions.sh' to see the list of subscriptions." 13 | fi 14 | } 15 | 16 | main() { 17 | check_input 18 | check_dependencies 19 | login 20 | 21 | if [[ ! -z "$SUBSCRIPTION_ID" ]]; then 22 | header "Changing current subscription" 23 | #az account set --subscription "$SUBSCRIPTION_ID" 24 | azure account set "$SUBSCRIPTION_ID" 25 | else 26 | select_subscription 27 | fi 28 | } 29 | 30 | main 31 | -------------------------------------------------------------------------------- /auth/scripts/docker/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash -e 2 | 3 | # Note: use lowercase names for the Docker images 4 | DOCKER_IMAGE="azureiotpcs/pcs-auth-dotnet" 5 | 6 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 7 | source "$APP_HOME/scripts/.functions.sh" 8 | 9 | run_container() { 10 | check_dependency_docker 11 | 12 | $APP_HOME/scripts/env-vars-check 13 | 14 | # Some settings are used to connect to an external dependency, e.g. Azure Active Directory 15 | # Depending on which settings and which dependencies are needed, edit the list of variables 16 | echo "Starting Auth ..." 17 | docker run -it -p 9001:9001 \ 18 | -e PCS_AUTH_ISSUER \ 19 | -e PCS_AUTH_AUDIENCE \ 20 | "$DOCKER_IMAGE:testing" 21 | } 22 | 23 | run_container 24 | 25 | set +e 26 | -------------------------------------------------------------------------------- /device-simulation/scripts/travis: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Example usage (see "travis help" for more information): 7 | # travis help 8 | # travis login --pro 9 | # travis whoami --pro 10 | # travis accounts --pro 11 | # travis history 12 | # travis monitor --pro 13 | # travis settings 14 | # travis show 15 | # travis status 16 | # travis token --pro 17 | # travis whatsup --pro 18 | 19 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 20 | cd $APP_HOME 21 | 22 | mkdir -p .travis 23 | 24 | docker run -it \ 25 | -v $APP_HOME/.travis:/root/.travis \ 26 | -v $APP_HOME:/opt/code \ 27 | azureiotpcs/travis-cli:1.8.8 /root/bin/travis.sh $* 28 | 29 | set +e 30 | -------------------------------------------------------------------------------- /asa-manager/scripts/travis.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | @ECHO off & setlocal enableextensions enabledelayedexpansion 4 | 5 | :: Example usage (see "travis help" for more information: 6 | :: travis help 7 | :: travis login --pro 8 | :: travis whoami --pro 9 | :: travis accounts --pro 10 | :: travis history 11 | :: travis monitor --pro 12 | :: travis settings 13 | :: travis show 14 | :: travis status 15 | :: travis token --pro 16 | :: travis whatsup --pro 17 | 18 | :: strlen("\scripts\") => 9 19 | SET APP_HOME=%~dp0 20 | SET APP_HOME=%APP_HOME:~0,-9% 21 | cd %APP_HOME% 22 | 23 | mkdir .travis 2>NUL 24 | 25 | docker run -it ^ 26 | -v %APP_HOME%\.travis:/root/.travis ^ 27 | -v %APP_HOME%:/opt/code ^ 28 | azureiotpcs/travis-cli:1.8.8 /root/bin/travis.sh %* 29 | 30 | endlocal 31 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/exceptions/InvalidInputException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * This exception is thrown when a client sends a request badly formatted 8 | * or containing invalid values. The client should fix the request before 9 | * retrying. 10 | */ 11 | public class InvalidInputException extends Exception { 12 | public InvalidInputException() { 13 | } 14 | 15 | public InvalidInputException(String message) { 16 | super(message); 17 | } 18 | 19 | public InvalidInputException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/exceptions/InvalidInputException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client sends a request badly formatted 9 | * or containing invalid values. The client should fix the request before 10 | * retrying. 11 | */ 12 | public class InvalidInputException extends Exception { 13 | public InvalidInputException() { 14 | } 15 | 16 | public InvalidInputException(String message) { 17 | super(message); 18 | } 19 | 20 | public InvalidInputException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /iothub-manager/scripts/iothub/select-subscription.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | SUBSCRIPTION_ID="$1" 8 | 9 | check_input() { 10 | if [[ -z "$SUBSCRIPTION_ID" ]]; then 11 | announce "Usage: ./select-subscription.sh SUBSCRIPTION_ID" 12 | echo "Use './list-subscriptions.sh' to see the list of subscriptions." 13 | fi 14 | } 15 | 16 | main() { 17 | check_input 18 | check_dependencies 19 | login 20 | 21 | if [[ ! -z "$SUBSCRIPTION_ID" ]]; then 22 | header "Changing current subscription" 23 | #az account set --subscription "$SUBSCRIPTION_ID" 24 | azure account set "$SUBSCRIPTION_ID" 25 | else 26 | select_subscription 27 | fi 28 | } 29 | 30 | main 31 | -------------------------------------------------------------------------------- /storage-adapter/scripts/iothub/select-subscription.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 5 | source "$DIR/.functions.sh" 6 | 7 | SUBSCRIPTION_ID="$1" 8 | 9 | check_input() { 10 | if [[ -z "$SUBSCRIPTION_ID" ]]; then 11 | announce "Usage: ./select-subscription.sh SUBSCRIPTION_ID" 12 | echo "Use './list-subscriptions.sh' to see the list of subscriptions." 13 | fi 14 | } 15 | 16 | main() { 17 | check_input 18 | check_dependencies 19 | login 20 | 21 | if [[ ! -z "$SUBSCRIPTION_ID" ]]; then 22 | header "Changing current subscription" 23 | #az account set --subscription "$SUBSCRIPTION_ID" 24 | azure account set "$SUBSCRIPTION_ID" 25 | else 26 | select_subscription 27 | fi 28 | } 29 | 30 | main 31 | -------------------------------------------------------------------------------- /device-simulation/scripts/travis.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Microsoft. All rights reserved. 2 | 3 | @ECHO off & setlocal enableextensions enabledelayedexpansion 4 | 5 | :: Example usage (see "travis help" for more information: 6 | :: travis help 7 | :: travis login --pro 8 | :: travis whoami --pro 9 | :: travis accounts --pro 10 | :: travis history 11 | :: travis monitor --pro 12 | :: travis settings 13 | :: travis show 14 | :: travis status 15 | :: travis token --pro 16 | :: travis whatsup --pro 17 | 18 | :: strlen("\scripts\") => 9 19 | SET APP_HOME=%~dp0 20 | SET APP_HOME=%APP_HOME:~0,-9% 21 | cd %APP_HOME% 22 | 23 | mkdir .travis 2>NUL 24 | 25 | docker run -it ^ 26 | -v %APP_HOME%\.travis:/root/.travis ^ 27 | -v %APP_HOME%:/opt/code ^ 28 | azureiotpcs/travis-cli:1.8.8 /root/bin/travis.sh %* 29 | 30 | endlocal 31 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/exceptions/InvalidInputException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client sends a request badly formatted 9 | * or containing invalid values. The client should fix the request before 10 | * retrying. 11 | */ 12 | public class InvalidInputException extends Exception { 13 | public InvalidInputException() { 14 | } 15 | 16 | public InvalidInputException(String message) { 17 | super(message); 18 | } 19 | 20 | public InvalidInputException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/models/OperatorType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonValue; 6 | 7 | public enum OperatorType { 8 | GREATERTHAN("GreaterThan"), 9 | GREATERTHANOREQUAL("GreaterThanOrEqual"), 10 | LESSTHAN("LessThan"), 11 | LESSTHANOREQUAL("LessThanOrEqual"), 12 | EQUALS("Equals"); 13 | 14 | private String value = null; 15 | 16 | OperatorType(String operatorStr) { 17 | this.value = operatorStr; 18 | } 19 | 20 | @JsonValue 21 | public String getValue() { 22 | return value; 23 | } 24 | 25 | public String toString() { 26 | return getValue(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /auth/scripts/clean-up: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/" 5 | source "$APP_HOME/scripts/.functions.sh" 6 | 7 | if [[ ${#APP_HOME} -lt 20 ]]; then 8 | error "Unable to detect current folder. Aborting." 9 | exit -1 10 | fi 11 | 12 | cleanup_tmp_files() { 13 | check_dependency_dotnet 14 | 15 | cd $APP_HOME 16 | header "Removing temporary folders and files..." 17 | 18 | rm -fR packages 19 | rm -fR target 20 | rm -fR out 21 | 22 | PROJECTS=$(dotnet sln list | grep 'csproj$') 23 | for PROJ in $PROJECTS; do 24 | PROJ=$(dirname "$PROJ") 25 | cd $PROJ 26 | rm -fR bin/ 27 | rm -fR obj/ 28 | cd $APP_HOME 29 | done 30 | 31 | echo -e "\nDone" 32 | } 33 | 34 | cleanup_tmp_files 35 | 36 | set +e 37 | -------------------------------------------------------------------------------- /iothub-manager/docs/API_SPECS_DEVICE_PROPERTIES.md: -------------------------------------------------------------------------------- 1 | API specifications - Device Properties 2 | ====================================== 3 | 4 | ## Get a list of device properties 5 | 6 | The list of device properties. 7 | 8 | Request: 9 | ``` 10 | GET /v1/deviceproperties 11 | ``` 12 | 13 | Response: 14 | ``` 15 | 200 OK 16 | Content-Type: application/json 17 | ``` 18 | ```json 19 | { 20 | "Items": [ 21 | "tags.Purpose", 22 | "tags.IsSimulated", 23 | "tags.BatchId", 24 | "properties.reported.SupportedMethods", 25 | "properties.reported.Protocol", 26 | "properties.reported.FirmwareUpdateStatus", 27 | "properties.reported.DeviceMethodStatus" 28 | ], 29 | "$metadata": { 30 | "$type": "DevicePropertyList;1", 31 | "$url": "/v1/deviceproperties" 32 | } 33 | } 34 | ``` 35 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/v1/Version.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.v1; 4 | 5 | /** 6 | * Web service API version 1 information. 7 | */ 8 | public final class Version { 9 | /** 10 | * Number used for routing HTTP requests. 11 | */ 12 | public static final String NUMBER = "1"; 13 | 14 | /** 15 | * Name used for routing HTTP requests. 16 | */ 17 | public static final String NAME = "v1"; 18 | 19 | /** 20 | * Path used for routing HTTP requests. 21 | */ 22 | public static final String PATH = "v" + NUMBER; 23 | 24 | /** 25 | * Date when the API version has been published. 26 | */ 27 | public static final String DATE = "201706"; 28 | } 29 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/auth/IUserManagementClient.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.webservice.auth; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | import java.util.List; 8 | import java.util.concurrent.CompletionStage; 9 | 10 | @ImplementedBy(UserManagementClient.class) 11 | public interface IUserManagementClient { 12 | 13 | /** 14 | * Get a list of allowed actions based on current user's id and roles 15 | * @param userObjectId user's object id 16 | * @param roles user's current application role 17 | * @return allowed action list 18 | */ 19 | CompletionStage> getAllowedActions(String userObjectId, List roles) throws ExternalDependencyException; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/exceptions/InvalidConfigurationException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.exceptions; 4 | 5 | /** 6 | * Checked exception for internal errors. 7 | * 8 | * This exception is thrown when the service is configured incorrectly. 9 | * In order to recover, the service owner should fix the configuration 10 | * and re-deploy the service. 11 | */ 12 | public class InvalidConfigurationException extends BaseException { 13 | public InvalidConfigurationException() { 14 | } 15 | 16 | public InvalidConfigurationException(String message) { 17 | super(message); 18 | } 19 | 20 | public InvalidConfigurationException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/exceptions/ResourceOutOfDateException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client attempts to update a resource 9 | * providing the wrong Etag value. The client should retrieve the 10 | * resource again, to have the new Etag, and retry. 11 | */ 12 | public class ResourceOutOfDateException extends BaseException { 13 | public ResourceOutOfDateException() { 14 | } 15 | 16 | public ResourceOutOfDateException(String message) { 17 | super(message); 18 | } 19 | 20 | public ResourceOutOfDateException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /device-simulation/scripts/docker/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Note: Windows Bash doesn't support shebang extra params 4 | set -e 5 | 6 | # Note: use lowercase names for the Docker images 7 | DOCKER_IMAGE="azureiotpcs/device-simulation-dotnet" 8 | 9 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 10 | source "$APP_HOME/scripts/.functions.sh" 11 | 12 | run_container() { 13 | check_dependency_docker 14 | 15 | $APP_HOME/scripts/env-vars-check 16 | 17 | echo "Starting Device Simulation ..." 18 | 19 | docker run -detach -p 9003:9003 \ 20 | -e PCS_IOTHUB_CONNSTRING \ 21 | -e PCS_STORAGEADAPTER_WEBSERVICE_URL="http://host.docker.internal:9022/v1" \ 22 | -e PCS_SUBSCRIPTION_ID \ 23 | "$DOCKER_IMAGE:DS-1.0.3" 24 | } 25 | 26 | run_container 27 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/storage/timeSeries/PropertyModel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.storage.timeSeries; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | public class PropertyModel { 8 | 9 | private String name; 10 | private String type; 11 | 12 | public PropertyModel() { 13 | } 14 | 15 | @JsonProperty("name") 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | @JsonProperty("type") 25 | public String getType() { 26 | return type; 27 | } 28 | 29 | public void setType(String type) { 30 | this.type = type; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/v1/models/AlarmIdListApiModel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.v1.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | import java.util.ArrayList; 8 | 9 | public class AlarmIdListApiModel { 10 | private final ArrayList items; 11 | 12 | public AlarmIdListApiModel() { 13 | this.items = null; 14 | } 15 | 16 | public AlarmIdListApiModel(final ArrayList items) { 17 | this.items = new ArrayList<>(); 18 | if (items != null) { 19 | this.items.addAll(items); 20 | } 21 | } 22 | 23 | @JsonProperty("Items") 24 | public ArrayList getItems() { 25 | return this.items; 26 | } 27 | } -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/exceptions/InvalidConfigurationException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.exceptions; 4 | 5 | /** 6 | * Checked exception for internal errors. 7 | * This exception is thrown when the service is configured incorrectly. 8 | * In order to recover, the service owner should fix the configuration 9 | * and re-deploy the service. 10 | */ 11 | public class InvalidConfigurationException extends Exception { 12 | public InvalidConfigurationException() { 13 | } 14 | 15 | public InvalidConfigurationException(String message) { 16 | super(message); 17 | } 18 | 19 | public InvalidConfigurationException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/exceptions/ResourceOutOfDateException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * This exception is thrown when a client attempts to update a resource 8 | * providing the wrong Etag value. The client should retrieve the 9 | * resource again, to have the new Etag, and retry. 10 | */ 11 | public class ResourceOutOfDateException extends Exception { 12 | public ResourceOutOfDateException() { 13 | } 14 | 15 | public ResourceOutOfDateException(String message) { 16 | super(message); 17 | } 18 | 19 | public ResourceOutOfDateException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/exceptions/InvalidConfigurationException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.exceptions; 4 | 5 | /** 6 | * Checked exception for internal errors. 7 | * 8 | * This exception is thrown when the service is configured incorrectly. 9 | * In order to recover, the service owner should fix the configuration 10 | * and re-deploy the service. 11 | */ 12 | public class InvalidConfigurationException extends Exception { 13 | public InvalidConfigurationException() { 14 | } 15 | 16 | public InvalidConfigurationException(String message) { 17 | super(message); 18 | } 19 | 20 | public InvalidConfigurationException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/exceptions/ResourceOutOfDateException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client attempts to update a resource 9 | * providing the wrong Etag value. The client should retrieve the 10 | * resource again, to have the new Etag, and retry. 11 | */ 12 | public class ResourceOutOfDateException extends Exception { 13 | public ResourceOutOfDateException() { 14 | } 15 | 16 | public ResourceOutOfDateException(String message) { 17 | super(message); 18 | } 19 | 20 | public ResourceOutOfDateException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/exceptions/InvalidConfigurationException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services.exceptions; 4 | 5 | /** 6 | * Checked exception for internal errors. 7 | * 8 | * This exception is thrown when the service is configured incorrectly. 9 | * In order to recover, the service owner should fix the configuration 10 | * and re-deploy the service. 11 | */ 12 | public class InvalidConfigurationException extends Exception { 13 | public InvalidConfigurationException() { 14 | } 15 | 16 | public InvalidConfigurationException(String message) { 17 | super(message); 18 | } 19 | 20 | public InvalidConfigurationException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/services/exceptions/ResourceOutOfDateException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client attempts to update a resource 9 | * providing the wrong Etag value. The client should retrieve the 10 | * resource again, to have the new Etag, and retry. 11 | */ 12 | public class ResourceOutOfDateException extends Exception { 13 | public ResourceOutOfDateException() { 14 | } 15 | 16 | public ResourceOutOfDateException(String message) { 17 | super(message); 18 | } 19 | 20 | public ResourceOutOfDateException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Type of issue 2 | - [ ] Bug 3 | - [ ] New feature 4 | - [ ] Improvement 5 | 6 | # Description 7 | ... 8 | 9 | # Screenshot 10 | 11 | # Steps to reproduce 12 | 1. [First step] 13 | 2. [Second step] 14 | 3. [and so on...] 15 | 16 | # Expected behavior 17 | ... 18 | 19 | # Current behavior 20 | ... 21 | 22 | # Known workarounds 23 | ... 24 | 25 | # Possible solution 26 | ... 27 | 28 | 29 | # Context and Environment 30 | * Operating System: ... 31 | * GitHub branch: ... 32 | * JRE & JDK: ... 33 | * SBT (version): ... 34 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/actionsagent/actions/IActionManager.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.actionsagent.actions; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.devicetelemetry.actionsagent.models.AsaAlarmApiModel; 7 | 8 | import java.util.List; 9 | import java.util.concurrent.CompletionStage; 10 | 11 | /** 12 | * Manage the execution of actions for a list of alarms with 13 | * different action types. 14 | */ 15 | @ImplementedBy(ActionManager.class) 16 | public interface IActionManager { 17 | /** 18 | * 19 | * @param alarms The list of alarms to be executed at a time 20 | * @return the new CompletionStage 21 | */ 22 | CompletionStage executeAsync(List alarms); 23 | } 24 | -------------------------------------------------------------------------------- /asa-manager/scripts/asa/functions/removeUnusedProperties.js.json: -------------------------------------------------------------------------------- 1 | { 2 | "JSCode": "// Copyright (c) Microsoft. All rights reserved.\n// This function is called in the shape of 'udf.removeUnusedProperties(record)'\n// from ASA query. Those unused properties will be removed from record for the\n// next step of ASA query.\nfunction main(record) {\n if (record) {\n record.IoTHub && delete record.IoTHub;\n record.PartitionId && delete record.PartitionId;\n record.EventEnqueuedUtcTime && delete record.EventEnqueuedUtcTime;\n record.EventProcessedUtcTime && delete record.EventProcessedUtcTime;\n }\n return record;\n}", 3 | "Name": "removeUnusedProperties", 4 | "OutputType": "any", 5 | "Type": "Scalar", 6 | "FunctionInputs": [ 7 | { 8 | "DataType": "record", 9 | "IsConfigurationParameter": null 10 | } 11 | ], 12 | "ScriptType": "JSFunction" 13 | } -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/helpers/WsRequestBuilder.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.iotsolutions.uiconfig.services.helpers; 2 | 3 | import com.google.inject.Inject; 4 | import play.libs.ws.WSClient; 5 | import play.libs.ws.WSRequest; 6 | 7 | import java.time.Duration; 8 | 9 | public class WsRequestBuilder { 10 | private WSClient ws; 11 | 12 | @Inject 13 | public WsRequestBuilder(WSClient ws) { 14 | this.ws = ws; 15 | } 16 | 17 | public WSRequest prepareRequest(String url) { 18 | WSRequest wsRequest = this.ws 19 | .url(url) 20 | .addHeader("Content-Type", "application/json") 21 | .addHeader("Cache-Control", "no-cache") 22 | .addHeader("Referer", "Config"); 23 | wsRequest.setRequestTimeout(Duration.ofSeconds(10)); 24 | return wsRequest; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /device-telemetry/scripts/docker/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Note: use lowercase names for the Docker images 4 | DOCKER_IMAGE="azureiotpcs/telemetry-java" 5 | 6 | set -e 7 | APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/" 8 | source "$APP_HOME/scripts/.functions.sh" 9 | 10 | run_container() { 11 | check_dependency_docker 12 | 13 | $APP_HOME/scripts/env-vars-check 14 | 15 | # Some settings are used to connect to an external dependency, e.g. Azure IoT Hub and IoT Hub Manager API 16 | # Depending on which settings and which dependencies are needed, edit the list of variables 17 | echo "Starting telemetry service..." 18 | docker run -it -p 9004:9004 \ 19 | -e PCS_KEYVAULT_NAME \ 20 | -e PCS_AAD_APPID \ 21 | -e PCS_AAD_APPSECRET \ 22 | "$DOCKER_IMAGE:testing" 23 | } 24 | 25 | run_container 26 | 27 | set +e 28 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/webservice/auth/IJwtValidation.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.webservice.auth; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.devicetelemetry.webservice.auth.exceptions.ExternalDependencyException; 7 | import com.microsoft.azure.iotsolutions.devicetelemetry.webservice.auth.exceptions.InvalidConfigurationException; 8 | import com.microsoft.azure.iotsolutions.devicetelemetry.webservice.auth.exceptions.NotAuthorizedException; 9 | 10 | @ImplementedBy(OpenIdConnectJwtValidation.class) 11 | public interface IJwtValidation { 12 | Boolean validateToken(String token) throws InvalidConfigurationException, ExternalDependencyException; 13 | 14 | UserClaims getUserClaims(String token) throws NotAuthorizedException; 15 | } 16 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/models/TwinServiceListModel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.models; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import java.util.List; 7 | 8 | public class TwinServiceListModel { 9 | 10 | private final String continuationToken; 11 | private final List items; 12 | 13 | public TwinServiceListModel(List twins, String continuationToken) { 14 | this.continuationToken = continuationToken; 15 | this.items = twins; 16 | } 17 | 18 | @JsonProperty("Items") 19 | public List getItems() { 20 | return this.items; 21 | } 22 | 23 | public String getContinuationToken() { 24 | return this.continuationToken; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/external/PackageValidation/PackageValidator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.external.PackageValidation; 4 | 5 | import com.fasterxml.jackson.databind.JsonNode; 6 | 7 | import com.microsoft.azure.iotsolutions.uiconfig.services.exceptions.InvalidInputException; 8 | import play.libs.Json; 9 | 10 | public abstract class PackageValidator implements IPackageValidator { 11 | 12 | @Override 13 | public JsonNode getPackageContent(String pckg) throws InvalidInputException { 14 | try { 15 | return Json.parse(pckg); 16 | } 17 | catch (Exception e) { 18 | throw new InvalidInputException("Package provided is not a valid json."); 19 | } 20 | } 21 | 22 | @Override 23 | public abstract Boolean validate(); 24 | } 25 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/external/PackageValidation/PackageValidatorFactory.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.external.PackageValidation; 4 | 5 | import com.microsoft.azure.iotsolutions.uiconfig.services.models.ConfigType; 6 | import com.microsoft.azure.iotsolutions.uiconfig.services.models.PackageType; 7 | 8 | public class PackageValidatorFactory { 9 | public static IPackageValidator GetValidator(PackageType packageType, String configType) 10 | { 11 | if (packageType.equals(PackageType.edgeManifest)) { 12 | return new EdgePackageValidator(); 13 | } 14 | 15 | if (configType.equalsIgnoreCase(ConfigType.firmware.toString())) { 16 | return new FirmwareValidator(); 17 | } else { 18 | return null; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/actionsagent/actions/IActionExecutor.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.actionsagent.actions; 4 | 5 | import com.microsoft.azure.iotsolutions.devicetelemetry.actionsagent.models.AsaAlarmApiModel; 6 | import com.microsoft.azure.iotsolutions.devicetelemetry.services.models.actions.IActionServiceModel; 7 | 8 | import java.util.concurrent.CompletionStage; 9 | 10 | /** 11 | * Executing an action for one alarm. 12 | */ 13 | public interface IActionExecutor { 14 | /** 15 | * 16 | * @param action the action to be executed for the alarm 17 | * @param alarm the alarm to include the information to trigger action 18 | * @return the new CompletionStage 19 | */ 20 | CompletionStage execute(IActionServiceModel action, AsaAlarmApiModel alarm); 21 | } 22 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/runtime/IServicesConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.runtime; 4 | 5 | import java.util.List; 6 | 7 | public interface IServicesConfig { 8 | 9 | /** 10 | * Get Azure IoT Hub connection string. 11 | * 12 | * @return Connection string 13 | */ 14 | String getHubConnString(); 15 | 16 | /** 17 | * Get user management dependency url 18 | */ 19 | String getUserManagementApiUrl(); 20 | 21 | /** 22 | * Get Storage Adapter service URL. 23 | * 24 | * @return Storage Adapter service URL 25 | */ 26 | String getStorageAdapterServiceUrl(); 27 | 28 | int getDevicePropertiesTTL(); 29 | int getDevicePropertiesRebuildTimeout(); 30 | List getDevicePropertiesWhiteList(); 31 | } 32 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/webservice/runtime/IConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.storageadapter.webservice.runtime; 4 | 5 | import com.google.inject.ImplementedBy; 6 | import com.microsoft.azure.iotsolutions.storageadapter.services.exceptions.InvalidConfigurationException; 7 | import com.microsoft.azure.iotsolutions.storageadapter.services.runtime.IServicesConfig; 8 | 9 | @ImplementedBy(Config.class) 10 | public interface IConfig { 11 | /** 12 | * Get the TCP port number where the service listen for requests. 13 | * 14 | * @return TCP port number 15 | */ 16 | int getPort() throws InvalidConfigurationException; 17 | 18 | /** 19 | * @return Service layer configuration 20 | */ 21 | IServicesConfig getServicesConfig() throws InvalidConfigurationException; 22 | } 23 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Types of changes 2 | 3 | - [ ] Bug fix (non-breaking change which fixes an issue) 4 | - [ ] New feature (non-breaking change which adds functionality) 5 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 6 | 7 | # Checklist: 8 | 9 | - [ ] All new and existing tests passed. 10 | - [ ] The code follows the code style and conventions of this project. 11 | - [ ] The change requires a change to the documentation. 12 | - [ ] I have updated the documentation accordingly. 13 | 14 | # Description of the change 15 | 16 | ... 17 | 18 | # Motivation for the change 19 | 20 | ... 21 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/webservice/v1/models/README.md: -------------------------------------------------------------------------------- 1 | Web service models 2 | ================== 3 | 4 | ## Guidelines 5 | 6 | * Do not reference classes from Azure IoT SDK (or other SDKs), but reference them 7 | in the service layer preferably. 8 | * Maintain the API contract with the corresponding .NET project. 9 | * Ensure datetime values are transfered using UTC timezone. 10 | 11 | ## Conventions 12 | 13 | * Add the "ApiModel" suffix to the models in this folder. This allows to 14 | distinguish these classes from the classes in the SDK and in the 15 | service layer. 16 | * Hard code JSON property names using an explicit @JsonProperty attribute 17 | to avoid breaking the API contract in case of refactoring. 18 | * Use CamelCase for the API property names. 19 | * For DateTime fields use org.joda.time.DateTime. 20 | * Format DateTime fields to UTC with format "yyyy-MM-dd'T'HH:mm:ssZZ". 21 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/helpers/WsRequestBuilder.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.iotsolutions.iothubmanager.services.helpers; 2 | 3 | import com.google.inject.Inject; 4 | import play.libs.ws.WSClient; 5 | import play.libs.ws.WSRequest; 6 | 7 | import java.time.Duration; 8 | 9 | public class WsRequestBuilder { 10 | private WSClient ws; 11 | 12 | @Inject 13 | public WsRequestBuilder(WSClient ws) { 14 | this.ws = ws; 15 | } 16 | 17 | public WSRequest prepareRequest(String url) { 18 | WSRequest wsRequest = this.ws 19 | .url(url) 20 | .addHeader("Content-Type", "application/json") 21 | .addHeader("Cache-Control", "no-cache") 22 | .addHeader("Referer", "IotHubManager"); 23 | wsRequest.setRequestTimeout(Duration.ofSeconds(10)); 24 | return wsRequest; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/http/IHttpClient.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.http; 4 | 5 | import com.google.inject.ImplementedBy; 6 | 7 | import java.util.concurrent.CompletionStage; 8 | 9 | @ImplementedBy(HttpClient.class) 10 | public interface IHttpClient { 11 | 12 | CompletionStage getAsync(IHttpRequest request); 13 | 14 | CompletionStage postAsync(IHttpRequest request); 15 | 16 | CompletionStage putAsync(IHttpRequest request); 17 | 18 | CompletionStage patchAsync(IHttpRequest request); 19 | 20 | CompletionStage deleteAsync(IHttpRequest request); 21 | 22 | CompletionStage headAsync(IHttpRequest request); 23 | 24 | CompletionStage optionsAsync(IHttpRequest request); 25 | } 26 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/helpers/WsRequestBuilder.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.helpers; 2 | 3 | import com.google.inject.Inject; 4 | import play.libs.ws.WSClient; 5 | import play.libs.ws.WSRequest; 6 | 7 | import java.time.Duration; 8 | 9 | public class WsRequestBuilder { 10 | private WSClient ws; 11 | 12 | @Inject 13 | public WsRequestBuilder(WSClient ws) { 14 | this.ws = ws; 15 | } 16 | 17 | public WSRequest prepareRequest(String url) { 18 | WSRequest wsRequest = this.ws 19 | .url(url) 20 | .addHeader("Content-Type", "application/json") 21 | .addHeader("Cache-Control", "no-cache") 22 | .addHeader("Referer", "Device Telemetry"); 23 | wsRequest.setRequestTimeout(Duration.ofSeconds(10)); 24 | return wsRequest; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/webservice/v1/models/README.md: -------------------------------------------------------------------------------- 1 | Web service models 2 | ================== 3 | 4 | ## Guidelines 5 | 6 | * Do not reference classes from Azure IoT SDK (or other SDKs), but reference them 7 | in the service layer preferably. 8 | * Maintain the API contract with the corresponding .NET project. 9 | * Ensure datetime values are transfered using UTC timezone. 10 | 11 | ## Conventions 12 | 13 | * Add the "ApiModel" suffix to the models in this folder. This allows to 14 | distinguish these classes from the classes in the SDK and in the 15 | service layer. 16 | * Hard code JSON property names using an explicit @JsonProperty attribute 17 | to avoid breaking the API contract in case of refactoring. 18 | * Use CamelCase for the API property names. 19 | * For DateTime fields use org.joda.time.DateTime. 20 | * Format DateTime fields to UTC with format "yyyy-MM-dd'T'HH:mm:ssZZ". 21 | -------------------------------------------------------------------------------- /storage-adapter/app/com/microsoft/azure/iotsolutions/storageadapter/webservice/v1/models/README.md: -------------------------------------------------------------------------------- 1 | Web service models 2 | ================== 3 | 4 | ## Guidelines 5 | 6 | * Do not reference classes from Azure IoT SDK (or other SDKs), but reference them 7 | in the service layer preferably. 8 | * Maintain the API contract with the corresponding .NET project. 9 | * Ensure datetime values are transfered using UTC timezone. 10 | 11 | ## Conventions 12 | 13 | * Add the "ApiModel" suffix to the models in this folder. This allows to 14 | distinguish these classes from the classes in the SDK and in the 15 | service layer. 16 | * Hard code JSON property names using an explicit @JsonProperty attribute 17 | to avoid breaking the API contract in case of refactoring. 18 | * Use CamelCase for the API property names. 19 | * For DateTime fields use org.joda.time.DateTime. 20 | * Format DateTime fields to UTC with format "yyyy-MM-dd'T'HH:mm:ssZZ". 21 | -------------------------------------------------------------------------------- /config/app/com/microsoft/azure/iotsolutions/uiconfig/services/exceptions/ConflictingResourceException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.uiconfig.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client attempts to create a resource 9 | * which would conflict with an existing one, for instance using the same 10 | * identifier. The client should change the identifier or assume the 11 | * resource has already been created. 12 | */ 13 | public class ConflictingResourceException extends BaseException { 14 | public ConflictingResourceException() { 15 | } 16 | 17 | public ConflictingResourceException(String message) { 18 | super(message); 19 | } 20 | 21 | public ConflictingResourceException(String message, Throwable cause) { 22 | super(message, cause); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/external/DeviceGroupFiltersApiModel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.external; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | import java.util.HashSet; 8 | 9 | public class DeviceGroupFiltersApiModel { 10 | 11 | private HashSet tags; 12 | 13 | private HashSet reported; 14 | 15 | @JsonProperty("Tags") 16 | public HashSet getTags() { 17 | return tags; 18 | } 19 | 20 | public void setTags(HashSet tags) { 21 | this.tags = tags; 22 | } 23 | 24 | @JsonProperty("Reported") 25 | public HashSet getReported() { 26 | return reported; 27 | } 28 | 29 | public void setReported(HashSet reported) { 30 | this.reported = reported; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/exceptions/ExternalDependencyException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * This exception is thrown when a client attempts to create a resource 8 | * which would conflict with an existing one, for instance using the same 9 | * identifier. The client should change the identifier or assume the 10 | * resource has already been created. 11 | */ 12 | public class ExternalDependencyException extends Exception { 13 | public ExternalDependencyException() { 14 | } 15 | 16 | public ExternalDependencyException(String message) { 17 | super(message); 18 | } 19 | 20 | public ExternalDependencyException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/runtime/AlarmsConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.runtime; 4 | 5 | public class AlarmsConfig { 6 | 7 | private final String storageType; 8 | private final StorageConfig storageConfig; 9 | private final int maxDeleteRetries; 10 | 11 | public AlarmsConfig( 12 | String storageType, 13 | StorageConfig storageConfig, 14 | int maxDeleteRetries) { 15 | 16 | this.storageType = storageType; 17 | this.storageConfig = storageConfig; 18 | this.maxDeleteRetries = maxDeleteRetries; 19 | } 20 | 21 | public int getMaxDeleteRetries() { 22 | return this.maxDeleteRetries; 23 | } 24 | 25 | public StorageConfig getStorageConfig() { 26 | return this.storageConfig; 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/exceptions/ConflictingResourceException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * This exception is thrown when a client attempts to create a resource 8 | * which would conflict with an existing one, for instance using the same 9 | * identifier. The client should change the identifier or assume the 10 | * resource has already been created. 11 | */ 12 | public class ConflictingResourceException extends Exception { 13 | public ConflictingResourceException() { 14 | } 15 | 16 | public ConflictingResourceException(String message) { 17 | super(message); 18 | } 19 | 20 | public ConflictingResourceException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /device-telemetry/app/com/microsoft/azure/iotsolutions/devicetelemetry/services/models/MessageListServiceModel.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.devicetelemetry.services.models; 4 | 5 | import java.util.ArrayList; 6 | 7 | public class MessageListServiceModel { 8 | 9 | ArrayList messages = new ArrayList<>(); 10 | ArrayList properties = new ArrayList<>(); 11 | 12 | public MessageListServiceModel( 13 | ArrayList messages, 14 | ArrayList properties) { 15 | 16 | if (messages != null) this.messages = messages; 17 | if (properties != null) this.properties = properties; 18 | } 19 | 20 | public ArrayList getMessages() { 21 | return messages; 22 | } 23 | 24 | public ArrayList getProperties() { 25 | return properties; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iothub-manager/app/com/microsoft/azure/iotsolutions/iothubmanager/services/exceptions/ConflictingResourceException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | package com.microsoft.azure.iotsolutions.iothubmanager.services.exceptions; 4 | 5 | /** 6 | * Checked exception for request errors. 7 | * 8 | * This exception is thrown when a client attempts to create a resource 9 | * which would conflict with an existing one, for instance using the same 10 | * identifier. The client should change the identifier or assume the 11 | * resource has already been created. 12 | */ 13 | public class ConflictingResourceException extends Exception { 14 | public ConflictingResourceException() { 15 | } 16 | 17 | public ConflictingResourceException(String message) { 18 | super(message); 19 | } 20 | 21 | public ConflictingResourceException(String message, Throwable cause) { 22 | super(message, cause); 23 | } 24 | } 25 | --------------------------------------------------------------------------------