Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def default_api_version(self):
}),
ResourceType.MGMT_MSI: '2022-01-31-preview',
ResourceType.MGMT_APPSERVICE: '2022-03-01',
ResourceType.MGMT_IOTHUB: '2021-07-02',
ResourceType.MGMT_IOTHUB: '2022-04-30-preview',
Comment thread
vilit1 marked this conversation as resolved.
ResourceType.MGMT_IOTDPS: '2021-10-15',
ResourceType.MGMT_IOTCENTRAL: '2021-11-01-preview',
ResourceType.MGMT_ARO: '2022-04-01',
Expand Down
7 changes: 4 additions & 3 deletions src/azure-cli/azure/cli/command_modules/iot/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,15 @@ def load_command_table(self, _): # pylint: disable=too-many-statements

# iot hub commands
with self.command_group('iot hub', client_factory=iot_hub_service_factory) as g:
g.custom_command('create', 'iot_hub_create')
g.custom_command('create', 'iot_hub_create', supports_no_wait=True)
g.custom_command('list', 'iot_hub_list')
g.custom_command('show-connection-string', 'iot_hub_show_connection_string',
deprecate_info=self.deprecate(redirect=CS_DEPRECATION_INFO))
g.custom_show_command('show', 'iot_hub_get')
g.generic_update_command('update', getter_name='iot_hub_get', setter_name='iot_hub_update',
command_type=update_custom_util, custom_func_name='update_iot_hub_custom')
g.custom_command('delete', 'iot_hub_delete', transform=HubDeleteResultTransform(self.cli_ctx))
g.custom_command('delete', 'iot_hub_delete', transform=HubDeleteResultTransform(self.cli_ctx),
supports_no_wait=True)
g.custom_command('list-skus', 'iot_hub_sku_list')
g.custom_command('show-quota-metrics', 'iot_hub_get_quota_metrics')
g.custom_command('show-stats', 'iot_hub_get_stats')
Expand Down Expand Up @@ -184,7 +185,7 @@ def load_command_table(self, _): # pylint: disable=too-many-statements

# iot hub device stream commands
with self.command_group('iot hub devicestream', client_factory=iot_hub_service_factory,
min_api="2019-07-01-preview") as g:
min_api="2019-07-01-preview", is_preview=True) as g:
Comment thread
vilit1 marked this conversation as resolved.
g.custom_show_command('show', 'iot_hub_devicestream_show')

# iot central commands
Expand Down
12 changes: 9 additions & 3 deletions src/azure-cli/azure/cli/command_modules/iot/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# --------------------------------------------------------------------------------------------
# pylint: disable=no-self-use,no-member,line-too-long,too-few-public-methods,too-many-lines,too-many-arguments,too-many-locals

import json
import re
from enum import Enum
from knack.log import get_logger
Expand Down Expand Up @@ -278,7 +279,10 @@ def iot_dps_linked_hub_create(
raise InvalidArgumentValueError("Please provide a valid IoT Hub connection string.")

hub_client = iot_hub_service_factory(cmd.cli_ctx)
location = iot_hub_get(cmd, hub_client, hub_name=hub_name, resource_group_name=hub_resource_group).location
try:
location = iot_hub_get(cmd, hub_client, hub_name=hub_name, resource_group_name=hub_resource_group).location
except CLIError:
raise RequiredArgumentMissingError("Please provide the IoT Hub location.")

resource_group_name = _ensure_dps_resource_group_name(client, resource_group_name, dps_name)

Expand Down Expand Up @@ -491,7 +495,6 @@ def iot_hub_create(cmd, client, hub_name, resource_group_name, location=None,
fileupload_storage_container_name=None,
fileupload_sas_ttl=1,
fileupload_storage_authentication_type=None,
fileupload_storage_container_uri=None,
fileupload_storage_identity=None,
min_tls_version=None,
tags=None,
Expand Down Expand Up @@ -546,7 +549,6 @@ def iot_hub_create(cmd, client, hub_name, resource_group_name, location=None,
connection_string=fileupload_storage_connectionstring if fileupload_storage_connectionstring else '',
container_name=fileupload_storage_container_name if fileupload_storage_container_name else '',
authentication_type=fileupload_storage_authentication_type if fileupload_storage_authentication_type else None,
container_uri=fileupload_storage_container_uri if fileupload_storage_container_uri else '',
identity=ManagedIdentity(user_assigned_identity=fileupload_storage_identity) if fileupload_storage_identity else None)

properties = IotHubProperties(event_hub_endpoints=event_hub_dic,
Expand Down Expand Up @@ -1129,6 +1131,10 @@ def iot_hub_route_update(cmd, client, hub_name, route_name, source_type=None, en

def iot_hub_route_test(cmd, client, hub_name, route_name=None, source_type=None, body=None, app_properties=None,
system_properties=None, resource_group_name=None):
if app_properties:
app_properties = json.loads(app_properties)
if system_properties:
system_properties = json.loads(system_properties)
resource_group_name = _ensure_hub_resource_group_name(client, resource_group_name, hub_name)
route_message = RoutingMessage(
body=body,
Expand Down
Loading