From 899096ad7de75c49ec6e3fc7c7dac9ff11bae4e7 Mon Sep 17 00:00:00 2001 From: avagraw <51140335+avagraw@users.noreply.github.com> Date: Mon, 26 Jul 2021 17:53:10 -0700 Subject: [PATCH] Merge dev changes (#395) * Introducing IoT Hub dataplane RBAC support + various improvements (#341) * Introducing IoT Hub dataplane RBAC support. * IoT Hub rbac support for most commands. * Removed deprecated nested IoT edge artifacts. * Removed deprecated show-connection-string artifacts. * --auth-type supports configurable defaults. * Improved IoT Hub test infrastructure. * Significant refactor of IoT Hub tests. * Various additional improvements. * All warnings from tests are now shown. * Uamqp integration with jwt auth. * Modify HISTORY.rst * Iotc command versioning (#340) * add support for v1 and preview routes * update history file * address review comments * lint fixes * Add warning for qos deprecation and update contributing guide (#342) * Add warning for qos deprecation and update contributing guide * removing version from deprecate_info * Integration tests command update in Contributing guide * Iotc command ga (#348) * remove preview tags * history updates * Use enum value instead of literal str. (#349) * Managed identity support for device-identity import and export (#344) * Fix for new identity parameter format * test updates * better differentiation of storage vars * updated to remove *all* user-identitites after storage tests until CLI core is patched * Update azext_metadata.json (#351) * Increment version to v0.10.13 * Update README.md * Update HISTORY.rst * Add dataplane reset (#352) * pr comments * update dt reset to only support deleting both * Remove unused import * C2D messaging improvements. (#354) * Remove hiding of warnings from sample pytest.ini * Digital Twin wait commands (#345) * update to use wait * fix error status code * int testing * update help * Add Identity Storage Account ID param to sentinel values (#355) * Module identity renew key (#356) * initial changes * update params, help * add missing module to test * Word change * Update README.md * Pipeline updates (#359) * Pipeline updates Added nightly build pipeline Added template to run tests against minimum supported AZ CLI * Pipeline parameter refactoring * Moved deprecated ubuntu images to `ubuntu-latest` Co-authored-by: Paymaun * Check for conditionals before running test jobs (#363) * Update d2c and simulate commands to return errors for non SaS devices - update help to reflect the change (#346) * Add warning for qos deprecation and update contributing guide * removing version from deprecate_info * Integration tests command update in Contributing guide * Update help message for d2c command and mqtt simulation to indicate only sas auth is supported * Checks and error messages when non SAS devices are used for MQTT operations * Indentation update in help file * fix styling * Adding enum and updating test * Addressed comments * Update simulate message (#371) IoTHub is not a MQTT Broker * Make gitHubConnection a variable. (#373) * Iotc updates (#368) * initial commit * add integration tests. * history file update. lint fixes * history updates * Update HISTORY.rst * address review comments Co-authored-by: Ryan K * Edge deployment validation changes. (#382) * Only system module content is validated by default. * The target schema used is with respect to "schemaVersion" in "properties.desired". * Any schema defintion processing issues will skip validation. * Couple linter fixes. (#384) * Extend generate token (#375) * generate sas token with all parsers * style fixes * update param, parser enum * updates with respect to pr * updated error message * Roll pipeline ubuntu versions back to Ubuntu-16.04 (#386) * Support for upcoming changes in Track 2 SDKs (#383) * Initial DPS track 2 breaking change fixes * Test update to patch azure cli core Profile.get_subscription_id * revert change of unit test subscription id * Remove six (#387) Co-authored-by: Paymaun * Separate IoT Hub per test suite to enable parallel test execution * Addressed comments * minor update * test environment pipeline updates * Update help for --login and --hub-name (#389) * Update mock import. (#391) * Refactoring and addressing comments * Update setup.py * fstrings fix * Formatting updates to tests * Create one hub per test suite and provide Data contributor role to user * Account refresh and test class parallel run * remove commented parts of test * lint updates * Merge with dev * Azure devops merge fix Co-authored-by: Paymaun Co-authored-by: valluriraj Co-authored-by: Ryan K Co-authored-by: Paymaun Heidari Co-authored-by: vilit1 <73560279+vilit1@users.noreply.github.com> Co-authored-by: Ricardo Minguez (Rido) --- HISTORY.rst | 8 ++++++++ azext_iot/central/command_map.py | 11 +++++++++++ azext_iot/central/models/__init__.py | 4 ++++ azext_iot/central/params.py | 7 +++++++ azext_iot/central/providers/preview/__init__.py | 9 +++++++++ azext_iot/constants.py | 2 +- azext_iot/tests/central/test_iot_central_unit.py | 4 ++++ 7 files changed, 44 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 6a1cb17df..1ae89c7a3 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,14 @@ Release History =============== +0.10.15 ++++++++++++++++ + +**IoT Central updates** + +* Adds support for listing device groups +* Adds support for listing roles and get role by id + 0.10.14 +++++++++++++++ diff --git a/azext_iot/central/command_map.py b/azext_iot/central/command_map.py index 52da2a4b5..1d8b185eb 100644 --- a/azext_iot/central/command_map.py +++ b/azext_iot/central/command_map.py @@ -111,6 +111,17 @@ def load_central_commands(self, _): cmd_group.command("create", "create_device_template") cmd_group.command("delete", "delete_device_template") + with self.command_group( + "iot central device-group", command_type=central_device_groups_ops, is_preview=True + ) as cmd_group: + cmd_group.command("list", "list_device_groups") + + with self.command_group( + "iot central role", command_type=central_roles_ops, is_preview=True + ) as cmd_group: + cmd_group.show_command("show", "get_role") + cmd_group.command("list", "list_roles") + with self.command_group( "iot central device twin", command_type=central_device_twin_ops, ) as cmd_group: diff --git a/azext_iot/central/models/__init__.py b/azext_iot/central/models/__init__.py index cc1abd64c..475d899bf 100644 --- a/azext_iot/central/models/__init__.py +++ b/azext_iot/central/models/__init__.py @@ -8,12 +8,16 @@ from azext_iot.central.models.devicetwin import DeviceTwin from azext_iot.central.models.templatepreview import TemplatePreview from azext_iot.central.models.templatev1 import TemplateV1 +from azext_iot.central.models.deviceGroupPreview import DeviceGroupPreview +from azext_iot.central.models.rolePreview import RolePreview __all__ = [ "DevicePreview", + "DeviceGroupPreview", "DeviceV1", "DeviceTwin", "TemplatePreview", "TemplateV1", + "RolePreview" ] diff --git a/azext_iot/central/params.py b/azext_iot/central/params.py index d6f5d7e56..e865d07a8 100644 --- a/azext_iot/central/params.py +++ b/azext_iot/central/params.py @@ -215,3 +215,10 @@ def load_central_arguments(self, _): options_list=["--module-id", "-m"], help="Provide IoT Edge Module ID if the device type is IoT Edge.", ) + + with self.argument_context("iot central role") as context: + context.argument( + "role_id", + options_list=["--role-id", "-r"], + help="Provide a unique identifier for the role" + ) diff --git a/azext_iot/central/providers/preview/__init__.py b/azext_iot/central/providers/preview/__init__.py index f47cdd416..db856a08e 100644 --- a/azext_iot/central/providers/preview/__init__.py +++ b/azext_iot/central/providers/preview/__init__.py @@ -17,10 +17,19 @@ from azext_iot.central.providers.preview.api_token_provider_preview import ( CentralApiTokenProviderPreview, ) +from azext_iot.central.providers.preview.device_group_provider_preview import ( + CentralDeviceGroupProviderPreview +) +from azext_iot.central.providers.preview.role_provider_preview import ( + CentralRoleProviderPreview +) __all__ = [ "CentralDeviceProviderPreview", "CentralDeviceTemplateProviderPreview", "CentralUserProviderPreview", "CentralApiTokenProviderPreview", + "CentralDeviceGroupProviderPreview", + "CentralRoleProviderPreview" + ] diff --git a/azext_iot/constants.py b/azext_iot/constants.py index b3e2dcf63..f00235ede 100644 --- a/azext_iot/constants.py +++ b/azext_iot/constants.py @@ -7,7 +7,7 @@ import os -VERSION = "0.10.14" +VERSION = "0.10.15" EXTENSION_NAME = "azure-iot" EXTENSION_ROOT = os.path.dirname(os.path.abspath(__file__)) EXTENSION_CONFIG_ROOT_KEY = "iotext" diff --git a/azext_iot/tests/central/test_iot_central_unit.py b/azext_iot/tests/central/test_iot_central_unit.py index f93438e40..717a343d1 100644 --- a/azext_iot/tests/central/test_iot_central_unit.py +++ b/azext_iot/tests/central/test_iot_central_unit.py @@ -19,6 +19,10 @@ CentralDeviceProviderV1, CentralDeviceTemplateProviderV1, ) +from azext_iot.central.providers.preview import ( + CentralDeviceGroupProviderPreview, + CentralRoleProviderPreview +) from azext_iot.central.models.devicetwin import DeviceTwin from azext_iot.central import models as central_models from azext_iot.monitor.property import PropertyMonitor