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
32 changes: 0 additions & 32 deletions src/azure-cli/azure/cli/command_modules/iot/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,38 +428,6 @@
az iot hub devicestream show -n MyIotHub
"""

helps['iot hub job'] = """
type: group
short-summary: Manage jobs in an IoT hub.
"""

helps['iot hub job cancel'] = """
type: command
short-summary: Cancel a job in an IoT hub.
examples:
- name: Cancel a job in an IoT hub. (autogenerated)
text: az iot hub job cancel --hub-name MyHub --job-id JobId
crafted: true
"""

helps['iot hub job list'] = """
type: command
short-summary: List the jobs in an IoT hub.
examples:
- name: List the jobs in an IoT hub. (autogenerated)
text: az iot hub job list --hub-name MyHub
crafted: true
"""

helps['iot hub job show'] = """
type: command
short-summary: Get the details of a job in an IoT hub.
examples:
- name: Get the details of a job in an IoT hub. (autogenerated)
text: az iot hub job show --hub-name MyHub --job-id JobId
crafted: true
"""

helps['iot hub list'] = """
type: command
short-summary: List IoT hubs.
Expand Down
5 changes: 1 addition & 4 deletions src/azure-cli/azure/cli/command_modules/iot/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
help='The amount of time a SAS URI generated by IoT Hub is valid before it expires,'
' between 1 and 24 hours.')

for subgroup in ['consumer-group', 'policy', 'job', 'certificate', 'routing-endpoint', 'route']:
for subgroup in ['consumer-group', 'policy', 'certificate', 'routing-endpoint', 'route']:
with self.argument_context('iot hub {}'.format(subgroup)) as c:
c.argument('hub_name', options_list=['--hub-name'])

Expand Down Expand Up @@ -255,9 +255,6 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
c.argument('regenerate_key', options_list=['--renew-key', '--rk'], arg_type=get_enum_type(RenewKeyType),
help='Regenerate keys')

with self.argument_context('iot hub job') as c:
c.argument('job_id', id_part='child_name_1', help='Job Id.')

with self.argument_context('iot hub create') as c:
c.argument('hub_name', completer=None)
c.argument('location', get_location_type(self.cli_ctx),
Expand Down
7 changes: 0 additions & 7 deletions src/azure-cli/azure/cli/command_modules/iot/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,6 @@ def load_command_table(self, _): # pylint: disable=too-many-statements
g.custom_command('delete', 'iot_hub_policy_delete', transform=PolicyUpdateResultTransform(self.cli_ctx))
g.custom_command('renew-key', 'iot_hub_policy_key_renew', supports_no_wait=True)

# iot hub job commands
with self.command_group('iot hub job', deprecate_info=self.deprecate(redirect=JOB_DEPRECATION_INFO),
client_factory=iot_hub_service_factory) as g:
g.custom_command('list', 'iot_hub_job_list')
g.custom_command('show', 'iot_hub_job_get')
g.custom_command('cancel', 'iot_hub_job_cancel')

# iot hub routing endpoint commands
with self.command_group('iot hub routing-endpoint', client_factory=iot_hub_service_factory) as g:
g.custom_command('create', 'iot_hub_routing_endpoint_create',
Expand Down
28 changes: 0 additions & 28 deletions src/azure-cli/azure/cli/command_modules/iot/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
from azure.mgmt.iotcentral.models import (AppSkuInfo,
App)

from azure.cli.command_modules.iot.mgmt_iot_hub_device.lib.iot_hub_device_client import IotHubDeviceClient
from azure.cli.command_modules.iot.sas_token_auth import SasTokenAuthentication
from azure.cli.command_modules.iot.shared import EndpointType, EncodingFormat, RenewKeyType, AuthenticationType
from ._constants import PNP_ENDPOINT
from ._client_factory import resource_service_factory, get_pnp_client
Expand Down Expand Up @@ -662,21 +660,6 @@ def _is_policy_existed(policies, policy_name):
return policy_name.lower() in policy_set


def iot_hub_job_list(client, hub_name, resource_group_name=None):
resource_group_name = _ensure_resource_group_name(client, resource_group_name, hub_name)
return client.iot_hub_resource.list_jobs(resource_group_name, hub_name)


def iot_hub_job_get(client, hub_name, job_id, resource_group_name=None):
resource_group_name = _ensure_resource_group_name(client, resource_group_name, hub_name)
return client.iot_hub_resource.get_job(resource_group_name, hub_name, job_id)


def iot_hub_job_cancel(client, hub_name, job_id, resource_group_name=None):
device_client = _get_device_client(client, resource_group_name, hub_name, '')
return device_client.cancel_job(job_id)


def iot_hub_get_quota_metrics(client, hub_name, resource_group_name=None):
resource_group_name = _ensure_resource_group_name(client, resource_group_name, hub_name)
iotHubQuotaMetricCollection = []
Expand Down Expand Up @@ -1025,17 +1008,6 @@ def _pnp_create_update_authkeys(cmd, client, repo_endpoint, repo_id, user_role,
custom_headers=headers)


def _get_device_client(client, resource_group_name, hub_name, device_id):
resource_group_name = _ensure_resource_group_name(client, resource_group_name, hub_name)
# Intermediate fix to support domains beyond azure-devices.net
hub = _get_iot_hub_by_name(client, hub_name)
base_url = hub.properties.host_name
uri = '{0}/devices/{1}'.format(base_url, device_id)
access_policy = iot_hub_policy_get(client, hub_name, 'iothubowner', resource_group_name)
creds = SasTokenAuthentication(uri, access_policy.key_name, access_policy.primary_key)
return IotHubDeviceClient(creds, client.iot_hub_resource.config.subscription_id, base_url='https://' + base_url).iot_hub_devices


def _get_iot_hub_by_name(client, hub_name):
all_hubs = iot_hub_list(client)
if all_hubs is None:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading