This sample demonstrates how to manage registries and devices for the Google Cloud IoT Core product.
This sample requires .NET Core 2.0 or later. That means using Visual Studio 2017, or the command line.
-
Follow the set-up instructions in the documentation.
-
Enable APIs for your project. Click here to visit Cloud Platform Console and enable the Google Cloud IoT Core API.
-
Set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable to the service account JSON from the Google Cloud Console:
PS > $env:GOOGLE_APPLICATION_CREDENTIALS="creds.json"- Set the
GOOGLE_PROJECT_IDenvironment variable:
PS > $env:GOOGLE_PROJECT_ID="your-project-id"- From a Powershell command line, restore the NuGet packages and call
runto see a list of subcommands like getRegistry or getDevice:PS C:\...\dotnet-docs-samples\iot\api\CloudIotSample> dotnet restore PS C:\...\dotnet-docs-samples\iot\api\CloudIotSample> dotnet run CloudIotSample 1.0.0 Copyright (C) 2018 CloudIotSample createRegistry Create a new Device registry. deleteRegistry Delete a registry. getRegistry Retrieve a registry. listRegistries List the registry IDs. createDeviceNoAuth Create a device without associated credentials. createDeviceEs Create device with ES encryption type. createDeviceRsa Create device with RSA encryption type. deleteDevice Delete a device from a registry. getDevice Retrieve information for a specific device. getDeviceConfigs Retrieve configurations for a specific device. getIamPolicy Get the IAM policy for a device registry. listDevices List devices in the provided Cloud IoT Core Registry. patchDeviceEs Patch device with ES encryption type. patchDeviceRsa Create device with RSA encryption type. setDeviceConfig Set the configuration data for a device. setIamPolicy Set the IAM policy for a device registry. help Display more information on a specific command. version Display version information.
- See CONTRIBUTING.md
- See LICENSE
- See TESTING.md