Skip to content

Commit

Permalink
Add IoT Central Edge commands (#495)
Browse files Browse the repository at this point in the history
* adding edge commands
  • Loading branch information
lucadruda authored Mar 16, 2022
1 parent bd8bd31 commit 5fcd9a9
Show file tree
Hide file tree
Showing 23 changed files with 1,905 additions and 95 deletions.
16 changes: 16 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ Release History

* Updated both controlplane and dataplane SDKs to now use the newer 2021-06-30-preview API version.

**IoT Central updates**

* Added commands for Edge devices and modules:
- az iot central device edge module
- az iot central device edge module list
- az iot central device edge module restart
- az iot central device edge module show

- az iot central device edge manifest
- az iot central device edge manifest show

- az iot central device edge children
- az iot central device edge children list
- az iot central device edge children add
- az iot central device edge children remove

* Added `--no-wait` parameter to the following functions:

- az dt create
Expand Down
126 changes: 126 additions & 0 deletions azext_iot/central/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def load_central_help():
_load_central_compute_device_key()
_load_central_export_help()
_load_central_c2d_message_help()
_load_central_edge_help()


def _load_central_export_help():
Expand Down Expand Up @@ -1302,3 +1303,128 @@ def _load_central_monitors_help():
type: command
short-summary: Get the device twin from IoT Hub.
"""


def _load_central_edge_help():
helps[
"iot central device edge"
] = """
type: group
short-summary: Manage and configure IoT Central edge devices
"""

helps[
"iot central device edge module"
] = """
type: group
short-summary: Manage IoT Edge device modules.
"""

helps[
"iot central device edge children"
] = """
type: group
short-summary: Manage IoT Edge device children devices.
"""

helps[
"iot central device edge manifest"
] = """
type: group
short-summary: Manage IoT Edge device manifests.
"""

helps[
"iot central device edge module list"
] = """
type: command
short-summary: Get the list of modules in an IoT Edge device.
examples:
- name: List all modules in a device. (default)
text: >
az iot central device edge module list
--app-id {appid}
--device-id {deviceId}
"""

helps[
"iot central device edge module restart"
] = """
type: command
short-summary: Restart a module in an IoT Edge device.
examples:
- name: Restart a module in a device.
text: >
az iot central device edge module restart
--app-id {appid}
--device-id {deviceId}
--module-id {moduleId}
"""

helps[
"iot central device edge module show"
] = """
type: command
short-summary: Get a module in an IoT Edge device.
examples:
- name: Get a module in a device.
text: >
az iot central device edge module show
--app-id {appid}
--device-id {deviceId}
--module-id {moduleId}
"""

helps[
"iot central device edge manifest show"
] = """
type: command
short-summary: Get the deployment manifest associated to the specified IoT Edge device.
examples:
- name: Get a deployment manifest.
text: >
az iot central device edge manifest show
--app-id {appid}
--device-id {deviceId}
"""

helps[
"iot central device edge children list"
] = """
type: command
short-summary: Get the list of children of an IoT Edge device.
examples:
- name: List all children of a device.
text: >
az iot central device edge children list
--app-id {appid}
--device-id {deviceId}
"""

helps[
"iot central device edge children add"
] = """
type: command
short-summary: Add devices as children to a target edge device.
examples:
- name: Add space-separated list of device Ids as children to the target edge device.
text: >
az iot central device edge children add
--app-id {appid}
--device-id {deviceId}
--children-ids {child_1} {child_2}
"""

helps[
"iot central device edge children remove"
] = """
type: command
short-summary: Remove child devices from a target edge device.
examples:
- name: Remove children.
text: >
az iot central device edge children remove
--app-id {appid}
--device-id {deviceId}
--children-ids {child_1} {child_2}
"""
23 changes: 23 additions & 0 deletions azext_iot/central/command_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,26 @@ def load_central_commands(self, _):
cmd_group.command("resume", "resume_job")
cmd_group.command("get-devices", "get_job_devices")
cmd_group.command("rerun", "rerun_job")

with self.command_group(
"iot central device edge children", command_type=central_device_ops
) as cmd_group:
cmd_group.command("list", "list_children")
cmd_group.command("add", "add_children", is_preview=True)
cmd_group.command("remove", "remove_children", is_preview=True)

with self.command_group(
"iot central device edge module",
command_type=central_device_ops,
is_preview=True,
) as cmd_group:
cmd_group.command("list", "list_device_modules")
cmd_group.show_command("show", "get_device_module")
cmd_group.command("restart", "restart_device_module")

with self.command_group(
"iot central device edge manifest",
command_type=central_device_ops,
is_preview=True,
) as cmd_group:
cmd_group.show_command("show", "get_edge_manifest")
Loading

0 comments on commit 5fcd9a9

Please sign in to comment.