Closed alexg-axis closed 2 years ago
Implement File Upload over HTTP according to https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/iot-hub/iot-hub-devguide-file-upload.md#device-initialize-a-file-upload.
Device:
Service:
Closes #56
To test:
Set up an Azure IoTHub and an Azure Storage Account. Configure File Upload for the IoTHub to use the Storage Account.
go build -o iot-device cmd/iothub-device/main.go go build -o iot-service cmd/iothub-service/main.go
Then, in one terminal:
export IOTHUB_SERVICE_CONNECTION_STRING="xxx" ./iot-service watch-file-notifications
In another terminal, upload a file:
export IOTHUB_DEVICE_CONNECTION_STRING="xxx" ./iot-device -transport http file-upload ./path/to/file.txt
After a few seconds the file notification will be printed.
{ "deviceId": "my-device", "blobUri": "https://my-blob.blob.core.windows.net/iothub/my-device/file.txt", "blobName": "file.txt", "lastUpdatedTime": "2021-11-15T12:50:31Z", "blobSizeInBytes": 6, "enqueuedTimeUtc": "2021-11-15T12:50:32.3018639Z" }
Resources:
Thanks for the PR, in general everything looks good, just a few thins to polish.
Please add at least one test
Thanks for the contribution
Implement File Upload over HTTP according to https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/iot-hub/iot-hub-devguide-file-upload.md#device-initialize-a-file-upload.
Device:
Service:
Closes #56
To test:
Set up an Azure IoTHub and an Azure Storage Account. Configure File Upload for the IoTHub to use the Storage Account.
Then, in one terminal:
In another terminal, upload a file:
After a few seconds the file notification will be printed.