Skip to content

Commit a19a1b3

Browse files
authored
chore: upgrade IOT samples to new format (GoogleCloudPlatform#1379)
1 parent 8d613e5 commit a19a1b3

29 files changed

+303
-644
lines changed

iot/README.md

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -28,47 +28,15 @@ IOT API from PHP. These samples are best seen in the context of the
2828
4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md).
2929
Run `php composer.phar install` (if composer is installed locally) or `composer install`
3030
(if composer is installed globally).
31-
5. Run `php iot.php`. The following commands are available:
32-
33-
```
34-
bind-device-to-gateway (Beta feature) Bind a device to a gateway.
35-
create-es-device Create a new device with the given id, using ES256 for authentication.
36-
create-gateway (Beta feature) Create a new gateway with the given id.
37-
create-registry Creates a registry and returns the result.
38-
create-rsa-device Create a new device with the given id, using RS256 for authentication.
39-
create-unauth-device Create a new device without authentication.
40-
delete-device Delete the device with the given id.
41-
delete-gateway (Beta feature) Delete the gateway with the given id.
42-
delete-registry Deletes the specified registry.
43-
get-device Retrieve the device with the given id.
44-
get-device-configs Lists versions of a device config in descending order (newest first).
45-
get-device-state Retrieve a device's state blobs.
46-
get-iam-policy Retrieves IAM permissions for the given registry.
47-
get-registry Retrieves a device registry.
48-
help Displays help for a command
49-
list Lists commands
50-
list-devices List all devices in the registry.
51-
list-devices-for-gateway List devices for the given gateway.
52-
list-gateways List gateways for the given registry.
53-
list-registries List all registries in the project.
54-
patch-es-device Patch device with ES256 public key.
55-
patch-rsa-device Patch device with RSA256 certificate.
56-
send-command-to-device Sends a command to a device.
57-
set-device-config Set a device's configuration.
58-
set-device-state Sets the state of a device.
59-
set-iam-policy Sets IAM permissions for the given registry to a single role/member.
60-
unbind-device-from-gateway (Beta feature) Unbind a device from a gateway.
61-
62-
Example:
63-
64-
```
65-
$ php iot.php create-registry my-registry my-pubsub-topic
66-
Creating Registry
67-
Id: my-registry, Name: projects/my-project/locations/us-central1/registries/my-registry
68-
```
31+
5. To run the IOT Samples, run any of the files in `src/` on the CLI. Run them without arguments to print usage instructions:
32+
```
33+
$ php src/list_registries.php
6934
35+
Usage: list_registries.php $projectId [$location='us-central1']
7036
71-
6. Run `php iot.php COMMAND --help` to print information about the usage of each command.
37+
@param string $projectId Google Cloud project ID
38+
@param string $location (Optional) Google Cloud region
39+
```
7240

7341
## Contributing changes
7442

iot/composer.json

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,6 @@
22
"name": "google/iot-sample",
33
"type": "project",
44
"require": {
5-
"google/cloud-iot": "^1.0.0",
6-
"symfony/console": "^4.0"
7-
},
8-
"autoload": {
9-
"files": [
10-
"src/bind_device_to_gateway.php",
11-
"src/create_es_device.php",
12-
"src/create_gateway.php",
13-
"src/create_registry.php",
14-
"src/create_rsa_device.php",
15-
"src/create_unauth_device.php",
16-
"src/delete_device.php",
17-
"src/delete_gateway.php",
18-
"src/delete_registry.php",
19-
"src/get_iam_policy.php",
20-
"src/get_device.php",
21-
"src/get_device_state.php",
22-
"src/get_device_configs.php",
23-
"src/get_registry.php",
24-
"src/list_devices.php",
25-
"src/list_devices_for_gateway.php",
26-
"src/list_gateways.php",
27-
"src/list_registries.php",
28-
"src/patch_es.php",
29-
"src/patch_rsa.php",
30-
"src/send_command_to_device.php",
31-
"src/set_device_config.php",
32-
"src/set_device_state.php",
33-
"src/set_iam_policy.php",
34-
"src/unbind_device_from_gateway.php"
35-
]
5+
"google/cloud-iot": "^1.0.0"
366
}
377
}

0 commit comments

Comments
 (0)