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 |
--------------------------------------------------------------------------------