|
| 1 | +# Introduction of tags for device and thing |
| 2 | + |
| 3 | +## Review Period |
| 4 | + |
| 5 | +Best before October, 18 2021. |
| 6 | + |
| 7 | +## What is the problem? |
| 8 | +We need to design the commands to **handle tags** for things and devices. Tags could be attached and detached to/from any thing or device. Also, certain commands could take tags as input in order to perform operations on multiple things/devices. |
| 9 | + |
| 10 | +## Out-of-Scope |
| 11 | + |
| 12 | +## User Experience Walkthrough |
| 13 | + |
| 14 | + |
| 15 | +## Implementation |
| 16 | + |
| 17 | +### Project Changes |
| 18 | + |
| 19 | +Commands that could regard multiple things or devices could be changed in order to accept tags. |
| 20 | + |
| 21 | +These commands can be: |
| 22 | + |
| 23 | +list commands: |
| 24 | + |
| 25 | +`thing list --tag <key0>=<value0>,<key1>=<value1>` to list all the things having all the tags passed |
| 26 | +`device list --tag <key0>=<value0>,<key1>=<value1>` to list all the devices having all the tags passed |
| 27 | +alternative: `--filter` instead of `--tag` |
| 28 | + |
| 29 | + |
| 30 | +delete commands: |
| 31 | + |
| 32 | +`thing delete --tag <key0>=<value0>,<key1>=<value1>` to delete all the things having all the tags passed |
| 33 | +`device delete --tag <key0>=<value0>,<key1>=<value1>` to delete all the devices having all the tags passed |
| 34 | + |
| 35 | + |
| 36 | +ota command: |
| 37 | + |
| 38 | +`ota upload --device-tag <key0>=<value0>,<key1>=<value1> --file <sketch-file.ino.bin>` to perform an upload via ota to all the devices having all the tags passed |
| 39 | + |
| 40 | + |
| 41 | +To be decided, **which flag is mandatory and which is optional**: |
| 42 | +In delete and ota commands, the `--id` flag should become **optional** instead of mandatory. |
| 43 | +Then, if neither `--id` nor `--tag` is passed, the command could return an error telling the user to specify at least one of the two flags. |
| 44 | +On the other hand, if both flags are passed, we could follow different approaches: return an error, use only one flag (only tags or only id), try to use both flags. |
| 45 | + |
| 46 | +Another thing to be decided is **how to handle errors**: |
| 47 | +- Try to execute the command on all the indicated resources, without stopping in case of errors. At the end, print all the errors details. |
| 48 | +- Stop as soon as an error is encountered. |
| 49 | + |
| 50 | +### Breaking Change |
| 51 | + |
| 52 | +The changes listed above should not break anything, the commands could be used as before. |
| 53 | + |
| 54 | +### Design |
| 55 | + |
| 56 | +New commands should be introduced in order to add and delete tags to devices and things. Here are some alternatives: |
| 57 | + |
| 58 | +Implementing a tag command: |
| 59 | +`arduino-cloud-cli tag create --thing <thingID> --tags <key0>=<value0>,<key1>=<value1>` |
| 60 | + |
| 61 | +Adding a tag subcommand in device and thing commands: |
| 62 | +`arduino-cloud-cli thing create-tags --thing <thingID> --tags <key0>=<value0>,<key1>=<value1>` and same for device |
| 63 | + |
| 64 | + |
| 65 | +### Documentation Changes |
| 66 | + |
| 67 | +Readme should be updated |
| 68 | + |
| 69 | +## Additional Notes |
| 70 | + |
| 71 | +https://arduino.atlassian.net/jira/software/projects/IOT/boards/277?selectedIssue=IOT-1359 |
0 commit comments