From 8671394c9b94533b9d42cfafe301a2293ea6bd09 Mon Sep 17 00:00:00 2001 From: Ketki Date: Tue, 26 May 2026 16:02:34 -0700 Subject: [PATCH 1/9] Add tls support- first draft --- azext_iot/deviceupdate/_help.py | 5 +++ azext_iot/deviceupdate/commands_deployment.py | 2 + azext_iot/deviceupdate/common.py | 9 ++++ azext_iot/deviceupdate/params.py | 7 ++++ .../deviceupdate/dataplane/_configuration.py | 4 +- .../deviceupdate/dataplane/models/__init__.py | 2 + .../models/_device_update_client_enums.py | 9 ++++ .../dataplane/models/_models_py3.py | 9 ++++ .../tests/deviceupdate/test_adu_update_int.py | 42 +++++++++++++++++++ 9 files changed, 87 insertions(+), 2 deletions(-) diff --git a/azext_iot/deviceupdate/_help.py b/azext_iot/deviceupdate/_help.py index a69e2dd3f..f522fa556 100644 --- a/azext_iot/deviceupdate/_help.py +++ b/azext_iot/deviceupdate/_help.py @@ -589,6 +589,11 @@ def load_deviceupdate_help(): --update-name {update_name} --update-provider {update_provider} --update-version {update_version} --failed-count 10 --failed-percentage 5 --rollback-update-name {rollback_update_name} --rollback-update-provider {rollback_update_provider} --rollback-update-version {rollback_update_version} + + - name: Create a device group deployment using HTTP for update payload downloads. + text: > + az iot du device deployment create -n {account_name} -i {instance_name} --group-id {device_group_id} --deployment-id {deployment_id} + --update-name {update_name} --update-provider {update_provider} --update-version {update_version} --download-security http """ helps["iot du device deployment list"] = """ diff --git a/azext_iot/deviceupdate/commands_deployment.py b/azext_iot/deviceupdate/commands_deployment.py index 8b8023ec1..94defa698 100644 --- a/azext_iot/deviceupdate/commands_deployment.py +++ b/azext_iot/deviceupdate/commands_deployment.py @@ -52,6 +52,7 @@ def create_deployment( rollback_update_version: Optional[str] = None, devices_failed_percentage: Optional[str] = None, devices_failed_count: Optional[str] = None, + download_security: Optional[str] = None, resource_group_name: Optional[str] = None, ): if any( @@ -105,6 +106,7 @@ def create_deployment( group_id=device_group_id, update=update_info, rollback_policy=rollback_policy, + download_security=download_security, ) try: return data_manager.data_client.device_management.create_or_update_deployment( diff --git a/azext_iot/deviceupdate/common.py b/azext_iot/deviceupdate/common.py index 8633e48fc..90b3bdf77 100644 --- a/azext_iot/deviceupdate/common.py +++ b/azext_iot/deviceupdate/common.py @@ -98,6 +98,15 @@ class ADUContentHandlerType(Enum): SYSTEM_IDENTITY_ARG = "[system]" + + +class ADUDownloadSecurityType(Enum): + """ + ADU download security (protocol) type for update payload downloads. + """ + + HTTPS = "https" + HTTP = "http" AUTH_RESOURCE_ID = "https://api.adu.microsoft.com/" CACHE_RESOURCE_TYPE = "DeviceUpdate" diff --git a/azext_iot/deviceupdate/params.py b/azext_iot/deviceupdate/params.py index 553164991..6a21b0ddd 100644 --- a/azext_iot/deviceupdate/params.py +++ b/azext_iot/deviceupdate/params.py @@ -18,6 +18,7 @@ ADUPublicNetworkAccessType, ADUPrivateLinkServiceConnectionStatus, ADUAccountSKUType, + ADUDownloadSecurityType, ADUManageDeviceImportType, ADUValidHashAlgorithmType, ) @@ -426,6 +427,12 @@ def load_deviceupdate_arguments(self, _): "Required when defining rollback policy.", arg_group="Update Rollback Policy", ) + context.argument( + "download_security", + options_list=["--download-security"], + help="Protocol used for update payload downloads. Defaults to https for new deployments.", + arg_type=get_enum_type(ADUDownloadSecurityType), + ) with self.argument_context("iot du device log") as context: context.argument( diff --git a/azext_iot/sdk/deviceupdate/dataplane/_configuration.py b/azext_iot/sdk/deviceupdate/dataplane/_configuration.py index f4634099d..c3541a008 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/_configuration.py +++ b/azext_iot/sdk/deviceupdate/dataplane/_configuration.py @@ -29,7 +29,7 @@ class DeviceUpdateClientConfiguration(Configuration): # pylint: disable=too-man :type endpoint: str :param instance_id: The Device Update for IoT Hub account instance identifier. Required. :type instance_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2026-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -42,7 +42,7 @@ def __init__( **kwargs: Any ) -> None: super(DeviceUpdateClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-10-01") # type: str + api_version = kwargs.pop('api_version', "2026-06-01") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/azext_iot/sdk/deviceupdate/dataplane/models/__init__.py b/azext_iot/sdk/deviceupdate/dataplane/models/__init__.py index bbed074cd..1db807106 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/models/__init__.py +++ b/azext_iot/sdk/deviceupdate/dataplane/models/__init__.py @@ -74,6 +74,7 @@ from ._device_update_client_enums import DeviceClassSubgroupDeploymentState from ._device_update_client_enums import DeviceDeploymentState from ._device_update_client_enums import DeviceHealthState +from ._device_update_client_enums import DownloadSecurity from ._device_update_client_enums import GroupType from ._device_update_client_enums import HealthCheckResult from ._device_update_client_enums import ImportType @@ -152,6 +153,7 @@ 'DeviceClassSubgroupDeploymentState', 'DeviceDeploymentState', 'DeviceHealthState', + 'DownloadSecurity', 'GroupType', 'HealthCheckResult', 'ImportType', diff --git a/azext_iot/sdk/deviceupdate/dataplane/models/_device_update_client_enums.py b/azext_iot/sdk/deviceupdate/dataplane/models/_device_update_client_enums.py index bd90f927d..0bb6e9f37 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/models/_device_update_client_enums.py +++ b/azext_iot/sdk/deviceupdate/dataplane/models/_device_update_client_enums.py @@ -91,6 +91,15 @@ class ImportType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Import both devices and modules. ALL = "All" +class DownloadSecurity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol used for update payload downloads. + """ + + #: Update payloads are downloaded using HTTPS (TLS). This is the default. + HTTPS = "https" + #: Update payloads are downloaded using HTTP. + HTTP = "http" + class OperationFilterStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Operation status filter. """ diff --git a/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py b/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py index 9f9a13070..a60f97bcf 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py +++ b/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py @@ -199,6 +199,9 @@ class Deployment(_serialization.Model): :ivar is_cloud_initiated_rollback: Boolean flag indicating whether the deployment is a rollback deployment. :vartype is_cloud_initiated_rollback: bool + :ivar download_security: Protocol used for update payload downloads. Known values are: "https" + and "http". Defaults to "https". + :vartype download_security: str or ~deviceupdateclient.models.DownloadSecurity """ _validation = { @@ -218,6 +221,7 @@ class Deployment(_serialization.Model): "is_retried": {"key": "isRetried", "type": "bool"}, "rollback_policy": {"key": "rollbackPolicy", "type": "CloudInitiatedRollbackPolicy"}, "is_cloud_initiated_rollback": {"key": "isCloudInitiatedRollback", "type": "bool"}, + "download_security": {"key": "downloadSecurity", "type": "str"}, } def __init__( @@ -232,6 +236,7 @@ def __init__( is_retried: Optional[bool] = None, rollback_policy: Optional["_models.CloudInitiatedRollbackPolicy"] = None, is_cloud_initiated_rollback: Optional[bool] = None, + download_security: Optional[Union[str, "_models.DownloadSecurity"]] = None, **kwargs ): """ @@ -260,6 +265,9 @@ def __init__( :keyword is_cloud_initiated_rollback: Boolean flag indicating whether the deployment is a rollback deployment. :paramtype is_cloud_initiated_rollback: bool + :keyword download_security: Protocol used for update payload downloads. Known values are: + "https" and "http". Defaults to "https". + :paramtype download_security: str or ~deviceupdateclient.models.DownloadSecurity """ super().__init__(**kwargs) self.deployment_id = deployment_id @@ -271,6 +279,7 @@ def __init__( self.is_retried = is_retried self.rollback_policy = rollback_policy self.is_cloud_initiated_rollback = is_cloud_initiated_rollback + self.download_security = download_security class DeploymentDeviceState(_serialization.Model): diff --git a/azext_iot/tests/deviceupdate/test_adu_update_int.py b/azext_iot/tests/deviceupdate/test_adu_update_int.py index 1cd560336..018647c97 100644 --- a/azext_iot/tests/deviceupdate/test_adu_update_int.py +++ b/azext_iot/tests/deviceupdate/test_adu_update_int.py @@ -429,6 +429,48 @@ def test_instance_update_lifecycle(provisioned_instances_module: Dict[str, dict] f"iot du device deployment delete -n {account_name} -i {instance_name} " f"--deployment-id {rollback_deployment_id} --group-id {device_group_id} --class-id {device_class_id} -y").success() + # Create deployment with explicit --download-security https + https_deployment_id = f"deployhttps_{generate_generic_id()}" + https_create_deployment = cli.invoke( + f"iot du device deployment create -n {account_name} -i {instance_name} " + f"--deployment-id {https_deployment_id} --group-id {device_group_id} " + f"--update-name {simple_manifest_id['name']} " + f"--update-provider {simple_manifest_id['provider']} " + f"--update-version {simple_manifest_id['version']} " + f"--download-security https").as_json() + assert https_create_deployment["deploymentId"] == https_deployment_id + assert https_create_deployment["downloadSecurity"] == "https" + + show_https_deployment = cli.invoke( + f"iot du device deployment show -n {account_name} -i {instance_name} " + f"--deployment-id {https_deployment_id} --group-id {device_group_id}").as_json() + assert show_https_deployment["downloadSecurity"] == "https" + + assert cli.invoke( + f"iot du device deployment delete -n {account_name} -i {instance_name} " + f"--deployment-id {https_deployment_id} --group-id {device_group_id} -y").success() + + # Create deployment with explicit --download-security http + http_deployment_id = f"deployhttp_{generate_generic_id()}" + http_create_deployment = cli.invoke( + f"iot du device deployment create -n {account_name} -i {instance_name} " + f"--deployment-id {http_deployment_id} --group-id {device_group_id} " + f"--update-name {simple_manifest_id['name']} " + f"--update-provider {simple_manifest_id['provider']} " + f"--update-version {simple_manifest_id['version']} " + f"--download-security http").as_json() + assert http_create_deployment["deploymentId"] == http_deployment_id + assert http_create_deployment["downloadSecurity"] == "http" + + show_http_deployment = cli.invoke( + f"iot du device deployment show -n {account_name} -i {instance_name} " + f"--deployment-id {http_deployment_id} --group-id {device_group_id}").as_json() + assert show_http_deployment["downloadSecurity"] == "http" + + assert cli.invoke( + f"iot du device deployment delete -n {account_name} -i {instance_name} " + f"--deployment-id {http_deployment_id} --group-id {device_group_id} -y").success() + # Clean-up device class subgroup and group # TODO : Deleting a class Id does not work today, but you are able to delete a class subgroup. From 9b0d9f4c9b087a3ce529ce52eef5578ae757e0e7 Mon Sep 17 00:00:00 2001 From: Ketki Date: Tue, 23 Jun 2026 11:50:25 -0700 Subject: [PATCH 2/9] Fix linting error --- azext_iot/deviceupdate/common.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/azext_iot/deviceupdate/common.py b/azext_iot/deviceupdate/common.py index 90b3bdf77..eea2ebe35 100644 --- a/azext_iot/deviceupdate/common.py +++ b/azext_iot/deviceupdate/common.py @@ -69,6 +69,15 @@ class ADUValidHashAlgorithmType(Enum): SHA256 = "sha256" +class ADUDownloadSecurityType(Enum): + """ + ADU download security (protocol) type for update payload downloads. + """ + + HTTPS = "https" + HTTP = "http" + + class ADUContentHandlerType(Enum): """ ADU first-party content handler types. @@ -98,15 +107,6 @@ class ADUContentHandlerType(Enum): SYSTEM_IDENTITY_ARG = "[system]" - - -class ADUDownloadSecurityType(Enum): - """ - ADU download security (protocol) type for update payload downloads. - """ - - HTTPS = "https" - HTTP = "http" AUTH_RESOURCE_ID = "https://api.adu.microsoft.com/" CACHE_RESOURCE_TYPE = "DeviceUpdate" From 6eacdbc742cdcbe2899aa974f3adc460a25016c8 Mon Sep 17 00:00:00 2001 From: Ketki Date: Fri, 26 Jun 2026 15:10:48 -0700 Subject: [PATCH 3/9] chore: Regenerate deviceupdate dataplane SDK for 2026-06-01 API via AutoRest Use AutoRest 3.9.2 + @autorest/python@5.19.0 against: specification/deviceupdate/data-plane/Microsoft.DeviceUpdate/stable/2026-06-01/deviceupdate.json Key changes from 2022-10-01: - api_version updated to 2026-06-01 throughout all operations - Added DownloadSecurity enum (https/http) - Added download_security field to Deployment model --- .../sdk/deviceupdate/dataplane/__init__.py | 4 +- .../deviceupdate/dataplane/_configuration.py | 18 +- .../dataplane/_device_update_client.py | 26 +- .../deviceupdate/dataplane/_serialization.py | 12 +- .../sdk/deviceupdate/dataplane/_vendor.py | 4 +- .../sdk/deviceupdate/dataplane/_version.py | 6 +- .../deviceupdate/dataplane/models/__init__.py | 4 +- .../models/_device_update_client_enums.py | 45 +- .../dataplane/models/_models_py3.py | 520 ++-- .../dataplane/operations/__init__.py | 8 +- .../_device_management_operations.py | 2120 +++++++++-------- .../operations/_device_update_operations.py | 1237 +++++----- 12 files changed, 2035 insertions(+), 1969 deletions(-) diff --git a/azext_iot/sdk/deviceupdate/dataplane/__init__.py b/azext_iot/sdk/deviceupdate/dataplane/__init__.py index 31308e71f..fa08cfdff 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/__init__.py +++ b/azext_iot/sdk/deviceupdate/dataplane/__init__.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/azext_iot/sdk/deviceupdate/dataplane/_configuration.py b/azext_iot/sdk/deviceupdate/dataplane/_configuration.py index c3541a008..3a06a3fbd 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/_configuration.py +++ b/azext_iot/sdk/deviceupdate/dataplane/_configuration.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,11 +26,11 @@ class DeviceUpdateClientConfiguration(Configuration): # pylint: disable=too-man :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential + :param instance_id: The Device Update for IoT Hub account instance identifier. Required. + :type instance_id: str :param endpoint: The Device Update for IoT Hub account endpoint (hostname only, no protocol). Required. :type endpoint: str - :param instance_id: The Device Update for IoT Hub account instance identifier. Required. - :type instance_id: str :keyword api_version: Api Version. Default value is "2026-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -37,8 +39,8 @@ class DeviceUpdateClientConfiguration(Configuration): # pylint: disable=too-man def __init__( self, credential: "TokenCredential", - endpoint: str, instance_id: str, + endpoint: str, **kwargs: Any ) -> None: super(DeviceUpdateClientConfiguration, self).__init__(**kwargs) @@ -46,17 +48,17 @@ def __init__( if credential is None: raise ValueError("Parameter 'credential' must not be None.") - if endpoint is None: - raise ValueError("Parameter 'endpoint' must not be None.") if instance_id is None: raise ValueError("Parameter 'instance_id' must not be None.") + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") self.credential = credential - self.endpoint = endpoint self.instance_id = instance_id + self.endpoint = endpoint self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://api.adu.microsoft.com/.default']) - kwargs.setdefault('sdk_moniker', 'deviceupdateclient/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'iot-deviceupdate/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/azext_iot/sdk/deviceupdate/dataplane/_device_update_client.py b/azext_iot/sdk/deviceupdate/dataplane/_device_update_client.py index b712f92d1..9507e27dd 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/_device_update_client.py +++ b/azext_iot/sdk/deviceupdate/dataplane/_device_update_client.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -27,18 +29,18 @@ class DeviceUpdateClient: # pylint: disable=client-accepts-api-version-keyword knows when and how to update devices, enabling customers to focus on their business goals and let Device Update for IoT Hub handle the updates. - :ivar device_update: DeviceUpdateOperations operations - :vartype device_update: deviceupdateclient.operations.DeviceUpdateOperations :ivar device_management: DeviceManagementOperations operations - :vartype device_management: deviceupdateclient.operations.DeviceManagementOperations + :vartype device_management: azure.iot.deviceupdate.operations.DeviceManagementOperations + :ivar device_update: DeviceUpdateOperations operations + :vartype device_update: azure.iot.deviceupdate.operations.DeviceUpdateOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential + :param instance_id: The Device Update for IoT Hub account instance identifier. Required. + :type instance_id: str :param endpoint: The Device Update for IoT Hub account endpoint (hostname only, no protocol). Required. :type endpoint: str - :param instance_id: The Device Update for IoT Hub account instance identifier. Required. - :type instance_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2026-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -48,22 +50,22 @@ class DeviceUpdateClient: # pylint: disable=client-accepts-api-version-keyword def __init__( self, credential: "TokenCredential", - endpoint: str, instance_id: str, + endpoint: str, **kwargs: Any ) -> None: _endpoint = 'https://{endpoint}' - self._config = DeviceUpdateClientConfiguration(credential=credential, endpoint=endpoint, instance_id=instance_id, **kwargs) + self._config = DeviceUpdateClientConfiguration(credential=credential, instance_id=instance_id, endpoint=endpoint, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.device_update = DeviceUpdateOperations( + self.device_management = DeviceManagementOperations( self._client, self._config, self._serialize, self._deserialize ) - self.device_management = DeviceManagementOperations( + self.device_update = DeviceUpdateOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -92,7 +94,7 @@ def _send_request( request_copy = deepcopy(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/azext_iot/sdk/deviceupdate/dataplane/_serialization.py b/azext_iot/sdk/deviceupdate/dataplane/_serialization.py index 29f32ff83..a8b199654 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/_serialization.py +++ b/azext_iot/sdk/deviceupdate/dataplane/_serialization.py @@ -47,17 +47,7 @@ from typing import Dict, Any, cast, TYPE_CHECKING -from azext_iot.constants import INTERNAL_AZURE_CORE_NAMESPACE - -try: - # @digimaun - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -except ImportError: - import importlib - internal_azure_core = importlib.import_module(INTERNAL_AZURE_CORE_NAMESPACE) - DeserializationError = internal_azure_core.exceptions.DeserializationError - SerializationError = internal_azure_core.exceptions.SerializationError - raise_with_traceback = internal_azure_core.exceptions.raise_with_traceback +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback _BOM = codecs.BOM_UTF8.decode(encoding='utf-8') diff --git a/azext_iot/sdk/deviceupdate/dataplane/_vendor.py b/azext_iot/sdk/deviceupdate/dataplane/_vendor.py index 9b3eb88e1..138f663c5 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/_vendor.py +++ b/azext_iot/sdk/deviceupdate/dataplane/_vendor.py @@ -1,5 +1,7 @@ # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/azext_iot/sdk/deviceupdate/dataplane/_version.py b/azext_iot/sdk/deviceupdate/dataplane/_version.py index 082114a0b..59deb8c72 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/_version.py +++ b/azext_iot/sdk/deviceupdate/dataplane/_version.py @@ -1,7 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.0.1" +VERSION = "1.1.0" diff --git a/azext_iot/sdk/deviceupdate/dataplane/models/__init__.py b/azext_iot/sdk/deviceupdate/dataplane/models/__init__.py index 1db807106..174f66b54 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/models/__init__.py +++ b/azext_iot/sdk/deviceupdate/dataplane/models/__init__.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/azext_iot/sdk/deviceupdate/dataplane/models/_device_update_client_enums.py b/azext_iot/sdk/deviceupdate/dataplane/models/_device_update_client_enums.py index 0bb6e9f37..c70db8d90 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/models/_device_update_client_enums.py +++ b/azext_iot/sdk/deviceupdate/dataplane/models/_device_update_client_enums.py @@ -1,6 +1,8 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -14,14 +16,14 @@ class DeploymentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: The deployment can be sent to devices targeted in the deployment. ACTIVE = "Active" - #: The deployment can be sent to some devices targeted in the deployment but at least 1 subgroup - #: is in a failed state. + #: The deployment can be sent to some devices targeted in the deployment but at + #: least 1 subgroup is in a failed state. ACTIVE_WITH_SUBGROUP_FAILURES = "ActiveWithSubgroupFailures" - #: The deployment will not be sent to any devices. Consult error for more details about what - #: failed. + #: The deployment will not be sent to any devices. Consult error for more details + #: about what failed. FAILED = "Failed" - #: A newer deployment for this group has been created and no devices in the group will receive - #: this deployment. + #: A newer deployment for this group has been created and no devices in the group + #: will receive this deployment. INACTIVE = "Inactive" #: The deployment has been canceled and no devices will receive it. CANCELED = "Canceled" @@ -34,8 +36,8 @@ class DeviceClassSubgroupDeploymentState(str, Enum, metaclass=CaseInsensitiveEnu ACTIVE = "Active" #: The subgroup deployment failed and will not be sent to any devices. FAILED = "Failed" - #: A newer deployment for this subgroup has been created and no devices in the subgroup will - #: receive this deployment. + #: A newer deployment for this subgroup has been created and no devices in the + #: subgroup will receive this deployment. INACTIVE = "Inactive" #: The subgroup deployment has been canceled and no devices will receive it. CANCELED = "Canceled" @@ -62,6 +64,16 @@ class DeviceHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Agent is in an unhealthy state UNHEALTHY = "unhealthy" +class DownloadSecurity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The protocol the device should use when downloading the update payload. + Defaults to "https". + """ + + #: Download update payload over HTTPS. + HTTPS = "https" + #: Download update payload over HTTP. + HTTP = "http" + class GroupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Supported group types. """ @@ -91,20 +103,13 @@ class ImportType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Import both devices and modules. ALL = "All" -class DownloadSecurity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Protocol used for update payload downloads. - """ - - #: Update payloads are downloaded using HTTPS (TLS). This is the default. - HTTPS = "https" - #: Update payloads are downloaded using HTTP. - HTTP = "http" - class OperationFilterStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Operation status filter. """ + #: Running RUNNING = "Running" + #: NotStarted NOT_STARTED = "NotStarted" class OperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -125,6 +130,6 @@ class StepType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ #: Step type that performs code execution. - INLINE = "Inline" + INLINE = "inline" #: Step type that installs another update. - REFERENCE = "Reference" + REFERENCE = "reference" diff --git a/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py b/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py index a60f97bcf..4587a6003 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py +++ b/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py @@ -1,12 +1,13 @@ # coding=utf-8 # pylint: disable=too-many-lines # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -14,23 +15,19 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class AccessCondition(_serialization.Model): """Parameter group. :ivar if_none_match: Defines the If-None-Match condition. The operation will be performed only - if the ETag on the server does not match this value. + if + the ETag on the server does not match this value. :vartype if_none_match: str """ _attribute_map = { - "if_none_match": {"key": "If-None-Match", "type": "str"}, + "if_none_match": {"key": "ifNoneMatch", "type": "str"}, } def __init__( @@ -41,7 +38,8 @@ def __init__( ): """ :keyword if_none_match: Defines the If-None-Match condition. The operation will be performed - only if the ETag on the server does not match this value. + only if + the ETag on the server does not match this value. :paramtype if_none_match: str """ super().__init__(**kwargs) @@ -54,9 +52,9 @@ class CloudInitiatedRollbackPolicy(_serialization.Model): All required parameters must be populated in order to send to Azure. :ivar update: Update to rollback to. Required. - :vartype update: ~deviceupdateclient.models.UpdateInfo + :vartype update: ~azure.iot.deviceupdate.models.UpdateInfo :ivar failure: Failure conditions to initiate rollback policy. Required. - :vartype failure: ~deviceupdateclient.models.CloudInitiatedRollbackPolicyFailure + :vartype failure: ~azure.iot.deviceupdate.models.CloudInitiatedRollbackPolicyFailure """ _validation = { @@ -78,9 +76,9 @@ def __init__( ): """ :keyword update: Update to rollback to. Required. - :paramtype update: ~deviceupdateclient.models.UpdateInfo + :paramtype update: ~azure.iot.deviceupdate.models.UpdateInfo :keyword failure: Failure conditions to initiate rollback policy. Required. - :paramtype failure: ~deviceupdateclient.models.CloudInitiatedRollbackPolicyFailure + :paramtype failure: ~azure.iot.deviceupdate.models.CloudInitiatedRollbackPolicyFailure """ super().__init__(**kwargs) self.update = update @@ -131,11 +129,11 @@ class ContractModel(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar id: The Device Update agent contract model Id of the device class. This is also used to - calculate the device class Id. Required. + :ivar id: The Device Update agent contract model Id of the device class. This is also + used to calculate the device class Id. Required. :vartype id: str - :ivar name: The Device Update agent contract model name of the device class. Intended to be a - more readable form of the contract model Id. Required. + :ivar name: The Device Update agent contract model name of the device class. Intended to be + a more readable form of the contract model Id. Required. :vartype name: str """ @@ -157,8 +155,8 @@ def __init__( **kwargs ): """ - :keyword id: The Device Update agent contract model Id of the device class. This is also used - to calculate the device class Id. Required. + :keyword id: The Device Update agent contract model Id of the device class. This is also + used to calculate the device class Id. Required. :paramtype id: str :keyword name: The Device Update agent contract model name of the device class. Intended to be a more readable form of the contract model Id. Required. @@ -175,19 +173,21 @@ class Deployment(_serialization.Model): All required parameters must be populated in order to send to Azure. :ivar deployment_id: The caller-provided deployment identifier. This cannot be longer than 73 - characters, must be all lower-case, and cannot contain '&', '^', '[', ']', '{', '}', '|', '<', - '>', forward slash, backslash, or double quote. The Updates view in the Azure Portal IoT Hub - resource generates a GUID for deploymentId when you create a deployment. Required. + characters, must be all lower-case, and cannot contain '&', '^', '[', ']', '{', + '}', '|', '<', '>', forward slash, backslash, or double quote. The Updates view + in the Azure Portal IoT Hub resource generates a GUID for deploymentId when you + create a deployment. Required. :vartype deployment_id: str :ivar start_date_time: The deployment start datetime. Required. :vartype start_date_time: ~datetime.datetime :ivar update: Update information for the update in the deployment. Required. - :vartype update: ~deviceupdateclient.models.UpdateInfo + :vartype update: ~azure.iot.deviceupdate.models.UpdateInfo :ivar group_id: The group identity for the devices the deployment is intended to update. Required. :vartype group_id: str :ivar device_class_subgroups: The device class subgroups the deployment is compatible with and - subgroup deployments have been created for. This is not provided by the caller during + subgroup + deployments have been created for. This is not provided by the caller during CreateOrUpdateDeployment but is automatically determined by Device Update. :vartype device_class_subgroups: list[str] :ivar is_canceled: Boolean flag indicating whether the deployment was canceled. @@ -195,13 +195,14 @@ class Deployment(_serialization.Model): :ivar is_retried: Boolean flag indicating whether the deployment has been retried. :vartype is_retried: bool :ivar rollback_policy: The rollback policy for the deployment. - :vartype rollback_policy: ~deviceupdateclient.models.CloudInitiatedRollbackPolicy + :vartype rollback_policy: ~azure.iot.deviceupdate.models.CloudInitiatedRollbackPolicy :ivar is_cloud_initiated_rollback: Boolean flag indicating whether the deployment is a rollback deployment. :vartype is_cloud_initiated_rollback: bool - :ivar download_security: Protocol used for update payload downloads. Known values are: "https" - and "http". Defaults to "https". - :vartype download_security: str or ~deviceupdateclient.models.DownloadSecurity + :ivar download_security: The protocol the device should use when downloading the update + payload. + Defaults to "https". Known values are: "https" and "http". + :vartype download_security: str or ~azure.iot.deviceupdate.models.DownloadSecurity """ _validation = { @@ -241,19 +242,22 @@ def __init__( ): """ :keyword deployment_id: The caller-provided deployment identifier. This cannot be longer than - 73 characters, must be all lower-case, and cannot contain '&', '^', '[', ']', '{', '}', '|', - '<', '>', forward slash, backslash, or double quote. The Updates view in the Azure Portal IoT - Hub resource generates a GUID for deploymentId when you create a deployment. Required. + 73 + characters, must be all lower-case, and cannot contain '&', '^', '[', ']', '{', + '}', '|', '<', '>', forward slash, backslash, or double quote. The Updates view + in the Azure Portal IoT Hub resource generates a GUID for deploymentId when you + create a deployment. Required. :paramtype deployment_id: str :keyword start_date_time: The deployment start datetime. Required. :paramtype start_date_time: ~datetime.datetime :keyword update: Update information for the update in the deployment. Required. - :paramtype update: ~deviceupdateclient.models.UpdateInfo + :paramtype update: ~azure.iot.deviceupdate.models.UpdateInfo :keyword group_id: The group identity for the devices the deployment is intended to update. Required. :paramtype group_id: str :keyword device_class_subgroups: The device class subgroups the deployment is compatible with - and subgroup deployments have been created for. This is not provided by the caller during + and subgroup + deployments have been created for. This is not provided by the caller during CreateOrUpdateDeployment but is automatically determined by Device Update. :paramtype device_class_subgroups: list[str] :keyword is_canceled: Boolean flag indicating whether the deployment was canceled. @@ -261,13 +265,14 @@ def __init__( :keyword is_retried: Boolean flag indicating whether the deployment has been retried. :paramtype is_retried: bool :keyword rollback_policy: The rollback policy for the deployment. - :paramtype rollback_policy: ~deviceupdateclient.models.CloudInitiatedRollbackPolicy + :paramtype rollback_policy: ~azure.iot.deviceupdate.models.CloudInitiatedRollbackPolicy :keyword is_cloud_initiated_rollback: Boolean flag indicating whether the deployment is a rollback deployment. :paramtype is_cloud_initiated_rollback: bool - :keyword download_security: Protocol used for update payload downloads. Known values are: - "https" and "http". Defaults to "https". - :paramtype download_security: str or ~deviceupdateclient.models.DownloadSecurity + :keyword download_security: The protocol the device should use when downloading the update + payload. + Defaults to "https". Known values are: "https" and "http". + :paramtype download_security: str or ~azure.iot.deviceupdate.models.DownloadSecurity """ super().__init__(**kwargs) self.deployment_id = deployment_id @@ -295,11 +300,12 @@ class DeploymentDeviceState(_serialization.Model): Required. :vartype retry_count: int :ivar moved_on_to_new_deployment: Boolean flag indicating whether this device is in a newer - deployment and can no longer retry this deployment. Required. + deployment and can no + longer retry this deployment. Required. :vartype moved_on_to_new_deployment: bool :ivar device_state: Deployment device state. Required. Known values are: "Succeeded", "InProgress", "Canceled", and "Failed". - :vartype device_state: str or ~deviceupdateclient.models.DeviceDeploymentState + :vartype device_state: str or ~azure.iot.deviceupdate.models.DeviceDeploymentState """ _validation = { @@ -336,11 +342,12 @@ def __init__( Required. :paramtype retry_count: int :keyword moved_on_to_new_deployment: Boolean flag indicating whether this device is in a newer - deployment and can no longer retry this deployment. Required. + deployment and can no + longer retry this deployment. Required. :paramtype moved_on_to_new_deployment: bool :keyword device_state: Deployment device state. Required. Known values are: "Succeeded", "InProgress", "Canceled", and "Failed". - :paramtype device_state: str or ~deviceupdateclient.models.DeviceDeploymentState + :paramtype device_state: str or ~azure.iot.deviceupdate.models.DeviceDeploymentState """ super().__init__(**kwargs) self.device_id = device_id @@ -359,7 +366,7 @@ class DeploymentDeviceStatesFilter(_serialization.Model): :vartype module_id: str :ivar device_state: The deployment device state. Known values are: "Succeeded", "InProgress", "Canceled", and "Failed". - :vartype device_state: str or ~deviceupdateclient.models.DeviceDeploymentState + :vartype device_state: str or ~azure.iot.deviceupdate.models.DeviceDeploymentState """ _attribute_map = { @@ -383,7 +390,7 @@ def __init__( :paramtype module_id: str :keyword device_state: The deployment device state. Known values are: "Succeeded", "InProgress", "Canceled", and "Failed". - :paramtype device_state: str or ~deviceupdateclient.models.DeviceDeploymentState + :paramtype device_state: str or ~azure.iot.deviceupdate.models.DeviceDeploymentState """ super().__init__(**kwargs) self.device_id = device_id @@ -396,8 +403,8 @@ class DeploymentDeviceStatesList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.DeploymentDeviceState] + :ivar value: The DeploymentDeviceState items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.DeploymentDeviceState] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -419,8 +426,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.DeploymentDeviceState] + :keyword value: The DeploymentDeviceState items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.DeploymentDeviceState] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -459,8 +466,8 @@ class DeploymentsList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.Deployment] + :ivar value: The Deployment items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.Deployment] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -482,8 +489,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.Deployment] + :keyword value: The Deployment items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.Deployment] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -501,12 +508,13 @@ class DeploymentStatus(_serialization.Model): :vartype group_id: str :ivar deployment_state: The state of the deployment. Required. Known values are: "Active", "ActiveWithSubgroupFailures", "Failed", "Inactive", and "Canceled". - :vartype deployment_state: str or ~deviceupdateclient.models.DeploymentState + :vartype deployment_state: str or ~azure.iot.deviceupdate.models.DeploymentState :ivar error: The error details of the Failed state. This is not present if the deployment state is not Failed. - :vartype error: ~deviceupdateclient.models.Error + :vartype error: ~azure.iot.deviceupdate.models.Error :ivar subgroup_status: The collection of device class subgroup status objects. Required. - :vartype subgroup_status: list[~deviceupdateclient.models.DeviceClassSubgroupDeploymentStatus] + :vartype subgroup_status: + list[~azure.iot.deviceupdate.models.DeviceClassSubgroupDeploymentStatus] """ _validation = { @@ -536,13 +544,13 @@ def __init__( :paramtype group_id: str :keyword deployment_state: The state of the deployment. Required. Known values are: "Active", "ActiveWithSubgroupFailures", "Failed", "Inactive", and "Canceled". - :paramtype deployment_state: str or ~deviceupdateclient.models.DeploymentState + :paramtype deployment_state: str or ~azure.iot.deviceupdate.models.DeploymentState :keyword error: The error details of the Failed state. This is not present if the deployment state is not Failed. - :paramtype error: ~deviceupdateclient.models.Error + :paramtype error: ~azure.iot.deviceupdate.models.Error :keyword subgroup_status: The collection of device class subgroup status objects. Required. :paramtype subgroup_status: - list[~deviceupdateclient.models.DeviceClassSubgroupDeploymentStatus] + list[~azure.iot.deviceupdate.models.DeviceClassSubgroupDeploymentStatus] """ super().__init__(**kwargs) self.group_id = group_id @@ -565,19 +573,20 @@ class Device(_serialization.Model): :ivar group_id: Device group identity. :vartype group_id: str :ivar last_attempted_update: The update that device last attempted to install. - :vartype last_attempted_update: ~deviceupdateclient.models.UpdateInfo + :vartype last_attempted_update: ~azure.iot.deviceupdate.models.UpdateInfo :ivar deployment_status: State of the device in its last deployment. Known values are: "Succeeded", "InProgress", "Canceled", and "Failed". - :vartype deployment_status: str or ~deviceupdateclient.models.DeviceDeploymentState + :vartype deployment_status: str or ~azure.iot.deviceupdate.models.DeviceDeploymentState :ivar installed_update: Currently installed update on device. - :vartype installed_update: ~deviceupdateclient.models.UpdateInfo + :vartype installed_update: ~azure.iot.deviceupdate.models.UpdateInfo :ivar on_latest_update: Boolean flag indicating whether the latest update (the best compatible - update for the device's device class and group) is installed on the device. Required. + update + for the device's device class and group) is installed on the device. Required. :vartype on_latest_update: bool :ivar last_deployment_id: The deployment identifier for the last deployment to the device. :vartype last_deployment_id: str :ivar last_install_result: Last install result. - :vartype last_install_result: ~deviceupdateclient.models.InstallResult + :vartype last_install_result: ~azure.iot.deviceupdate.models.InstallResult """ _validation = { @@ -624,20 +633,20 @@ def __init__( :keyword group_id: Device group identity. :paramtype group_id: str :keyword last_attempted_update: The update that device last attempted to install. - :paramtype last_attempted_update: ~deviceupdateclient.models.UpdateInfo + :paramtype last_attempted_update: ~azure.iot.deviceupdate.models.UpdateInfo :keyword deployment_status: State of the device in its last deployment. Known values are: "Succeeded", "InProgress", "Canceled", and "Failed". - :paramtype deployment_status: str or ~deviceupdateclient.models.DeviceDeploymentState + :paramtype deployment_status: str or ~azure.iot.deviceupdate.models.DeviceDeploymentState :keyword installed_update: Currently installed update on device. - :paramtype installed_update: ~deviceupdateclient.models.UpdateInfo + :paramtype installed_update: ~azure.iot.deviceupdate.models.UpdateInfo :keyword on_latest_update: Boolean flag indicating whether the latest update (the best - compatible update for the device's device class and group) is installed on the device. - Required. + compatible update + for the device's device class and group) is installed on the device. Required. :paramtype on_latest_update: bool :keyword last_deployment_id: The deployment identifier for the last deployment to the device. :paramtype last_deployment_id: str :keyword last_install_result: Last install result. - :paramtype last_install_result: ~deviceupdateclient.models.InstallResult + :paramtype last_install_result: ~azure.iot.deviceupdate.models.InstallResult """ super().__init__(**kwargs) self.device_id = device_id @@ -658,18 +667,20 @@ class DeviceClass(_serialization.Model): All required parameters must be populated in order to send to Azure. :ivar device_class_id: The device class identifier. This is generated from the model Id and the - compat properties reported by the device update agent in the Device Update PnP interface in IoT - Hub. It is a hex-encoded SHA1 hash. Required. + compat + properties reported by the device update agent in the Device Update PnP + interface in IoT Hub. It is a hex-encoded SHA1 hash. Required. :vartype device_class_id: str :ivar friendly_name: The device class friendly name. This can be updated by callers after the - device class has been automatically created. + device + class has been automatically created. :vartype friendly_name: str :ivar device_class_properties: The device class properties that are used to calculate the device class Id. Required. - :vartype device_class_properties: ~deviceupdateclient.models.DeviceClassProperties + :vartype device_class_properties: ~azure.iot.deviceupdate.models.DeviceClassProperties :ivar best_compatible_update: Update that is the highest version compatible with this device class. - :vartype best_compatible_update: ~deviceupdateclient.models.UpdateInfo + :vartype best_compatible_update: ~azure.iot.deviceupdate.models.UpdateInfo """ _validation = { @@ -695,18 +706,20 @@ def __init__( ): """ :keyword device_class_id: The device class identifier. This is generated from the model Id and - the compat properties reported by the device update agent in the Device Update PnP interface in - IoT Hub. It is a hex-encoded SHA1 hash. Required. + the compat + properties reported by the device update agent in the Device Update PnP + interface in IoT Hub. It is a hex-encoded SHA1 hash. Required. :paramtype device_class_id: str :keyword friendly_name: The device class friendly name. This can be updated by callers after - the device class has been automatically created. + the device + class has been automatically created. :paramtype friendly_name: str :keyword device_class_properties: The device class properties that are used to calculate the device class Id. Required. - :paramtype device_class_properties: ~deviceupdateclient.models.DeviceClassProperties + :paramtype device_class_properties: ~azure.iot.deviceupdate.models.DeviceClassProperties :keyword best_compatible_update: Update that is the highest version compatible with this device class. - :paramtype best_compatible_update: ~deviceupdateclient.models.UpdateInfo + :paramtype best_compatible_update: ~azure.iot.deviceupdate.models.UpdateInfo """ super().__init__(**kwargs) self.device_class_id = device_class_id @@ -720,8 +733,8 @@ class DeviceClassesList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.DeviceClass] + :ivar value: The DeviceClass items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.DeviceClass] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -743,8 +756,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.DeviceClass] + :keyword value: The DeviceClass items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.DeviceClass] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -784,11 +797,12 @@ class DeviceClassProperties(_serialization.Model): All required parameters must be populated in order to send to Azure. :ivar contract_model: The Device Update agent contract model. - :vartype contract_model: ~deviceupdateclient.models.ContractModel + :vartype contract_model: ~azure.iot.deviceupdate.models.ContractModel :ivar compat_properties: The compat properties of the device class. This object can be thought - of as a set of key-value pairs where the key is the name of the compatibility property and the - value is the value of the compatibility property. There will always be at least 1 compat - property. Required. + of as a + set of key-value pairs where the key is the name of the compatibility property + and the value is the value of the compatibility property. There will always be + at least 1 compat property. Required. :vartype compat_properties: dict[str, str] """ @@ -810,11 +824,12 @@ def __init__( ): """ :keyword contract_model: The Device Update agent contract model. - :paramtype contract_model: ~deviceupdateclient.models.ContractModel + :paramtype contract_model: ~azure.iot.deviceupdate.models.ContractModel :keyword compat_properties: The compat properties of the device class. This object can be - thought of as a set of key-value pairs where the key is the name of the compatibility property - and the value is the value of the compatibility property. There will always be at least 1 - compat property. Required. + thought of as a + set of key-value pairs where the key is the name of the compatibility property + and the value is the value of the compatibility property. There will always be + at least 1 compat property. Required. :paramtype compat_properties: dict[str, str] """ super().__init__(**kwargs) @@ -823,13 +838,15 @@ def __init__( class DeviceClassSubgroup(_serialization.Model): - """Device class subgroup details. A device class subgroup is a subset of devices in a group that share the same device class id. + """Device class subgroup details. A device class subgroup is a subset of devices +in a group that share the same device class id. All required parameters must be populated in order to send to Azure. :ivar device_class_id: Device class subgroup identity. This is generated from the model Id and - the compat properties reported by the device update agent in the Device Update PnP interface in - IoT Hub. It is a hex-encoded SHA1 hash. Required. + the + compat properties reported by the device update agent in the Device Update PnP + interface in IoT Hub. It is a hex-encoded SHA1 hash. Required. :vartype device_class_id: str :ivar group_id: Group identity. Required. :vartype group_id: str @@ -867,7 +884,8 @@ def __init__( ): """ :keyword device_class_id: Device class subgroup identity. This is generated from the model Id - and the compat properties reported by the device update agent in the Device Update PnP + and the + compat properties reported by the device update agent in the Device Update PnP interface in IoT Hub. It is a hex-encoded SHA1 hash. Required. :paramtype device_class_id: str :keyword group_id: Group identity. Required. @@ -898,10 +916,11 @@ class DeviceClassSubgroupDeploymentStatus(_serialization.Model): :vartype device_class_id: str :ivar deployment_state: The state of the subgroup deployment. Required. Known values are: "Active", "Failed", "Inactive", and "Canceled". - :vartype deployment_state: str or ~deviceupdateclient.models.DeviceClassSubgroupDeploymentState + :vartype deployment_state: str or + ~azure.iot.deviceupdate.models.DeviceClassSubgroupDeploymentState :ivar error: The error details of the Failed state. This is not present if the deployment state is not Failed. - :vartype error: ~deviceupdateclient.models.Error + :vartype error: ~azure.iot.deviceupdate.models.Error :ivar total_devices: The total number of devices in the deployment. :vartype total_devices: int :ivar devices_in_progress_count: The number of devices that are currently in deployment. @@ -956,10 +975,10 @@ def __init__( :keyword deployment_state: The state of the subgroup deployment. Required. Known values are: "Active", "Failed", "Inactive", and "Canceled". :paramtype deployment_state: str or - ~deviceupdateclient.models.DeviceClassSubgroupDeploymentState + ~azure.iot.deviceupdate.models.DeviceClassSubgroupDeploymentState :keyword error: The error details of the Failed state. This is not present if the deployment state is not Failed. - :paramtype error: ~deviceupdateclient.models.Error + :paramtype error: ~azure.iot.deviceupdate.models.Error :keyword total_devices: The total number of devices in the deployment. :paramtype total_devices: int :keyword devices_in_progress_count: The number of devices that are currently in deployment. @@ -987,7 +1006,8 @@ def __init__( class DeviceClassSubgroupFilter(_serialization.Model): - """Device class subgroups filter. Filters device class subgroups based on device class compat property names and values. + """Device class subgroups filter. Filters device class subgroups based on device +class compat property names and values. :ivar compat_property_name: The name of the compat property to use in the filter. E.g. compatProperties/manufacturer. @@ -1026,8 +1046,8 @@ class DeviceClassSubgroupsList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.DeviceClassSubgroup] + :ivar value: The DeviceClassSubgroup items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.DeviceClassSubgroup] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1049,8 +1069,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.DeviceClassSubgroup] + :keyword value: The DeviceClassSubgroup items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.DeviceClassSubgroup] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -1060,7 +1080,8 @@ def __init__( class DeviceClassSubgroupUpdatableDevices(_serialization.Model): - """Device class subgroup, update information, and the number of devices for which the update is applicable. + """Device class subgroup, update information, and the number of devices for which +the update is applicable. All required parameters must be populated in order to send to Azure. @@ -1069,7 +1090,7 @@ class DeviceClassSubgroupUpdatableDevices(_serialization.Model): :ivar device_class_id: The device class subgroup's device class Id. Required. :vartype device_class_id: str :ivar update: Update information. Required. - :vartype update: ~deviceupdateclient.models.UpdateInfo + :vartype update: ~azure.iot.deviceupdate.models.UpdateInfo :ivar device_count: Total number of devices for which the update is applicable. Required. :vartype device_count: int """ @@ -1103,7 +1124,7 @@ def __init__( :keyword device_class_id: The device class subgroup's device class Id. Required. :paramtype device_class_id: str :keyword update: Update information. Required. - :paramtype update: ~deviceupdateclient.models.UpdateInfo + :paramtype update: ~azure.iot.deviceupdate.models.UpdateInfo :keyword device_count: Total number of devices for which the update is applicable. Required. :paramtype device_count: int """ @@ -1119,8 +1140,8 @@ class DeviceClassSubgroupUpdatableDevicesList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.DeviceClassSubgroupUpdatableDevices] + :ivar value: The DeviceClassSubgroupUpdatableDevices items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.DeviceClassSubgroupUpdatableDevices] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1142,8 +1163,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.DeviceClassSubgroupUpdatableDevices] + :keyword value: The DeviceClassSubgroupUpdatableDevices items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.DeviceClassSubgroupUpdatableDevices] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -1161,7 +1182,7 @@ class DeviceFilter(_serialization.Model): :vartype device_class_id: str :ivar deployment_status: State of the device in its last deployment. Known values are: "Succeeded", "InProgress", "Canceled", and "Failed". - :vartype deployment_status: str or ~deviceupdateclient.models.DeviceDeploymentState + :vartype deployment_status: str or ~azure.iot.deviceupdate.models.DeviceDeploymentState """ _attribute_map = { @@ -1185,7 +1206,7 @@ def __init__( :paramtype device_class_id: str :keyword deployment_status: State of the device in its last deployment. Known values are: "Succeeded", "InProgress", "Canceled", and "Failed". - :paramtype deployment_status: str or ~deviceupdateclient.models.DeviceDeploymentState + :paramtype deployment_status: str or ~azure.iot.deviceupdate.models.DeviceDeploymentState """ super().__init__(**kwargs) self.group_id = group_id @@ -1204,11 +1225,11 @@ class DeviceHealth(_serialization.Model): :vartype module_id: str :ivar state: Aggregate device health state. Required. Known values are: "healthy" and "unhealthy". - :vartype state: str or ~deviceupdateclient.models.DeviceHealthState + :vartype state: str or ~azure.iot.deviceupdate.models.DeviceHealthState :ivar digital_twin_model_id: Digital twin model Id. :vartype digital_twin_model_id: str :ivar health_checks: Array of health checks and their results. Required. - :vartype health_checks: list[~deviceupdateclient.models.HealthCheck] + :vartype health_checks: list[~azure.iot.deviceupdate.models.HealthCheck] """ _validation = { @@ -1242,11 +1263,11 @@ def __init__( :paramtype module_id: str :keyword state: Aggregate device health state. Required. Known values are: "healthy" and "unhealthy". - :paramtype state: str or ~deviceupdateclient.models.DeviceHealthState + :paramtype state: str or ~azure.iot.deviceupdate.models.DeviceHealthState :keyword digital_twin_model_id: Digital twin model Id. :paramtype digital_twin_model_id: str :keyword health_checks: Array of health checks and their results. Required. - :paramtype health_checks: list[~deviceupdateclient.models.HealthCheck] + :paramtype health_checks: list[~azure.iot.deviceupdate.models.HealthCheck] """ super().__init__(**kwargs) self.device_id = device_id @@ -1260,7 +1281,7 @@ class DeviceHealthFilter(_serialization.Model): """Device health filter. :ivar state: Device health state. Known values are: "healthy" and "unhealthy". - :vartype state: str or ~deviceupdateclient.models.DeviceHealthState + :vartype state: str or ~azure.iot.deviceupdate.models.DeviceHealthState :ivar device_id: Device Id. :vartype device_id: str :ivar module_id: Module Id. @@ -1283,7 +1304,7 @@ def __init__( ): """ :keyword state: Device health state. Known values are: "healthy" and "unhealthy". - :paramtype state: str or ~deviceupdateclient.models.DeviceHealthState + :paramtype state: str or ~azure.iot.deviceupdate.models.DeviceHealthState :keyword device_id: Device Id. :paramtype device_id: str :keyword module_id: Module Id. @@ -1300,8 +1321,8 @@ class DeviceHealthList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.DeviceHealth] + :ivar value: The DeviceHealth items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.DeviceHealth] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1323,8 +1344,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.DeviceHealth] + :keyword value: The DeviceHealth items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.DeviceHealth] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -1342,9 +1363,9 @@ class DeviceOperation(_serialization.Model): :vartype operation_id: str :ivar status: Operation status. Required. Known values are: "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or ~deviceupdateclient.models.OperationStatus + :vartype status: str or ~azure.iot.deviceupdate.models.OperationStatus :ivar error: Operation error encountered, if any. - :vartype error: ~deviceupdateclient.models.Error + :vartype error: ~azure.iot.deviceupdate.models.Error :ivar trace_id: Operation correlation identity that can used by Microsoft Support for troubleshooting. :vartype trace_id: str @@ -1391,9 +1412,9 @@ def __init__( :paramtype operation_id: str :keyword status: Operation status. Required. Known values are: "NotStarted", "Running", "Succeeded", and "Failed". - :paramtype status: str or ~deviceupdateclient.models.OperationStatus + :paramtype status: str or ~azure.iot.deviceupdate.models.OperationStatus :keyword error: Operation error encountered, if any. - :paramtype error: ~deviceupdateclient.models.Error + :paramtype error: ~azure.iot.deviceupdate.models.Error :keyword trace_id: Operation correlation identity that can used by Microsoft Support for troubleshooting. :paramtype trace_id: str @@ -1420,8 +1441,8 @@ class DeviceOperationsList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.DeviceOperation] + :ivar value: The DeviceOperation items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.DeviceOperation] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1443,8 +1464,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.DeviceOperation] + :keyword value: The DeviceOperation items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.DeviceOperation] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -1458,8 +1479,8 @@ class DevicesList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.Device] + :ivar value: The Device items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.Device] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1481,8 +1502,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.Device] + :keyword value: The Device items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.Device] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -1541,10 +1562,10 @@ class Error(_serialization.Model): :ivar target: The target of the error. :vartype target: str :ivar details: An array of errors that led to the reported error. - :vartype details: list[~deviceupdateclient.models.Error] + :vartype details: list[~azure.iot.deviceupdate.models.Error] :ivar innererror: An object containing more specific information than the current object about the error. - :vartype innererror: ~deviceupdateclient.models.InnerError + :vartype innererror: ~azure.iot.deviceupdate.models.InnerError :ivar occurred_date_time: Date and time in UTC when the error occurred. :vartype occurred_date_time: ~datetime.datetime """ @@ -1582,10 +1603,11 @@ def __init__( :keyword target: The target of the error. :paramtype target: str :keyword details: An array of errors that led to the reported error. - :paramtype details: list[~deviceupdateclient.models.Error] + :paramtype details: list[~azure.iot.deviceupdate.models.Error] :keyword innererror: An object containing more specific information than the current object - about the error. - :paramtype innererror: ~deviceupdateclient.models.InnerError + about + the error. + :paramtype innererror: ~azure.iot.deviceupdate.models.InnerError :keyword occurred_date_time: Date and time in UTC when the error occurred. :paramtype occurred_date_time: ~datetime.datetime """ @@ -1604,7 +1626,7 @@ class ErrorResponse(_serialization.Model): All required parameters must be populated in order to send to Azure. :ivar error: The error details. Required. - :vartype error: ~deviceupdateclient.models.Error + :vartype error: ~azure.iot.deviceupdate.models.Error """ _validation = { @@ -1623,7 +1645,7 @@ def __init__( ): """ :keyword error: The error details. Required. - :paramtype error: ~deviceupdateclient.models.Error + :paramtype error: ~azure.iot.deviceupdate.models.Error """ super().__init__(**kwargs) self.error = error @@ -1636,9 +1658,9 @@ class FileImportMetadata(_serialization.Model): :ivar filename: Update file name as specified inside import manifest. Required. :vartype filename: str - :ivar url: Azure Blob location from which the update file can be downloaded by Device Update - for IoT Hub. This is typically a read-only SAS-protected blob URL with an expiration set to at - least 4 hours. Required. + :ivar url: Azure Blob location from which the update file can be downloaded by Device + Update for IoT Hub. This is typically a read-only SAS-protected blob URL with + an expiration set to at least 4 hours. Required. :vartype url: str """ @@ -1662,9 +1684,9 @@ def __init__( """ :keyword filename: Update file name as specified inside import manifest. Required. :paramtype filename: str - :keyword url: Azure Blob location from which the update file can be downloaded by Device Update - for IoT Hub. This is typically a read-only SAS-protected blob URL with an expiration set to at - least 4 hours. Required. + :keyword url: Azure Blob location from which the update file can be downloaded by Device + Update for IoT Hub. This is typically a read-only SAS-protected blob URL with + an expiration set to at least 4 hours. Required. :paramtype url: str """ super().__init__(**kwargs) @@ -1681,7 +1703,7 @@ class Group(_serialization.Model): Hub's device/module twin or $default for devices with no tag. Required. :vartype group_id: str :ivar group_type: Group type. Required. Known values are: "IoTHubTag" and "DefaultNoTag". - :vartype group_type: str or ~deviceupdateclient.models.GroupType + :vartype group_type: str or ~azure.iot.deviceupdate.models.GroupType :ivar created_date_time: Date and time when the update was created. Required. :vartype created_date_time: str :ivar device_count: The number of devices in the group. @@ -1731,10 +1753,11 @@ def __init__( ): """ :keyword group_id: Group identity. This is created from the value of the ADUGroup tag in the - Iot Hub's device/module twin or $default for devices with no tag. Required. + Iot + Hub's device/module twin or $default for devices with no tag. Required. :paramtype group_id: str :keyword group_type: Group type. Required. Known values are: "IoTHubTag" and "DefaultNoTag". - :paramtype group_type: str or ~deviceupdateclient.models.GroupType + :paramtype group_type: str or ~azure.iot.deviceupdate.models.GroupType :keyword created_date_time: Date and time when the update was created. Required. :paramtype created_date_time: str :keyword device_count: The number of devices in the group. @@ -1833,8 +1856,8 @@ class GroupsList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.Group] + :ivar value: The Group items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.Group] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1856,8 +1879,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.Group] + :keyword value: The Group items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.Group] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -1872,7 +1895,7 @@ class HealthCheck(_serialization.Model): :ivar name: Health check name. :vartype name: str :ivar result: Health check result. Known values are: "success" and "userError". - :vartype result: str or ~deviceupdateclient.models.HealthCheckResult + :vartype result: str or ~azure.iot.deviceupdate.models.HealthCheckResult """ _attribute_map = { @@ -1891,7 +1914,7 @@ def __init__( :keyword name: Health check name. :paramtype name: str :keyword result: Health check result. Known values are: "success" and "userError". - :paramtype result: str or ~deviceupdateclient.models.HealthCheckResult + :paramtype result: str or ~azure.iot.deviceupdate.models.HealthCheckResult """ super().__init__(**kwargs) self.name = name @@ -1899,19 +1922,21 @@ def __init__( class ImportManifestMetadata(_serialization.Model): - """Metadata describing the import manifest, a document which describes the files and other metadata about an update version. + """Metadata describing the import manifest, a document which describes the files +and other metadata about an update version. All required parameters must be populated in order to send to Azure. :ivar url: Azure Blob location from which the import manifest can be downloaded by Device - Update for IoT Hub. This is typically a read-only SAS-protected blob URL with an expiration set - to at least 4 hours. Required. + Update for IoT Hub. This is typically a read-only SAS-protected blob URL with + an expiration set to at least 4 hours. Required. :vartype url: str :ivar size_in_bytes: File size in number of bytes. Required. :vartype size_in_bytes: int :ivar hashes: A JSON object containing the hash(es) of the file. At least SHA256 hash is - required. This object can be thought of as a set of key-value pairs where the key is the hash - algorithm, and the value is the hash of the file calculated using that algorithm. Required. + required. This object can be thought of as a set of key-value pairs where the + key is the hash algorithm, and the value is the hash of the file calculated + using that algorithm. Required. :vartype hashes: dict[str, str] """ @@ -1937,14 +1962,15 @@ def __init__( ): """ :keyword url: Azure Blob location from which the import manifest can be downloaded by Device - Update for IoT Hub. This is typically a read-only SAS-protected blob URL with an expiration set - to at least 4 hours. Required. + Update for IoT Hub. This is typically a read-only SAS-protected blob URL with + an expiration set to at least 4 hours. Required. :paramtype url: str :keyword size_in_bytes: File size in number of bytes. Required. :paramtype size_in_bytes: int :keyword hashes: A JSON object containing the hash(es) of the file. At least SHA256 hash is - required. This object can be thought of as a set of key-value pairs where the key is the hash - algorithm, and the value is the hash of the file calculated using that algorithm. Required. + required. This object can be thought of as a set of key-value pairs where the + key is the hash algorithm, and the value is the hash of the file calculated + using that algorithm. Required. :paramtype hashes: dict[str, str] """ super().__init__(**kwargs) @@ -1960,11 +1986,11 @@ class ImportUpdateInputItem(_serialization.Model): :ivar import_manifest: Import manifest metadata like source URL, file size/hashes, etc. Required. - :vartype import_manifest: ~deviceupdateclient.models.ImportManifestMetadata + :vartype import_manifest: ~azure.iot.deviceupdate.models.ImportManifestMetadata :ivar friendly_name: Friendly update name. :vartype friendly_name: str :ivar files: One or more update file properties like filename and source URL. - :vartype files: list[~deviceupdateclient.models.FileImportMetadata] + :vartype files: list[~azure.iot.deviceupdate.models.FileImportMetadata] """ _validation = { @@ -1990,11 +2016,11 @@ def __init__( """ :keyword import_manifest: Import manifest metadata like source URL, file size/hashes, etc. Required. - :paramtype import_manifest: ~deviceupdateclient.models.ImportManifestMetadata + :paramtype import_manifest: ~azure.iot.deviceupdate.models.ImportManifestMetadata :keyword friendly_name: Friendly update name. :paramtype friendly_name: str :keyword files: One or more update file properties like filename and source URL. - :paramtype files: list[~deviceupdateclient.models.FileImportMetadata] + :paramtype files: list[~azure.iot.deviceupdate.models.FileImportMetadata] """ super().__init__(**kwargs) self.import_manifest = import_manifest @@ -2003,7 +2029,8 @@ def __init__( class InnerError(_serialization.Model): - """An object containing more specific information than the current object about the error. + """An object containing more specific information than the current object about +the error. All required parameters must be populated in order to send to Azure. @@ -2016,7 +2043,7 @@ class InnerError(_serialization.Model): :vartype error_detail: str :ivar inner_error: An object containing more specific information than the current object about the error. - :vartype inner_error: ~deviceupdateclient.models.InnerError + :vartype inner_error: ~azure.iot.deviceupdate.models.InnerError """ _validation = { @@ -2048,8 +2075,9 @@ def __init__( :keyword error_detail: The internal error or exception message. :paramtype error_detail: str :keyword inner_error: An object containing more specific information than the current object - about the error. - :paramtype inner_error: ~deviceupdateclient.models.InnerError + about + the error. + :paramtype inner_error: ~azure.iot.deviceupdate.models.InnerError """ super().__init__(**kwargs) self.code = code @@ -2070,7 +2098,7 @@ class InstallResult(_serialization.Model): :ivar result_details: A string containing further details about the install result. :vartype result_details: str :ivar step_results: Array of step results. - :vartype step_results: list[~deviceupdateclient.models.StepResult] + :vartype step_results: list[~azure.iot.deviceupdate.models.StepResult] """ _validation = { @@ -2102,7 +2130,7 @@ def __init__( :keyword result_details: A string containing further details about the install result. :paramtype result_details: str :keyword step_results: Array of step results. - :paramtype step_results: list[~deviceupdateclient.models.StepResult] + :paramtype step_results: list[~azure.iot.deviceupdate.models.StepResult] """ super().__init__(**kwargs) self.result_code = result_code @@ -2112,12 +2140,12 @@ def __init__( class Instructions(_serialization.Model): - """Instructions. + """Update install instructions container. All required parameters must be populated in order to send to Azure. :ivar steps: Collection of installation steps. Required. - :vartype steps: list[~deviceupdateclient.models.Step] + :vartype steps: list[~azure.iot.deviceupdate.models.Step] """ _validation = { @@ -2136,7 +2164,7 @@ def __init__( ): """ :keyword steps: Collection of installation steps. Required. - :paramtype steps: list[~deviceupdateclient.models.Step] + :paramtype steps: list[~azure.iot.deviceupdate.models.Step] """ super().__init__(**kwargs) self.steps = steps @@ -2152,7 +2180,7 @@ class LogCollection(_serialization.Model): :ivar log_collection_id: The log collection id. :vartype log_collection_id: str :ivar device_list: Array of Device Update agent ids. Required. - :vartype device_list: list[~deviceupdateclient.models.DeviceUpdateAgentId] + :vartype device_list: list[~azure.iot.deviceupdate.models.DeviceUpdateAgentId] :ivar description: Description of the diagnostics operation. :vartype description: str :ivar created_date_time: The timestamp when the operation was created. @@ -2161,7 +2189,7 @@ class LogCollection(_serialization.Model): :vartype last_action_date_time: str :ivar status: Operation status. Known values are: "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or ~deviceupdateclient.models.OperationStatus + :vartype status: str or ~azure.iot.deviceupdate.models.OperationStatus """ _validation = { @@ -2193,7 +2221,7 @@ def __init__( :keyword log_collection_id: The log collection id. :paramtype log_collection_id: str :keyword device_list: Array of Device Update agent ids. Required. - :paramtype device_list: list[~deviceupdateclient.models.DeviceUpdateAgentId] + :paramtype device_list: list[~azure.iot.deviceupdate.models.DeviceUpdateAgentId] :keyword description: Description of the diagnostics operation. :paramtype description: str """ @@ -2211,8 +2239,8 @@ class LogCollectionDetailedStatusList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.LogCollectionOperationDetailedStatus] + :ivar value: The LogCollectionOperationDetailedStatus items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.LogCollectionOperationDetailedStatus] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -2234,8 +2262,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.LogCollectionOperationDetailedStatus] + :keyword value: The LogCollectionOperationDetailedStatus items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.LogCollectionOperationDetailedStatus] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -2249,8 +2277,8 @@ class LogCollectionList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.LogCollection] + :ivar value: The LogCollection items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.LogCollection] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -2272,8 +2300,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.LogCollection] + :keyword value: The LogCollection items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.LogCollection] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -2293,9 +2321,9 @@ class LogCollectionOperationDetailedStatus(_serialization.Model): :vartype last_action_date_time: str :ivar status: Operation status. Known values are: "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or ~deviceupdateclient.models.OperationStatus + :vartype status: str or ~azure.iot.deviceupdate.models.OperationStatus :ivar device_status: Status of the devices in the operation. - :vartype device_status: list[~deviceupdateclient.models.LogCollectionOperationDeviceStatus] + :vartype device_status: list[~azure.iot.deviceupdate.models.LogCollectionOperationDeviceStatus] :ivar description: Device diagnostics operation description. :vartype description: str """ @@ -2329,9 +2357,10 @@ def __init__( :paramtype last_action_date_time: str :keyword status: Operation status. Known values are: "NotStarted", "Running", "Succeeded", and "Failed". - :paramtype status: str or ~deviceupdateclient.models.OperationStatus + :paramtype status: str or ~azure.iot.deviceupdate.models.OperationStatus :keyword device_status: Status of the devices in the operation. - :paramtype device_status: list[~deviceupdateclient.models.LogCollectionOperationDeviceStatus] + :paramtype device_status: + list[~azure.iot.deviceupdate.models.LogCollectionOperationDeviceStatus] :keyword description: Device diagnostics operation description. :paramtype description: str """ @@ -2355,7 +2384,7 @@ class LogCollectionOperationDeviceStatus(_serialization.Model): :vartype module_id: str :ivar status: Log upload status. Required. Known values are: "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or ~deviceupdateclient.models.OperationStatus + :vartype status: str or ~azure.iot.deviceupdate.models.OperationStatus :ivar result_code: Log upload result code. :vartype result_code: str :ivar extended_result_code: Log upload extended result code. @@ -2396,7 +2425,7 @@ def __init__( :paramtype module_id: str :keyword status: Log upload status. Required. Known values are: "NotStarted", "Running", "Succeeded", and "Failed". - :paramtype status: str or ~deviceupdateclient.models.OperationStatus + :paramtype status: str or ~azure.iot.deviceupdate.models.OperationStatus :keyword result_code: Log upload result code. :paramtype result_code: str :keyword extended_result_code: Log upload extended result code. @@ -2417,7 +2446,7 @@ class OperationFilter(_serialization.Model): """Operation status filter. :ivar status: Operation status filter. Known values are: "Running" and "NotStarted". - :vartype status: str or ~deviceupdateclient.models.OperationFilterStatus + :vartype status: str or ~azure.iot.deviceupdate.models.OperationFilterStatus """ _attribute_map = { @@ -2432,7 +2461,7 @@ def __init__( ): """ :keyword status: Operation status filter. Known values are: "Running" and "NotStarted". - :paramtype status: str or ~deviceupdateclient.models.OperationFilterStatus + :paramtype status: str or ~azure.iot.deviceupdate.models.OperationFilterStatus """ super().__init__(**kwargs) self.status = status @@ -2474,20 +2503,20 @@ def __init__( class Step(_serialization.Model): """Update install instruction step. - :ivar type: Step type. Known values are: "Inline" and "Reference". - :vartype type: str or ~deviceupdateclient.models.StepType + :ivar type: Step type. Known values are: "inline" and "reference". + :vartype type: str or ~azure.iot.deviceupdate.models.StepType :ivar description: Step description. :vartype description: str :ivar handler: Identity of handler that will execute this step. Required if step type is inline. :vartype handler: str :ivar handler_properties: Parameters to be passed to handler during execution. - :vartype handler_properties: JSON + :vartype handler_properties: dict[str, any] :ivar files: Collection of file names to be passed to handler during execution. Required if step type is inline. :vartype files: list[str] :ivar update_id: Referenced child update identity. Required if step type is reference. - :vartype update_id: ~deviceupdateclient.models.UpdateId + :vartype update_id: ~azure.iot.deviceupdate.models.UpdateId """ _validation = { @@ -2500,7 +2529,7 @@ class Step(_serialization.Model): "type": {"key": "type", "type": "str"}, "description": {"key": "description", "type": "str"}, "handler": {"key": "handler", "type": "str"}, - "handler_properties": {"key": "handlerProperties", "type": "object"}, + "handler_properties": {"key": "handlerProperties", "type": "{object}"}, "files": {"key": "files", "type": "[str]"}, "update_id": {"key": "updateId", "type": "UpdateId"}, } @@ -2508,29 +2537,29 @@ class Step(_serialization.Model): def __init__( self, *, - type: Union[str, "_models.StepType"] = "inline", + type: Optional[Union[str, "_models.StepType"]] = None, description: Optional[str] = None, handler: Optional[str] = None, - handler_properties: Optional[JSON] = None, + handler_properties: Optional[Dict[str, Any]] = None, files: Optional[List[str]] = None, update_id: Optional["_models.UpdateId"] = None, **kwargs ): """ - :keyword type: Step type. Known values are: "Inline" and "Reference". - :paramtype type: str or ~deviceupdateclient.models.StepType + :keyword type: Step type. Known values are: "inline" and "reference". + :paramtype type: str or ~azure.iot.deviceupdate.models.StepType :keyword description: Step description. :paramtype description: str :keyword handler: Identity of handler that will execute this step. Required if step type is inline. :paramtype handler: str :keyword handler_properties: Parameters to be passed to handler during execution. - :paramtype handler_properties: JSON + :paramtype handler_properties: dict[str, any] :keyword files: Collection of file names to be passed to handler during execution. Required if step type is inline. :paramtype files: list[str] :keyword update_id: Referenced child update identity. Required if step type is reference. - :paramtype update_id: ~deviceupdateclient.models.UpdateId + :paramtype update_id: ~azure.iot.deviceupdate.models.UpdateId """ super().__init__(**kwargs) self.type = type @@ -2547,7 +2576,7 @@ class StepResult(_serialization.Model): All required parameters must be populated in order to send to Azure. :ivar update: The update that this step installs if it is of reference type. - :vartype update: ~deviceupdateclient.models.UpdateInfo + :vartype update: ~azure.iot.deviceupdate.models.UpdateInfo :ivar description: Step description. :vartype description: str :ivar result_code: Install result code. Required. @@ -2583,7 +2612,7 @@ def __init__( ): """ :keyword update: The update that this step installs if it is of reference type. - :paramtype update: ~deviceupdateclient.models.UpdateInfo + :paramtype update: ~azure.iot.deviceupdate.models.UpdateInfo :keyword description: Step description. :paramtype description: str :keyword result_code: Install result code. Required. @@ -2645,7 +2674,7 @@ class Update(_serialization.Model): # pylint: disable=too-many-instance-attribu All required parameters must be populated in order to send to Azure. :ivar update_id: Update identity. Required. - :vartype update_id: ~deviceupdateclient.models.UpdateId + :vartype update_id: ~azure.iot.deviceupdate.models.UpdateId :ivar description: Update description specified by creator. :vartype description: str :ivar friendly_name: Friendly update name specified by importer. @@ -2655,14 +2684,15 @@ class Update(_serialization.Model): # pylint: disable=too-many-instance-attribu :ivar update_type: Update type. Deprecated in latest import manifest schema. :vartype update_type: str :ivar installed_criteria: String interpreted by Device Update client to determine if the update - is installed on the device. Deprecated in latest import manifest schema. + is + installed on the device. Deprecated in latest import manifest schema. :vartype installed_criteria: str :ivar compatibility: List of update compatibility information. Required. :vartype compatibility: list[dict[str, str]] :ivar instructions: Update install instructions. - :vartype instructions: ~deviceupdateclient.models.Instructions + :vartype instructions: ~azure.iot.deviceupdate.models.Instructions :ivar referenced_by: List of update identities that reference this update. - :vartype referenced_by: list[~deviceupdateclient.models.UpdateId] + :vartype referenced_by: list[~azure.iot.deviceupdate.models.UpdateId] :ivar scan_result: Update aggregate scan result (calculated from payload file scan results). :vartype scan_result: str :ivar manifest_version: Schema version of manifest used to import the update. Required. @@ -2724,7 +2754,7 @@ def __init__( ): """ :keyword update_id: Update identity. Required. - :paramtype update_id: ~deviceupdateclient.models.UpdateId + :paramtype update_id: ~azure.iot.deviceupdate.models.UpdateId :keyword description: Update description specified by creator. :paramtype description: str :keyword friendly_name: Friendly update name specified by importer. @@ -2734,14 +2764,15 @@ def __init__( :keyword update_type: Update type. Deprecated in latest import manifest schema. :paramtype update_type: str :keyword installed_criteria: String interpreted by Device Update client to determine if the - update is installed on the device. Deprecated in latest import manifest schema. + update is + installed on the device. Deprecated in latest import manifest schema. :paramtype installed_criteria: str :keyword compatibility: List of update compatibility information. Required. :paramtype compatibility: list[dict[str, str]] :keyword instructions: Update install instructions. - :paramtype instructions: ~deviceupdateclient.models.Instructions + :paramtype instructions: ~azure.iot.deviceupdate.models.Instructions :keyword referenced_by: List of update identities that reference this update. - :paramtype referenced_by: list[~deviceupdateclient.models.UpdateId] + :paramtype referenced_by: list[~azure.iot.deviceupdate.models.UpdateId] :keyword scan_result: Update aggregate scan result (calculated from payload file scan results). :paramtype scan_result: str :keyword manifest_version: Schema version of manifest used to import the update. Required. @@ -2928,10 +2959,10 @@ class UpdateFile(UpdateFileBase): # pylint: disable=too-many-instance-attribute :vartype file_id: str :ivar related_files: Optional related files metadata used together DownloadHandler metadata to download payload file. - :vartype related_files: list[~deviceupdateclient.models.UpdateFileBase] + :vartype related_files: list[~azure.iot.deviceupdate.models.UpdateFileBase] :ivar download_handler: Optional download handler for utilizing related files to download payload file. - :vartype download_handler: ~deviceupdateclient.models.UpdateFileDownloadHandler + :vartype download_handler: ~azure.iot.deviceupdate.models.UpdateFileDownloadHandler :ivar etag: File ETag. :vartype etag: str """ @@ -2992,11 +3023,12 @@ def __init__( :keyword file_id: File identity, generated by server at import time. Required. :paramtype file_id: str :keyword related_files: Optional related files metadata used together DownloadHandler metadata - to download payload file. - :paramtype related_files: list[~deviceupdateclient.models.UpdateFileBase] + to + download payload file. + :paramtype related_files: list[~azure.iot.deviceupdate.models.UpdateFileBase] :keyword download_handler: Optional download handler for utilizing related files to download payload file. - :paramtype download_handler: ~deviceupdateclient.models.UpdateFileDownloadHandler + :paramtype download_handler: ~azure.iot.deviceupdate.models.UpdateFileDownloadHandler :keyword etag: File ETag. :paramtype etag: str """ @@ -3118,7 +3150,7 @@ class UpdateInfo(_serialization.Model): All required parameters must be populated in order to send to Azure. :ivar update_id: Update identifier. Required. - :vartype update_id: ~deviceupdateclient.models.UpdateId + :vartype update_id: ~azure.iot.deviceupdate.models.UpdateId :ivar description: Update description. :vartype description: str :ivar friendly_name: Friendly update name. @@ -3145,7 +3177,7 @@ def __init__( ): """ :keyword update_id: Update identifier. Required. - :paramtype update_id: ~deviceupdateclient.models.UpdateId + :paramtype update_id: ~azure.iot.deviceupdate.models.UpdateId """ super().__init__(**kwargs) self.update_id = update_id @@ -3158,8 +3190,8 @@ class UpdateInfoList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.UpdateInfo] + :ivar value: The UpdateInfo items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.UpdateInfo] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -3181,8 +3213,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.UpdateInfo] + :keyword value: The UpdateInfo items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.UpdateInfo] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -3196,8 +3228,8 @@ class UpdateList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.Update] + :ivar value: The Update items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.Update] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -3219,8 +3251,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.Update] + :keyword value: The Update items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.Update] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -3238,14 +3270,14 @@ class UpdateOperation(_serialization.Model): :vartype operation_id: str :ivar status: Operation status. Required. Known values are: "NotStarted", "Running", "Succeeded", and "Failed". - :vartype status: str or ~deviceupdateclient.models.OperationStatus + :vartype status: str or ~azure.iot.deviceupdate.models.OperationStatus :ivar update: The update being imported or deleted. For import, this property will only be populated after import manifest is processed successfully. - :vartype update: ~deviceupdateclient.models.UpdateInfo + :vartype update: ~azure.iot.deviceupdate.models.UpdateInfo :ivar resource_location: Location of the imported update when operation is successful. :vartype resource_location: str :ivar error: Operation error encountered, if any. - :vartype error: ~deviceupdateclient.models.Error + :vartype error: ~azure.iot.deviceupdate.models.Error :ivar trace_id: Operation correlation identity that can used by Microsoft Support for troubleshooting. :vartype trace_id: str @@ -3296,14 +3328,14 @@ def __init__( :paramtype operation_id: str :keyword status: Operation status. Required. Known values are: "NotStarted", "Running", "Succeeded", and "Failed". - :paramtype status: str or ~deviceupdateclient.models.OperationStatus + :paramtype status: str or ~azure.iot.deviceupdate.models.OperationStatus :keyword update: The update being imported or deleted. For import, this property will only be populated after import manifest is processed successfully. - :paramtype update: ~deviceupdateclient.models.UpdateInfo + :paramtype update: ~azure.iot.deviceupdate.models.UpdateInfo :keyword resource_location: Location of the imported update when operation is successful. :paramtype resource_location: str :keyword error: Operation error encountered, if any. - :paramtype error: ~deviceupdateclient.models.Error + :paramtype error: ~azure.iot.deviceupdate.models.Error :keyword trace_id: Operation correlation identity that can used by Microsoft Support for troubleshooting. :paramtype trace_id: str @@ -3332,8 +3364,8 @@ class UpdateOperationsList(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar value: The collection of pageable items. Required. - :vartype value: list[~deviceupdateclient.models.UpdateOperation] + :ivar value: The UpdateOperation items on this page. Required. + :vartype value: list[~azure.iot.deviceupdate.models.UpdateOperation] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -3355,8 +3387,8 @@ def __init__( **kwargs ): """ - :keyword value: The collection of pageable items. Required. - :paramtype value: list[~deviceupdateclient.models.UpdateOperation] + :keyword value: The UpdateOperation items on this page. Required. + :paramtype value: list[~azure.iot.deviceupdate.models.UpdateOperation] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ diff --git a/azext_iot/sdk/deviceupdate/dataplane/operations/__init__.py b/azext_iot/sdk/deviceupdate/dataplane/operations/__init__.py index 6bfcb0899..0b478bbe0 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/operations/__init__.py +++ b/azext_iot/sdk/deviceupdate/dataplane/operations/__init__.py @@ -1,18 +1,20 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._device_update_operations import DeviceUpdateOperations from ._device_management_operations import DeviceManagementOperations +from ._device_update_operations import DeviceUpdateOperations from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'DeviceUpdateOperations', 'DeviceManagementOperations', + 'DeviceUpdateOperations', ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() \ No newline at end of file diff --git a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_management_operations.py b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_management_operations.py index 789422075..d542183f2 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_management_operations.py +++ b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_management_operations.py @@ -1,7 +1,9 @@ # pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload @@ -34,7 +36,7 @@ def build_list_device_classes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -70,7 +72,7 @@ def build_get_device_class_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -105,7 +107,7 @@ def build_update_device_class_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") @@ -143,7 +145,7 @@ def build_delete_device_class_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -178,7 +180,7 @@ def build_list_installable_updates_for_device_class_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -205,20 +207,20 @@ def build_list_installable_updates_for_device_class_request( ) -def build_list_devices_request( +def build_list_health_of_devices_request( instance_id: str, *, - filter: Optional[str] = None, + filter: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/devices") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/deviceHealth") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), } @@ -226,9 +228,8 @@ def build_list_devices_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - if filter is not None: - _params['filter'] = _SERIALIZER.query("filter", filter, 'str') _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') @@ -242,23 +243,91 @@ def build_list_devices_request( ) -def build_import_devices_request( +def build_list_log_collections_request( + instance_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections") + path_format_arguments = { + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_log_collection_request( + log_collection_id: str, + instance_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}") + path_format_arguments = { + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), + "operationId": _SERIALIZER.url("log_collection_id", log_collection_id, 'str', max_length=256, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_start_log_collection_request( + log_collection_id: str, instance_id: str, - *, - json: Union[str, "_models.ImportType"], **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/devices:import") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), + "operationId": _SERIALIZER.url("log_collection_id", log_collection_id, 'str', max_length=256, min_length=1), } _url = _format_url_section(_url, **path_format_arguments) @@ -272,31 +341,30 @@ def build_import_devices_request( _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", + method="PUT", url=_url, params=_params, headers=_headers, - json=json, **kwargs ) -def build_get_device_request( - device_id: str, +def build_get_log_collection_detailed_status_request( + log_collection_id: str, instance_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/devices/{deviceId}") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}/detailedStatus") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - "deviceId": _SERIALIZER.url("device_id", device_id, 'str'), + "operationId": _SERIALIZER.url("log_collection_id", log_collection_id, 'str', max_length=256, min_length=1), } _url = _format_url_section(_url, **path_format_arguments) @@ -316,24 +384,59 @@ def build_get_device_request( ) -def build_get_device_module_request( +def build_list_devices_request( + instance_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/devices") + path_format_arguments = { + "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _params['filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_device_request( device_id: str, - module_id: str, instance_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/devices/{deviceId}/modules/{moduleId}") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/devices/{deviceId}") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "deviceId": _SERIALIZER.url("device_id", device_id, 'str'), - "moduleId": _SERIALIZER.url("module_id", module_id, 'str'), } _url = _format_url_section(_url, **path_format_arguments) @@ -353,20 +456,24 @@ def build_get_device_module_request( ) -def build_get_update_compliance_request( +def build_get_device_module_request( + device_id: str, + module_id: str, instance_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/updateCompliance") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/devices/{deviceId}/modules/{moduleId}") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), + "deviceId": _SERIALIZER.url("device_id", device_id, 'str'), + "moduleId": _SERIALIZER.url("module_id", module_id, 'str'), } _url = _format_url_section(_url, **path_format_arguments) @@ -386,20 +493,21 @@ def build_get_update_compliance_request( ) -def build_list_groups_request( +def build_import_devices_request( instance_id: str, *, - order_by: Optional[str] = None, + json: Union[str, "_models.ImportType"], **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/devices:import") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), } @@ -407,44 +515,47 @@ def build_list_groups_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - if order_by is not None: - _params['orderby'] = _SERIALIZER.query("order_by", order_by, 'str') _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="POST", url=_url, params=_params, headers=_headers, + json=json, **kwargs ) -def build_get_group_request( - group_id: str, +def build_list_groups_request( instance_id: str, + *, + order_by: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - "groupId": _SERIALIZER.url("group_id", group_id, 'str'), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if order_by is not None: + _params['orderby'] = _SERIALIZER.query("order_by", order_by, 'str') # Construct headers _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') @@ -458,7 +569,7 @@ def build_get_group_request( ) -def build_delete_group_request( +def build_get_group_request( group_id: str, instance_id: str, **kwargs: Any @@ -466,7 +577,7 @@ def build_delete_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -485,7 +596,7 @@ def build_delete_group_request( _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="DELETE", + method="GET", url=_url, params=_params, headers=_headers, @@ -493,7 +604,7 @@ def build_delete_group_request( ) -def build_get_update_compliance_for_group_request( +def build_delete_group_request( group_id: str, instance_id: str, **kwargs: Any @@ -501,11 +612,11 @@ def build_get_update_compliance_for_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/updateCompliance") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "groupId": _SERIALIZER.url("group_id", group_id, 'str'), @@ -520,7 +631,7 @@ def build_get_update_compliance_for_group_request( _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="DELETE", url=_url, params=_params, headers=_headers, @@ -536,7 +647,7 @@ def build_list_best_updates_for_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -573,7 +684,7 @@ def build_list_deployments_for_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -611,7 +722,7 @@ def build_get_deployment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -648,7 +759,7 @@ def build_create_or_update_deployment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") @@ -688,7 +799,7 @@ def build_delete_deployment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -725,7 +836,7 @@ def build_get_deployment_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -763,7 +874,7 @@ def build_list_device_class_subgroups_for_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -776,9 +887,9 @@ def build_list_device_class_subgroups_for_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: _params['filter'] = _SERIALIZER.query("filter", filter, 'str') - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') @@ -801,7 +912,7 @@ def build_get_device_class_subgroup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -838,7 +949,7 @@ def build_delete_device_class_subgroup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -866,7 +977,7 @@ def build_delete_device_class_subgroup_request( ) -def build_get_device_class_subgroup_update_compliance_request( +def build_get_best_updates_for_device_class_subgroup_request( group_id: str, device_class_id: str, instance_id: str, @@ -875,11 +986,11 @@ def build_get_device_class_subgroup_update_compliance_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/updateCompliance") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/bestUpdates") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "groupId": _SERIALIZER.url("group_id", group_id, 'str'), @@ -903,20 +1014,22 @@ def build_get_device_class_subgroup_update_compliance_request( ) -def build_get_best_updates_for_device_class_subgroup_request( +def build_list_deployments_for_device_class_subgroup_request( group_id: str, device_class_id: str, instance_id: str, + *, + order_by: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/bestUpdates") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "groupId": _SERIALIZER.url("group_id", group_id, 'str'), @@ -927,6 +1040,8 @@ def build_get_best_updates_for_device_class_subgroup_request( # Construct parameters _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if order_by is not None: + _params['orderby'] = _SERIALIZER.query("order_by", order_by, 'str') # Construct headers _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') @@ -940,34 +1055,32 @@ def build_get_best_updates_for_device_class_subgroup_request( ) -def build_list_deployments_for_device_class_subgroup_request( +def build_get_deployment_for_device_class_subgroup_request( group_id: str, device_class_id: str, + deployment_id: str, instance_id: str, - *, - order_by: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "groupId": _SERIALIZER.url("group_id", group_id, 'str'), "deviceClassId": _SERIALIZER.url("device_class_id", device_class_id, 'str'), + "deploymentId": _SERIALIZER.url("deployment_id", deployment_id, 'str'), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if order_by is not None: - _params['orderby'] = _SERIALIZER.query("order_by", order_by, 'str') # Construct headers _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') @@ -981,7 +1094,7 @@ def build_list_deployments_for_device_class_subgroup_request( ) -def build_get_deployment_for_device_class_subgroup_request( +def build_delete_deployment_for_device_class_subgroup_request( group_id: str, device_class_id: str, deployment_id: str, @@ -991,7 +1104,7 @@ def build_get_deployment_for_device_class_subgroup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -1012,7 +1125,7 @@ def build_get_deployment_for_device_class_subgroup_request( _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="DELETE", url=_url, params=_params, headers=_headers, @@ -1020,7 +1133,7 @@ def build_get_deployment_for_device_class_subgroup_request( ) -def build_delete_deployment_for_device_class_subgroup_request( +def build_stop_deployment_request( group_id: str, device_class_id: str, deployment_id: str, @@ -1030,11 +1143,11 @@ def build_delete_deployment_for_device_class_subgroup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:cancel") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "groupId": _SERIALIZER.url("group_id", group_id, 'str'), @@ -1051,7 +1164,7 @@ def build_delete_deployment_for_device_class_subgroup_request( _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="DELETE", + method="POST", url=_url, params=_params, headers=_headers, @@ -1059,7 +1172,7 @@ def build_delete_deployment_for_device_class_subgroup_request( ) -def build_stop_deployment_request( +def build_retry_deployment_request( group_id: str, device_class_id: str, deployment_id: str, @@ -1069,11 +1182,11 @@ def build_stop_deployment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:cancel") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:retry") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "groupId": _SERIALIZER.url("group_id", group_id, 'str'), @@ -1098,21 +1211,23 @@ def build_stop_deployment_request( ) -def build_retry_deployment_request( +def build_list_device_states_for_device_class_subgroup_deployment_request( group_id: str, device_class_id: str, deployment_id: str, instance_id: str, + *, + filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:retry") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}/devicestates") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "groupId": _SERIALIZER.url("group_id", group_id, 'str'), @@ -1124,12 +1239,14 @@ def build_retry_deployment_request( # Construct parameters _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _params['filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", + method="GET", url=_url, params=_params, headers=_headers, @@ -1147,7 +1264,7 @@ def build_get_device_class_subgroup_deployment_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -1176,35 +1293,29 @@ def build_get_device_class_subgroup_deployment_status_request( ) -def build_list_device_states_for_device_class_subgroup_deployment_request( +def build_get_device_class_subgroup_update_compliance_request( group_id: str, device_class_id: str, - deployment_id: str, instance_id: str, - *, - filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}/devicestates") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/updateCompliance") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "groupId": _SERIALIZER.url("group_id", group_id, 'str'), "deviceClassId": _SERIALIZER.url("device_class_id", device_class_id, 'str'), - "deploymentId": _SERIALIZER.url("deployment_id", deployment_id, 'str'), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - if filter is not None: - _params['filter'] = _SERIALIZER.query("filter", filter, 'str') _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers @@ -1219,24 +1330,22 @@ def build_list_device_states_for_device_class_subgroup_deployment_request( ) -def build_get_operation_status_request( - operation_id: str, +def build_get_update_compliance_for_group_request( + group_id: str, instance_id: str, - *, - if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/operations/{operationId}") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/groups/{groupId}/updateCompliance") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=256, min_length=1), + "groupId": _SERIALIZER.url("group_id", group_id, 'str'), } _url = _format_url_section(_url, **path_format_arguments) @@ -1245,8 +1354,6 @@ def build_get_operation_status_request( _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - if if_none_match is not None: - _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( @@ -1268,7 +1375,7 @@ def build_list_operation_statuses_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -1280,11 +1387,11 @@ def build_list_operation_statuses_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: _params['filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: _params['top'] = _SERIALIZER.query("top", top, 'int') - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') @@ -1298,128 +1405,24 @@ def build_list_operation_statuses_request( ) -def build_start_log_collection_request( - log_collection_id: str, +def build_get_operation_status_request( + operation_id: str, instance_id: str, + *, + if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}") - path_format_arguments = { - "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - "operationId": _SERIALIZER.url("log_collection_id", log_collection_id, 'str', max_length=256, min_length=1), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_log_collection_request( - log_collection_id: str, - instance_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}") - path_format_arguments = { - "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - "operationId": _SERIALIZER.url("log_collection_id", log_collection_id, 'str', max_length=256, min_length=1), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_list_log_collections_request( - instance_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections") - path_format_arguments = { - "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_log_collection_detailed_status_request( - log_collection_id: str, - instance_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}/detailedStatus") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/operations/{operationId}") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - "operationId": _SERIALIZER.url("log_collection_id", log_collection_id, 'str', max_length=256, min_length=1), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=256, min_length=1), } _url = _format_url_section(_url, **path_format_arguments) @@ -1428,6 +1431,8 @@ def build_get_log_collection_detailed_status_request( _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers + if if_none_match is not None: + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( @@ -1439,20 +1444,18 @@ def build_get_log_collection_detailed_status_request( ) -def build_list_health_of_devices_request( +def build_get_update_compliance_request( instance_id: str, - *, - filter: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/deviceDiagnostics/deviceHealth") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/management/updateCompliance") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), } @@ -1461,7 +1464,6 @@ def build_list_health_of_devices_request( # Construct parameters _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - _params['filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') @@ -1480,7 +1482,7 @@ class DeviceManagementOperations: # pylint: disable=too-many-public-methods **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~deviceupdateclient.DeviceUpdateClient`'s + :class:`~azure.iot.deviceupdate.DeviceUpdateClient`'s :attr:`device_management` attribute. """ @@ -1500,16 +1502,17 @@ def list_device_classes( filter: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.DeviceClass"]: - """Gets a list of all device classes (sets of devices compatible with the same updates based on - the model Id and compat properties reported in the Device Update PnP interface in IoT Hub) for - all devices connected to Device Update for IoT Hub. + """Gets a list of all device classes (sets of devices compatible with the same + updates based on the model Id and compat properties reported in the Device + Update PnP interface in IoT Hub) for all devices connected to Device Update for + IoT Hub. :param filter: Restricts the set of device classes returned. You can filter on friendly name. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceClass or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.DeviceClass] + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.DeviceClass] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -1535,7 +1538,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1551,12 +1554,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -1603,7 +1606,7 @@ def get_device_class( :type device_class_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DeviceClass or the result of cls(response) - :rtype: ~deviceupdateclient.models.DeviceClass + :rtype: ~azure.iot.deviceupdate.models.DeviceClass :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1628,7 +1631,7 @@ def get_device_class( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1669,14 +1672,15 @@ def update_device_class( :param device_class_id: Device class identifier. Required. :type device_class_id: str :param device_class_patch: The device class json merge patch body. Currently only supports - patching friendlyName. Required. - :type device_class_patch: ~deviceupdateclient.models.PatchBody + patching + friendlyName. Required. + :type device_class_patch: ~azure.iot.deviceupdate.models.PatchBody :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/merge-patch+json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DeviceClass or the result of cls(response) - :rtype: ~deviceupdateclient.models.DeviceClass + :rtype: ~azure.iot.deviceupdate.models.DeviceClass :raises ~azure.core.exceptions.HttpResponseError: """ @@ -1694,14 +1698,15 @@ def update_device_class( :param device_class_id: Device class identifier. Required. :type device_class_id: str :param device_class_patch: The device class json merge patch body. Currently only supports - patching friendlyName. Required. + patching + friendlyName. Required. :type device_class_patch: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/merge-patch+json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DeviceClass or the result of cls(response) - :rtype: ~deviceupdateclient.models.DeviceClass + :rtype: ~azure.iot.deviceupdate.models.DeviceClass :raises ~azure.core.exceptions.HttpResponseError: """ @@ -1718,14 +1723,15 @@ def update_device_class( :param device_class_id: Device class identifier. Required. :type device_class_id: str :param device_class_patch: The device class json merge patch body. Currently only supports - patching friendlyName. Is either a model type or a IO type. Required. - :type device_class_patch: ~deviceupdateclient.models.PatchBody or IO + patching + friendlyName. Is either a model type or a IO type. Required. + :type device_class_patch: ~azure.iot.deviceupdate.models.PatchBody or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/merge-patch+json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DeviceClass or the result of cls(response) - :rtype: ~deviceupdateclient.models.DeviceClass + :rtype: ~azure.iot.deviceupdate.models.DeviceClass :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1761,7 +1767,7 @@ def update_device_class( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1794,11 +1800,12 @@ def delete_device_class( # pylint: disable=inconsistent-return-statements device_class_id: str, **kwargs: Any ) -> None: - """Deletes a device class. Device classes are created automatically when Device Update-enabled - devices are connected to the hub but are not automatically cleaned up since they are referenced - by DeviceClassSubgroups. If the user has deleted all DeviceClassSubgroups for a device class - they can also delete the device class to remove the records from the system and to stop - checking the compatibility of this device class with new updates. If a device is ever + """Deletes a device class. Device classes are created automatically when Device + Update-enabled devices are connected to the hub but are not automatically + cleaned up since they are referenced by DeviceClassSubgroups. If the user has + deleted all DeviceClassSubgroups for a device class they can also delete the + device class to remove the records from the system and to stop checking the + compatibility of this device class with new updates. If a device is ever reconnected for this device class it will be re-created. :param device_class_id: Device class identifier. Required. @@ -1830,7 +1837,7 @@ def delete_device_class( # pylint: disable=inconsistent-return-statements ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1865,7 +1872,7 @@ def list_installable_updates_for_device_class( :type device_class_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UpdateInfo or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.UpdateInfo] + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.UpdateInfo] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -1891,7 +1898,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1907,12 +1914,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -1948,27 +1955,26 @@ def get_next(next_link=None): list_installable_updates_for_device_class.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceClasses/{deviceClassId}/installableUpdates"} # type: ignore @distributed_trace - def list_devices( + def list_health_of_devices( self, - filter: Optional[str] = None, + filter: str, **kwargs: Any - ) -> Iterable["_models.Device"]: - """Gets a list of devices connected to Device Update for IoT Hub. + ) -> Iterable["_models.DeviceHealth"]: + """Get list of device health. - :param filter: Restricts the set of devices returned. You can filter on GroupId, DeviceClassId, - or GroupId and DeploymentStatus. Use DeploymentStatus eq null to query for devices with no - deployment status (that have never been deployed to). Default value is None. + :param filter: Restricts the set of devices for which device health is returned. You can + filter on status, device id and module id. Required. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Device or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.Device] + :return: An iterator like instance of either DeviceHealth or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.DeviceHealth] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DevicesList] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceHealthList] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1977,23 +1983,23 @@ def list_devices( def prepare_request(next_link=None): if not next_link: - request = build_list_devices_request( + request = build_list_health_of_devices_request( instance_id=self._config.instance_id, filter=filter, api_version=api_version, - template_url=self.list_devices.metadata['url'], + template_url=self.list_health_of_devices.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - request = build_list_devices_request( + request = build_list_health_of_devices_request( instance_id=self._config.instance_id, filter=filter, api_version=api_version, @@ -2003,18 +2009,18 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize("DevicesList", pipeline_response) + deserialized = self._deserialize("DeviceHealthList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -2041,40 +2047,135 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_devices.metadata = {'url': "/deviceUpdate/{instanceId}/management/devices"} # type: ignore + list_health_of_devices.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/deviceHealth"} # type: ignore - def _import_devices_initial( # pylint: disable=inconsistent-return-statements + @distributed_trace + def list_log_collections( self, - import_type: Union[str, "_models.ImportType"], **kwargs: Any - ) -> None: + ) -> Iterable["_models.LogCollection"]: + """Get all device diagnostics log collections. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.LogCollection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollectionList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_log_collections_request( + instance_id=self._config.instance_id, + api_version=api_version, + template_url=self.list_log_collections.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + else: + + request = build_list_log_collections_request( + instance_id=self._config.instance_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LogCollectionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_log_collections.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections"} # type: ignore + + @distributed_trace + def get_log_collection( + self, + log_collection_id: str, + **kwargs: Any + ) -> _models.LogCollection: + """Get the device diagnostics log collection. + + :param log_collection_id: Log collection identifier. Required. + :type log_collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogCollection or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.LogCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - - # @digimaun - str -> object - _json = self._serialize.body(import_type, 'object') + cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollection] - request = build_import_devices_request( + + request = build_get_log_collection_request( + log_collection_id=log_collection_id, instance_id=self._config.instance_id, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._import_devices_initial.metadata['url'], + template_url=self.get_log_collection.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -2086,97 +2187,312 @@ def _import_devices_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) - + deserialized = self._deserialize('LogCollection', pipeline_response) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, {}) - _import_devices_initial.metadata = {'url': "/deviceUpdate/{instanceId}/management/devices:import"} # type: ignore + return deserialized + + get_log_collection.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}"} # type: ignore + + + @overload + def start_log_collection( + self, + log_collection_id: str, + log_collection: _models.LogCollection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogCollection: + """Start the device diagnostics log collection on specified devices. + + :param log_collection_id: Log collection identifier. Required. + :type log_collection_id: str + :param log_collection: The log collection properties. Required. + :type log_collection: ~azure.iot.deviceupdate.models.LogCollection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogCollection or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.LogCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def start_log_collection( + self, + log_collection_id: str, + log_collection: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogCollection: + """Start the device diagnostics log collection on specified devices. + + :param log_collection_id: Log collection identifier. Required. + :type log_collection_id: str + :param log_collection: The log collection properties. Required. + :type log_collection: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogCollection or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.LogCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_import_devices( + def start_log_collection( self, - import_type: Union[str, "_models.ImportType"], + log_collection_id: str, + log_collection: Union[_models.LogCollection, IO], **kwargs: Any - ) -> LROPoller[None]: - """Import existing devices from IoT Hub. This is a long-running-operation; use Operation-Location - response header value to check for operation status. + ) -> _models.LogCollection: + """Start the device diagnostics log collection on specified devices. - :param import_type: The types of devices to import. Known values are: "Devices", "Modules", and - "All". Required. - :type import_type: str or ~deviceupdateclient.models.ImportType + :param log_collection_id: Log collection identifier. Required. + :type log_collection_id: str + :param log_collection: The log collection properties. Is either a model type or a IO type. + Required. + :type log_collection: ~azure.iot.deviceupdate.models.LogCollection or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: LogCollection or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.LogCollection :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollection] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(log_collection, (IO, bytes)): + _content = log_collection + else: + _json = self._serialize.body(log_collection, 'LogCollection') + + request = build_start_log_collection_request( + log_collection_id=log_collection_id, + instance_id=self._config.instance_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.start_log_collection.metadata['url'], + headers=_headers, + params=_params, ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._import_devices_initial( # type: ignore - import_type=import_type, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + deserialized = self._deserialize('LogCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + start_log_collection.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}"} # type: ignore + + + @distributed_trace + def get_log_collection_detailed_status( + self, + log_collection_id: str, + **kwargs: Any + ) -> _models.LogCollectionOperationDetailedStatus: + """Get log collection with detailed status. + + :param log_collection_id: Log collection identifier. Required. + :type log_collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogCollectionOperationDetailedStatus or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.LogCollectionOperationDetailedStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollectionOperationDetailedStatus] + + + request = build_get_log_collection_detailed_status_request( + log_collection_id=log_collection_id, + instance_id=self._config.instance_id, + api_version=api_version, + template_url=self.get_log_collection_detailed_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - if polling is True: - polling_method = cast(PollingMethod, LROBasePolling( - lro_delay, + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('LogCollectionOperationDetailedStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_log_collection_detailed_status.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}/detailedStatus"} # type: ignore + + + @distributed_trace + def list_devices( + self, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Device"]: + """Gets a list of devices connected to Device Update for IoT Hub. + + :param filter: Restricts the set of devices returned. You can filter on GroupId, + DeviceClassId, or GroupId and DeploymentStatus. Use DeploymentStatus eq null to + query for devices with no deployment status (that have never been deployed to). Default value + is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Device or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.Device] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DevicesList] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: - path_format_arguments=path_format_arguments, + request = build_list_devices_request( + instance_id=self._config.instance_id, + filter=filter, + api_version=api_version, + template_url=self.list_devices.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + else: + + request = build_list_devices_request( + instance_id=self._config.instance_id, + filter=filter, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DevicesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + response = pipeline_response.http_response - begin_import_devices.metadata = {'url': "/deviceUpdate/{instanceId}/management/devices:import"} # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_devices.metadata = {'url': "/deviceUpdate/{instanceId}/management/devices"} # type: ignore @distributed_trace def get_device( @@ -2184,14 +2500,14 @@ def get_device( device_id: str, **kwargs: Any ) -> _models.Device: - """Gets the device properties and latest deployment status for a device connected to Device Update - for IoT Hub. + """Gets the device properties and latest deployment status for a device connected + to Device Update for IoT Hub. :param device_id: Device identifier in Azure IoT Hub. Required. :type device_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Device or the result of cls(response) - :rtype: ~deviceupdateclient.models.Device + :rtype: ~azure.iot.deviceupdate.models.Device :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -2216,7 +2532,7 @@ def get_device( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -2250,8 +2566,8 @@ def get_device_module( module_id: str, **kwargs: Any ) -> _models.Device: - """Gets the device module properties and latest deployment status for a device module connected to - Device Update for IoT Hub. + """Gets the device module properties and latest deployment status for a device + module connected to Device Update for IoT Hub. :param device_id: Device identifier in Azure IoT Hub. Required. :type device_id: str @@ -2259,7 +2575,7 @@ def get_device_module( :type module_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Device or the result of cls(response) - :rtype: ~deviceupdateclient.models.Device + :rtype: ~azure.iot.deviceupdate.models.Device :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -2285,7 +2601,7 @@ def get_device_module( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -2312,66 +2628,139 @@ def get_device_module( get_device_module.metadata = {'url': "/deviceUpdate/{instanceId}/management/devices/{deviceId}/modules/{moduleId}"} # type: ignore - @distributed_trace - def get_update_compliance( + def _import_devices_initial( # pylint: disable=inconsistent-return-statements self, + import_type: Union[str, "_models.ImportType"], **kwargs: Any - ) -> _models.UpdateCompliance: - """Gets the breakdown of how many devices are on their latest update, have new updates available, - or are in progress receiving new updates. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UpdateCompliance or the result of cls(response) - :rtype: ~deviceupdateclient.models.UpdateCompliance - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateCompliance] + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - - request = build_get_update_compliance_request( + _json = self._serialize.body(import_type, 'str') + + request = build_import_devices_request( instance_id=self._config.instance_id, api_version=api_version, - template_url=self.get_update_compliance.metadata['url'], + content_type=content_type, + json=_json, + template_url=self._import_devices_initial.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _import_devices_initial.metadata = {'url': "/deviceUpdate/{instanceId}/management/devices:import"} # type: ignore + + + @distributed_trace + def begin_import_devices( + self, + import_type: Union[str, "_models.ImportType"], + **kwargs: Any + ) -> LROPoller[None]: + """Import existing devices from IoT Hub. This is a long-running-operation; use + Operation-Location response header value to check for operation status. + + :param import_type: The types of devices to import. Known values are: "Devices", "Modules", and + "All". Required. + :type import_type: str or ~azure.iot.deviceupdate.models.ImportType + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._import_devices_initial( # type: ignore + import_type=import_type, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('UpdateCompliance', pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } - get_update_compliance.metadata = {'url': "/deviceUpdate/{instanceId}/management/updateCompliance"} # type: ignore + if polling is True: + polling_method = cast(PollingMethod, LROBasePolling( + lro_delay, + lro_options={'final-state-via': 'operation-location'}, + path_format_arguments=path_format_arguments, + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_devices.metadata = {'url': "/deviceUpdate/{instanceId}/management/devices:import"} # type: ignore @distributed_trace def list_groups( @@ -2379,15 +2768,16 @@ def list_groups( order_by: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.Group"]: - """Gets a list of all device groups. The $default group will always be returned first. + """Gets a list of all device groups. The $default group will always be returned + first. :param order_by: Orders the set of groups returned. You can order by groupId, deviceCount, - createdDate, subgroupsWithNewUpdatesAvailableCount, subgroupsWithUpdatesInProgressCount, or - subgroupsOnLatestUpdateCount. Default value is None. + createdDate, subgroupsWithNewUpdatesAvailableCount, + subgroupsWithUpdatesInProgressCount, or subgroupsOnLatestUpdateCount. Default value is None. :type order_by: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Group or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.Group] + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.Group] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -2413,7 +2803,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -2429,12 +2819,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -2481,7 +2871,7 @@ def get_group( :type group_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Group or the result of cls(response) - :rtype: ~deviceupdateclient.models.Group + :rtype: ~azure.iot.deviceupdate.models.Group :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -2506,7 +2896,7 @@ def get_group( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -2539,12 +2929,13 @@ def delete_group( # pylint: disable=inconsistent-return-statements group_id: str, **kwargs: Any ) -> None: - """Deletes a device group. This group is automatically created when a Device Update-enabled device - is connected to the hub and reports its properties. Groups, subgroups, and deployments are not - automatically cleaned up but are retained for history purposes. Users can call this method to - delete a group if they do not need to retain any of the history of the group and no longer need - it. If a device is ever connected again for this group after the group was deleted it will be - automatically re-created but there will be no history. + """Deletes a device group. This group is automatically created when a Device + Update-enabled device is connected to the hub and reports its properties. + Groups, subgroups, and deployments are not automatically cleaned up but are + retained for history purposes. Users can call this method to delete a group if + they do not need to retain any of the history of the group and no longer need + it. If a device is ever connected again for this group after the group was + deleted it will be automatically re-created but there will be no history. :param group_id: Group identifier. Required. :type group_id: str @@ -2575,7 +2966,7 @@ def delete_group( # pylint: disable=inconsistent-return-statements ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -2598,79 +2989,14 @@ def delete_group( # pylint: disable=inconsistent-return-statements delete_group.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}"} # type: ignore - @distributed_trace - def get_update_compliance_for_group( - self, - group_id: str, - **kwargs: Any - ) -> _models.UpdateCompliance: - """Get device group update compliance information such as how many devices are on their latest - update, how many need new updates, and how many are in progress on receiving a new update. - - :param group_id: Group identifier. Required. - :type group_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UpdateCompliance or the result of cls(response) - :rtype: ~deviceupdateclient.models.UpdateCompliance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateCompliance] - - - request = build_get_update_compliance_for_group_request( - group_id=group_id, - instance_id=self._config.instance_id, - api_version=api_version, - template_url=self.get_update_compliance_for_group.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('UpdateCompliance', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_update_compliance_for_group.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/updateCompliance"} # type: ignore - - @distributed_trace def list_best_updates_for_group( self, group_id: str, **kwargs: Any ) -> Iterable["_models.DeviceClassSubgroupUpdatableDevices"]: - """Get the best available updates for a device group and a count of how many devices need each - update. + """Get the best available updates for a device group and a count of how many + devices need each update. :param group_id: Group identifier. Required. :type group_id: str @@ -2678,7 +3004,7 @@ def list_best_updates_for_group( :return: An iterator like instance of either DeviceClassSubgroupUpdatableDevices or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~deviceupdateclient.models.DeviceClassSubgroupUpdatableDevices] + ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.DeviceClassSubgroupUpdatableDevices] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -2704,7 +3030,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -2720,12 +3046,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -2776,7 +3102,7 @@ def list_deployments_for_group( :type order_by: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Deployment or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.Deployment] + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -2803,7 +3129,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -2820,12 +3146,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -2875,7 +3201,7 @@ def get_deployment( :type deployment_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Deployment or the result of cls(response) - :rtype: ~deviceupdateclient.models.Deployment + :rtype: ~azure.iot.deviceupdate.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -2901,7 +3227,7 @@ def get_deployment( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -2945,13 +3271,13 @@ def create_or_update_deployment( :param deployment_id: Deployment identifier. Required. :type deployment_id: str :param deployment: The deployment properties. Required. - :type deployment: ~deviceupdateclient.models.Deployment + :type deployment: ~azure.iot.deviceupdate.models.Deployment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Deployment or the result of cls(response) - :rtype: ~deviceupdateclient.models.Deployment + :rtype: ~azure.iot.deviceupdate.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2978,7 +3304,7 @@ def create_or_update_deployment( :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Deployment or the result of cls(response) - :rtype: ~deviceupdateclient.models.Deployment + :rtype: ~azure.iot.deviceupdate.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ @@ -2998,13 +3324,13 @@ def create_or_update_deployment( :param deployment_id: Deployment identifier. Required. :type deployment_id: str :param deployment: The deployment properties. Is either a model type or a IO type. Required. - :type deployment: ~deviceupdateclient.models.Deployment or IO + :type deployment: ~azure.iot.deviceupdate.models.Deployment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Deployment or the result of cls(response) - :rtype: ~deviceupdateclient.models.Deployment + :rtype: ~azure.iot.deviceupdate.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3041,7 +3367,7 @@ def create_or_update_deployment( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3109,7 +3435,7 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3139,8 +3465,8 @@ def get_deployment_status( deployment_id: str, **kwargs: Any ) -> _models.DeploymentStatus: - """Gets the status of a deployment including a breakdown of how many devices in the deployment are - in progress, completed, or failed. + """Gets the status of a deployment including a breakdown of how many devices in + the deployment are in progress, completed, or failed. :param group_id: Group identifier. Required. :type group_id: str @@ -3148,7 +3474,7 @@ def get_deployment_status( :type deployment_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DeploymentStatus or the result of cls(response) - :rtype: ~deviceupdateclient.models.DeploymentStatus + :rtype: ~azure.iot.deviceupdate.models.DeploymentStatus :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3174,7 +3500,7 @@ def get_deployment_status( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3208,19 +3534,19 @@ def list_device_class_subgroups_for_group( filter: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.DeviceClassSubgroup"]: - """Get the device class subgroups for the group. A device class subgroup is the set of devices - within the group that share the same device class. All devices within the same device class are - compatible with the same updates. + """Get the device class subgroups for the group. A device class subgroup is the + set of devices within the group that share the same device class. All devices + within the same device class are compatible with the same updates. :param group_id: Group identifier. Required. :type group_id: str :param filter: Restricts the set of device class subgroups returned. You can filter on compat - properties by name and value. (i.e. filter=compatProperties/propertyName1 eq 'value1' and - compatProperties/propertyName2 eq 'value2'). Default value is None. + properties by name and value. (i.e. filter=compatProperties/propertyName1 eq + 'value1' and compatProperties/propertyName2 eq 'value2'). Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceClassSubgroup or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.DeviceClassSubgroup] + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.DeviceClassSubgroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -3247,7 +3573,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3264,12 +3590,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -3311,9 +3637,9 @@ def get_device_class_subgroup( device_class_id: str, **kwargs: Any ) -> _models.DeviceClassSubgroup: - """Gets device class subgroup details. A device class subgroup is the set of devices within the - group that share the same device class. All devices within the same device class are compatible - with the same updates. + """Gets device class subgroup details. A device class subgroup is the set of + devices within the group that share the same device class. All devices within + the same device class are compatible with the same updates. :param group_id: Group identifier. Required. :type group_id: str @@ -3321,7 +3647,7 @@ def get_device_class_subgroup( :type device_class_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DeviceClassSubgroup or the result of cls(response) - :rtype: ~deviceupdateclient.models.DeviceClassSubgroup + :rtype: ~azure.iot.deviceupdate.models.DeviceClassSubgroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3347,7 +3673,7 @@ def get_device_class_subgroup( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3381,12 +3707,14 @@ def delete_device_class_subgroup( # pylint: disable=inconsistent-return-stateme device_class_id: str, **kwargs: Any ) -> None: - """Deletes a device class subgroup. This subgroup is automatically created when a Device - Update-enabled device is connected to the hub and reports its properties. Groups, subgroups, - and deployments are not automatically cleaned up but are retained for history purposes. Users - can call this method to delete a subgroup if they do not need to retain any of the history of - the subgroup and no longer need it. If a device is ever connected again for this subgroup after - the subgroup was deleted it will be automatically re-created but there will be no history. + """Deletes a device class subgroup. This subgroup is automatically created when a + Device Update-enabled device is connected to the hub and reports its + properties. Groups, subgroups, and deployments are not automatically cleaned up + but are retained for history purposes. Users can call this method to delete a + subgroup if they do not need to retain any of the history of the subgroup and + no longer need it. If a device is ever connected again for this subgroup after + the subgroup was deleted it will be automatically re-created but there will be + no history. :param group_id: Group identifier. Required. :type group_id: str @@ -3420,7 +3748,7 @@ def delete_device_class_subgroup( # pylint: disable=inconsistent-return-stateme ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3443,76 +3771,6 @@ def delete_device_class_subgroup( # pylint: disable=inconsistent-return-stateme delete_device_class_subgroup.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}"} # type: ignore - @distributed_trace - def get_device_class_subgroup_update_compliance( - self, - group_id: str, - device_class_id: str, - **kwargs: Any - ) -> _models.UpdateCompliance: - """Get device class subgroup update compliance information such as how many devices are on their - latest update, how many need new updates, and how many are in progress on receiving a new - update. - - :param group_id: Group identifier. Required. - :type group_id: str - :param device_class_id: Device class identifier. Required. - :type device_class_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UpdateCompliance or the result of cls(response) - :rtype: ~deviceupdateclient.models.UpdateCompliance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateCompliance] - - - request = build_get_device_class_subgroup_update_compliance_request( - group_id=group_id, - device_class_id=device_class_id, - instance_id=self._config.instance_id, - api_version=api_version, - template_url=self.get_device_class_subgroup_update_compliance.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('UpdateCompliance', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_device_class_subgroup_update_compliance.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/updateCompliance"} # type: ignore - - @distributed_trace def get_best_updates_for_device_class_subgroup( self, @@ -3520,8 +3778,8 @@ def get_best_updates_for_device_class_subgroup( device_class_id: str, **kwargs: Any ) -> _models.DeviceClassSubgroupUpdatableDevices: - """Get the best available update for a device class subgroup and a count of how many devices need - this update. + """Get the best available update for a device class subgroup and a count of how + many devices need this update. :param group_id: Group identifier. Required. :type group_id: str @@ -3529,7 +3787,7 @@ def get_best_updates_for_device_class_subgroup( :type device_class_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DeviceClassSubgroupUpdatableDevices or the result of cls(response) - :rtype: ~deviceupdateclient.models.DeviceClassSubgroupUpdatableDevices + :rtype: ~azure.iot.deviceupdate.models.DeviceClassSubgroupUpdatableDevices :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3555,7 +3813,7 @@ def get_best_updates_for_device_class_subgroup( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3601,7 +3859,7 @@ def list_deployments_for_device_class_subgroup( :type order_by: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Deployment or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.Deployment] + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -3629,7 +3887,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3647,12 +3905,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -3705,79 +3963,7 @@ def get_deployment_for_device_class_subgroup( :type deployment_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Deployment or the result of cls(response) - :rtype: ~deviceupdateclient.models.Deployment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Deployment] - - - request = build_get_deployment_for_device_class_subgroup_request( - group_id=group_id, - device_class_id=device_class_id, - deployment_id=deployment_id, - instance_id=self._config.instance_id, - api_version=api_version, - template_url=self.get_deployment_for_device_class_subgroup.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('Deployment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_deployment_for_device_class_subgroup.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}"} # type: ignore - - - @distributed_trace - def delete_deployment_for_device_class_subgroup( # pylint: disable=inconsistent-return-statements - self, - group_id: str, - device_class_id: str, - deployment_id: str, - **kwargs: Any - ) -> None: - """Deletes a device class subgroup deployment. - - :param group_id: Group identifier. Required. - :type group_id: str - :param device_class_id: Device class identifier. Required. - :type device_class_id: str - :param deployment_id: Deployment identifier. Required. - :type deployment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :rtype: ~azure.iot.deviceupdate.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3789,22 +3975,22 @@ def delete_deployment_for_device_class_subgroup( # pylint: disable=inconsistent _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Deployment] - request = build_delete_deployment_for_device_class_subgroup_request( + request = build_get_deployment_for_device_class_subgroup_request( group_id=group_id, device_class_id=device_class_id, deployment_id=deployment_id, instance_id=self._config.instance_id, api_version=api_version, - template_url=self.delete_deployment_for_device_class_subgroup.metadata['url'], + template_url=self.get_deployment_for_device_class_subgroup.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3816,26 +4002,30 @@ def delete_deployment_for_device_class_subgroup( # pylint: disable=inconsistent response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) + deserialized = self._deserialize('Deployment', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - delete_deployment_for_device_class_subgroup.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}"} # type: ignore + return deserialized + + get_deployment_for_device_class_subgroup.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}"} # type: ignore @distributed_trace - def stop_deployment( + def delete_deployment_for_device_class_subgroup( # pylint: disable=inconsistent-return-statements self, group_id: str, device_class_id: str, deployment_id: str, **kwargs: Any - ) -> _models.Deployment: - """Stops a deployment. + ) -> None: + """Deletes a device class subgroup deployment. :param group_id: Group identifier. Required. :type group_id: str @@ -3844,8 +4034,8 @@ def stop_deployment( :param deployment_id: Deployment identifier. Required. :type deployment_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Deployment or the result of cls(response) - :rtype: ~deviceupdateclient.models.Deployment + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3857,22 +4047,22 @@ def stop_deployment( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Deployment] + cls = kwargs.pop('cls', None) # type: ClsType[None] - request = build_stop_deployment_request( + request = build_delete_deployment_for_device_class_subgroup_request( group_id=group_id, device_class_id=device_class_id, deployment_id=deployment_id, instance_id=self._config.instance_id, api_version=api_version, - template_url=self.stop_deployment.metadata['url'], + template_url=self.delete_deployment_for_device_class_subgroup.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3884,30 +4074,26 @@ def stop_deployment( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('Deployment', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, {}) - stop_deployment.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:cancel"} # type: ignore + delete_deployment_for_device_class_subgroup.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}"} # type: ignore @distributed_trace - def retry_deployment( + def stop_deployment( self, group_id: str, device_class_id: str, deployment_id: str, **kwargs: Any ) -> _models.Deployment: - """Retries a deployment with failed devices. + """Stops a deployment. :param group_id: Group identifier. Required. :type group_id: str @@ -3917,7 +4103,7 @@ def retry_deployment( :type deployment_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Deployment or the result of cls(response) - :rtype: ~deviceupdateclient.models.Deployment + :rtype: ~azure.iot.deviceupdate.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -3932,19 +4118,19 @@ def retry_deployment( cls = kwargs.pop('cls', None) # type: ClsType[_models.Deployment] - request = build_retry_deployment_request( + request = build_stop_deployment_request( group_id=group_id, device_class_id=device_class_id, deployment_id=deployment_id, instance_id=self._config.instance_id, api_version=api_version, - template_url=self.retry_deployment.metadata['url'], + template_url=self.stop_deployment.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -3968,19 +4154,18 @@ def retry_deployment( return deserialized - retry_deployment.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:retry"} # type: ignore + stop_deployment.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:cancel"} # type: ignore @distributed_trace - def get_device_class_subgroup_deployment_status( + def retry_deployment( self, group_id: str, device_class_id: str, deployment_id: str, **kwargs: Any - ) -> _models.DeviceClassSubgroupDeploymentStatus: - """Gets the status of a deployment including a breakdown of how many devices in the deployment are - in progress, completed, or failed. + ) -> _models.Deployment: + """Retries a deployment with failed devices. :param group_id: Group identifier. Required. :type group_id: str @@ -3989,8 +4174,8 @@ def get_device_class_subgroup_deployment_status( :param deployment_id: Deployment identifier. Required. :type deployment_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeviceClassSubgroupDeploymentStatus or the result of cls(response) - :rtype: ~deviceupdateclient.models.DeviceClassSubgroupDeploymentStatus + :return: Deployment or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -4002,22 +4187,22 @@ def get_device_class_subgroup_deployment_status( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceClassSubgroupDeploymentStatus] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Deployment] - request = build_get_device_class_subgroup_deployment_status_request( + request = build_retry_deployment_request( group_id=group_id, device_class_id=device_class_id, deployment_id=deployment_id, instance_id=self._config.instance_id, api_version=api_version, - template_url=self.get_device_class_subgroup_deployment_status.metadata['url'], + template_url=self.retry_deployment.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -4034,14 +4219,14 @@ def get_device_class_subgroup_deployment_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('DeviceClassSubgroupDeploymentStatus', pipeline_response) + deserialized = self._deserialize('Deployment', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_device_class_subgroup_deployment_status.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}/status"} # type: ignore + retry_deployment.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:retry"} # type: ignore @distributed_trace @@ -4053,8 +4238,8 @@ def list_device_states_for_device_class_subgroup_deployment( filter: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.DeploymentDeviceState"]: - """Gets a list of devices in a deployment along with their state. Useful for getting a list of - failed devices. + """Gets a list of devices in a deployment along with their state. Useful for + getting a list of failed devices. :param group_id: Group identifier. Required. :type group_id: str @@ -4068,7 +4253,7 @@ def list_device_states_for_device_class_subgroup_deployment( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeploymentDeviceState or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.DeploymentDeviceState] + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.DeploymentDeviceState] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -4097,7 +4282,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -4116,12 +4301,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -4157,21 +4342,25 @@ def get_next(next_link=None): list_device_states_for_device_class_subgroup_deployment.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}/devicestates"} # type: ignore @distributed_trace - def get_operation_status( + def get_device_class_subgroup_deployment_status( self, - operation_id: str, - access_condition: Optional[_models.AccessCondition] = None, + group_id: str, + device_class_id: str, + deployment_id: str, **kwargs: Any - ) -> _models.DeviceOperation: - """Retrieve operation status. + ) -> _models.DeviceClassSubgroupDeploymentStatus: + """Gets the status of a deployment including a breakdown of how many devices in + the deployment are in progress, completed, or failed. - :param operation_id: Operation identifier. Required. - :type operation_id: str - :param access_condition: Parameter group. Default value is None. - :type access_condition: ~deviceupdateclient.models.AccessCondition + :param group_id: Group identifier. Required. + :type group_id: str + :param device_class_id: Device class identifier. Required. + :type device_class_id: str + :param deployment_id: Deployment identifier. Required. + :type deployment_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeviceOperation or the result of cls(response) - :rtype: ~deviceupdateclient.models.DeviceOperation + :return: DeviceClassSubgroupDeploymentStatus or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.DeviceClassSubgroupDeploymentStatus :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -4183,24 +4372,22 @@ def get_operation_status( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceOperation] - - _if_none_match = None - if access_condition is not None: - _if_none_match = access_condition.if_none_match + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceClassSubgroupDeploymentStatus] - request = build_get_operation_status_request( - operation_id=operation_id, + + request = build_get_device_class_subgroup_deployment_status_request( + group_id=group_id, + device_class_id=device_class_id, + deployment_id=deployment_id, instance_id=self._config.instance_id, - if_none_match=_if_none_match, api_version=api_version, - template_url=self.get_operation_status.metadata['url'], + template_url=self.get_device_class_subgroup_deployment_status.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -4214,194 +4401,37 @@ def get_operation_status( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) - - deserialized = self._deserialize('DeviceOperation', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - get_operation_status.metadata = {'url': "/deviceUpdate/{instanceId}/management/operations/{operationId}"} # type: ignore - - - @distributed_trace - def list_operation_statuses( - self, - filter: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.DeviceOperation"]: - """Get a list of all device import operations. Completed operations are kept for 7 days before - auto-deleted. - - :param filter: Restricts the set of operations returned. Only one specific filter is supported: - "status eq 'NotStarted' or status eq 'Running'". Default value is None. - :type filter: str - :param top: Specifies a non-negative integer n that limits the number of items returned from a - collection. The service returns the number of available items up to but not greater than the - specified value n. Default value is None. - :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeviceOperation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.DeviceOperation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceOperationsList] - - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_operation_statuses_request( - instance_id=self._config.instance_id, - filter=filter, - top=top, - api_version=api_version, - template_url=self.list_operation_statuses.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - else: - - request = build_list_operation_statuses_request( - instance_id=self._config.instance_id, - filter=filter, - top=top, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DeviceOperationsList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_operation_statuses.metadata = {'url': "/deviceUpdate/{instanceId}/management/operations"} # type: ignore - - @overload - def start_log_collection( - self, - log_collection_id: str, - log_collection: _models.LogCollection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogCollection: - """Start the device diagnostics log collection on specified devices. - - :param log_collection_id: Log collection identifier. Required. - :type log_collection_id: str - :param log_collection: The log collection properties. Required. - :type log_collection: ~deviceupdateclient.models.LogCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogCollection or the result of cls(response) - :rtype: ~deviceupdateclient.models.LogCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def start_log_collection( - self, - log_collection_id: str, - log_collection: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogCollection: - """Start the device diagnostics log collection on specified devices. - - :param log_collection_id: Log collection identifier. Required. - :type log_collection_id: str - :param log_collection: The log collection properties. Required. - :type log_collection: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogCollection or the result of cls(response) - :rtype: ~deviceupdateclient.models.LogCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('DeviceClassSubgroupDeploymentStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_device_class_subgroup_deployment_status.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}/status"} # type: ignore @distributed_trace - def start_log_collection( + def get_device_class_subgroup_update_compliance( self, - log_collection_id: str, - log_collection: Union[_models.LogCollection, IO], + group_id: str, + device_class_id: str, **kwargs: Any - ) -> _models.LogCollection: - """Start the device diagnostics log collection on specified devices. + ) -> _models.UpdateCompliance: + """Get device class subgroup update compliance information such as how many + devices are on their latest update, how many need new updates, and how many are + in progress on receiving a new update. - :param log_collection_id: Log collection identifier. Required. - :type log_collection_id: str - :param log_collection: The log collection properties. Is either a model type or a IO type. - Required. - :type log_collection: ~deviceupdateclient.models.LogCollection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param group_id: Group identifier. Required. + :type group_id: str + :param device_class_id: Device class identifier. Required. + :type device_class_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogCollection or the result of cls(response) - :rtype: ~deviceupdateclient.models.LogCollection + :return: UpdateCompliance or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.UpdateCompliance :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -4409,35 +4439,25 @@ def start_log_collection( } error_map.update(kwargs.pop('error_map', {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollection] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(log_collection, (IO, bytes)): - _content = log_collection - else: - _json = self._serialize.body(log_collection, 'LogCollection') + cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateCompliance] - request = build_start_log_collection_request( - log_collection_id=log_collection_id, + + request = build_get_device_class_subgroup_update_compliance_request( + group_id=group_id, + device_class_id=device_class_id, instance_id=self._config.instance_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.start_log_collection.metadata['url'], + template_url=self.get_device_class_subgroup_update_compliance.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -4449,34 +4469,36 @@ def start_log_collection( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('LogCollection', pipeline_response) + deserialized = self._deserialize('UpdateCompliance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - start_log_collection.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}"} # type: ignore + get_device_class_subgroup_update_compliance.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/updateCompliance"} # type: ignore @distributed_trace - def get_log_collection( + def get_update_compliance_for_group( self, - log_collection_id: str, + group_id: str, **kwargs: Any - ) -> _models.LogCollection: - """Get the device diagnostics log collection. + ) -> _models.UpdateCompliance: + """Get device group update compliance information such as how many devices are on + their latest update, how many need new updates, and how many are in progress on + receiving a new update. - :param log_collection_id: Log collection identifier. Required. - :type log_collection_id: str + :param group_id: Group identifier. Required. + :type group_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogCollection or the result of cls(response) - :rtype: ~deviceupdateclient.models.LogCollection + :return: UpdateCompliance or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.UpdateCompliance :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -4488,20 +4510,20 @@ def get_log_collection( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollection] + cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateCompliance] - request = build_get_log_collection_request( - log_collection_id=log_collection_id, + request = build_get_update_compliance_for_group_request( + group_id=group_id, instance_id=self._config.instance_id, api_version=api_version, - template_url=self.get_log_collection.metadata['url'], + template_url=self.get_update_compliance_for_group.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -4518,33 +4540,43 @@ def get_log_collection( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('LogCollection', pipeline_response) + deserialized = self._deserialize('UpdateCompliance', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_log_collection.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}"} # type: ignore + get_update_compliance_for_group.metadata = {'url': "/deviceUpdate/{instanceId}/management/groups/{groupId}/updateCompliance"} # type: ignore @distributed_trace - def list_log_collections( + def list_operation_statuses( self, + filter: Optional[str] = None, + top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.LogCollection"]: - """Get all device diagnostics log collections. + ) -> Iterable["_models.DeviceOperation"]: + """Get a list of all device import operations. Completed operations are kept for 7 + days before auto-deleted. + :param filter: Restricts the set of operations returned. Only one specific filter is + supported: "status eq 'NotStarted' or status eq 'Running'". Default value is None. + :type filter: str + :param top: Specifies a non-negative integer n that limits the number of items returned + from a collection. The service returns the number of available items up to but + not greater than the specified value n. Default value is None. + :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LogCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.LogCollection] + :return: An iterator like instance of either DeviceOperation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.DeviceOperation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollectionList] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceOperationsList] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -4553,23 +4585,27 @@ def list_log_collections( def prepare_request(next_link=None): if not next_link: - request = build_list_log_collections_request( + request = build_list_operation_statuses_request( instance_id=self._config.instance_id, + filter=filter, + top=top, api_version=api_version, - template_url=self.list_log_collections.metadata['url'], + template_url=self.list_operation_statuses.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - request = build_list_log_collections_request( + request = build_list_operation_statuses_request( instance_id=self._config.instance_id, + filter=filter, + top=top, api_version=api_version, template_url=next_link, headers=_headers, @@ -4577,18 +4613,18 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize("LogCollectionList", pipeline_response) + deserialized = self._deserialize("DeviceOperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -4615,21 +4651,24 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_log_collections.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections"} # type: ignore + list_operation_statuses.metadata = {'url': "/deviceUpdate/{instanceId}/management/operations"} # type: ignore @distributed_trace - def get_log_collection_detailed_status( + def get_operation_status( self, - log_collection_id: str, + operation_id: str, + access_condition: Optional[_models.AccessCondition] = None, **kwargs: Any - ) -> _models.LogCollectionOperationDetailedStatus: - """Get log collection with detailed status. + ) -> _models.DeviceOperation: + """Retrieve operation status. - :param log_collection_id: Log collection identifier. Required. - :type log_collection_id: str + :param operation_id: Operation identifier. Required. + :type operation_id: str + :param access_condition: Parameter group. Default value is None. + :type access_condition: ~azure.iot.deviceupdate.models.AccessCondition :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogCollectionOperationDetailedStatus or the result of cls(response) - :rtype: ~deviceupdateclient.models.LogCollectionOperationDetailedStatus + :return: DeviceOperation or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.DeviceOperation :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -4641,20 +4680,24 @@ def get_log_collection_detailed_status( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollectionOperationDetailedStatus] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceOperation] - - request = build_get_log_collection_detailed_status_request( - log_collection_id=log_collection_id, + _if_none_match = None + if access_condition is not None: + _if_none_match = access_condition.if_none_match + + request = build_get_operation_status_request( + operation_id=operation_id, instance_id=self._config.instance_id, + if_none_match=_if_none_match, api_version=api_version, - template_url=self.get_log_collection_detailed_status.metadata['url'], + template_url=self.get_operation_status.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -4671,107 +4714,76 @@ def get_log_collection_detailed_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('LogCollectionOperationDetailedStatus', pipeline_response) + response_headers = {} + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + deserialized = self._deserialize('DeviceOperation', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - get_log_collection_detailed_status.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}/detailedStatus"} # type: ignore + get_operation_status.metadata = {'url': "/deviceUpdate/{instanceId}/management/operations/{operationId}"} # type: ignore @distributed_trace - def list_health_of_devices( + def get_update_compliance( self, - filter: str, **kwargs: Any - ) -> Iterable["_models.DeviceHealth"]: - """Get list of device health. + ) -> _models.UpdateCompliance: + """Gets the breakdown of how many devices are on their latest update, have new + updates available, or are in progress receiving new updates. - :param filter: Restricts the set of devices for which device health is returned. You can filter - on status, device id and module id. Required. - :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeviceHealth or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.DeviceHealth] + :return: UpdateCompliance or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.UpdateCompliance :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceHealthList] + cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateCompliance] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + + request = build_get_update_compliance_request( + instance_id=self._config.instance_id, + api_version=api_version, + template_url=self.get_update_compliance.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } - error_map.update(kwargs.pop('error_map', {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_health_of_devices_request( - instance_id=self._config.instance_id, - filter=filter, - api_version=api_version, - template_url=self.list_health_of_devices.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - else: - - request = build_list_health_of_devices_request( - instance_id=self._config.instance_id, - filter=filter, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.method = "GET" - return request + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) - def extract_data(pipeline_response): - deserialized = self._deserialize("DeviceHealthList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) + response = pipeline_response.http_response - def get_next(next_link=None): - request = prepare_request(next_link) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response + deserialized = self._deserialize('UpdateCompliance', pipeline_response) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) + if cls: + return cls(pipeline_response, deserialized, {}) - return pipeline_response + return deserialized + get_update_compliance.metadata = {'url': "/deviceUpdate/{instanceId}/management/updateCompliance"} # type: ignore - return ItemPaged( - get_next, extract_data - ) - list_health_of_devices.metadata = {'url': "/deviceUpdate/{instanceId}/management/deviceDiagnostics/deviceHealth"} # type: ignore diff --git a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py index 18a8b5679..527c6cc0a 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py +++ b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py @@ -1,7 +1,9 @@ # pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.2, generator: @autorest/python@5.19.0) +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload @@ -35,7 +37,7 @@ def build_list_updates_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -65,19 +67,21 @@ def build_list_updates_request( ) -def build_import_update_request( +def build_list_operation_statuses_request( instance_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates:import") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/operations") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), } @@ -86,14 +90,16 @@ def build_import_update_request( # Construct parameters _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _params['filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + _params['top'] = _SERIALIZER.query("top", top, 'int') # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", + method="GET", url=_url, params=_params, headers=_headers, @@ -101,10 +107,8 @@ def build_import_update_request( ) -def build_get_update_request( - provider: str, - name: str, - version: str, +def build_get_operation_status_request( + operation_id: str, instance_id: str, *, if_none_match: Optional[str] = None, @@ -113,16 +117,14 @@ def build_get_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/operations/{operationId}") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - "provider": _SERIALIZER.url("provider", provider, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - "version": _SERIALIZER.url("version", version, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=256, min_length=1), } _url = _format_url_section(_url, **path_format_arguments) @@ -144,26 +146,20 @@ def build_get_update_request( ) -def build_delete_update_request( - provider: str, - name: str, - version: str, +def build_list_providers_request( instance_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - "provider": _SERIALIZER.url("provider", provider, 'str'), - "name": _SERIALIZER.url("name", name, 'str'), - "version": _SERIALIZER.url("version", version, 'str'), } _url = _format_url_section(_url, **path_format_arguments) @@ -175,7 +171,7 @@ def build_delete_update_request( _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="DELETE", + method="GET", url=_url, params=_params, headers=_headers, @@ -183,20 +179,22 @@ def build_delete_update_request( ) -def build_list_providers_request( +def build_list_names_request( + provider: str, instance_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), + "provider": _SERIALIZER.url("provider", provider, 'str'), } _url = _format_url_section(_url, **path_format_arguments) @@ -216,28 +214,34 @@ def build_list_providers_request( ) -def build_list_names_request( +def build_list_versions_request( provider: str, + name: str, instance_id: str, + *, + filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "provider": _SERIALIZER.url("provider", provider, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _params['filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') @@ -251,36 +255,38 @@ def build_list_names_request( ) -def build_list_versions_request( +def build_get_update_request( provider: str, name: str, + version: str, instance_id: str, *, - filter: Optional[str] = None, + if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "provider": _SERIALIZER.url("provider", provider, 'str'), "name": _SERIALIZER.url("name", name, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if filter is not None: - _params['filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers + if if_none_match is not None: + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( @@ -292,7 +298,7 @@ def build_list_versions_request( ) -def build_list_files_request( +def build_delete_update_request( provider: str, name: str, version: str, @@ -302,11 +308,11 @@ def build_list_files_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "provider": _SERIALIZER.url("provider", provider, 'str'), @@ -323,7 +329,7 @@ def build_list_files_request( _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="DELETE", url=_url, params=_params, headers=_headers, @@ -331,30 +337,26 @@ def build_list_files_request( ) -def build_get_file_request( +def build_list_files_request( provider: str, name: str, version: str, - file_id: str, instance_id: str, - *, - if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files/{fileId}") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), "provider": _SERIALIZER.url("provider", provider, 'str'), "name": _SERIALIZER.url("name", name, 'str'), "version": _SERIALIZER.url("version", version, 'str'), - "fileId": _SERIALIZER.url("file_id", file_id, 'str'), } _url = _format_url_section(_url, **path_format_arguments) @@ -363,8 +365,6 @@ def build_get_file_request( _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - if if_none_match is not None: - _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( @@ -376,35 +376,40 @@ def build_get_file_request( ) -def build_list_operation_statuses_request( +def build_get_file_request( + provider: str, + name: str, + version: str, + file_id: str, instance_id: str, *, - filter: Optional[str] = None, - top: Optional[int] = None, + if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/operations") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files/{fileId}") # pylint: disable=line-too-long path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), + "provider": _SERIALIZER.url("provider", provider, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + "fileId": _SERIALIZER.url("file_id", file_id, 'str'), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - if filter is not None: - _params['filter'] = _SERIALIZER.query("filter", filter, 'str') - if top is not None: - _params['top'] = _SERIALIZER.query("top", top, 'int') _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers + if if_none_match is not None: + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( @@ -416,24 +421,21 @@ def build_list_operation_statuses_request( ) -def build_get_operation_status_request( - operation_id: str, +def build_import_update_request( instance_id: str, - *, - if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2026-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") # Construct URL - _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates/operations/{operationId}") + _url = kwargs.pop("template_url", "/deviceUpdate/{instanceId}/updates:import") path_format_arguments = { "instanceId": _SERIALIZER.url("instance_id", instance_id, 'str', skip_quote=True), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=256, min_length=1), } _url = _format_url_section(_url, **path_format_arguments) @@ -442,12 +444,12 @@ def build_get_operation_status_request( _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - if if_none_match is not None: - _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="POST", url=_url, params=_params, headers=_headers, @@ -460,7 +462,7 @@ class DeviceUpdateOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~deviceupdateclient.DeviceUpdateClient`'s + :class:`~azure.iot.deviceupdate.DeviceUpdateClient`'s :attr:`device_update` attribute. """ @@ -489,7 +491,7 @@ def list_updates( :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Update or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.Update] + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.Update] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} @@ -516,7 +518,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -533,12 +535,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -573,44 +575,155 @@ def get_next(next_link=None): ) list_updates.metadata = {'url': "/deviceUpdate/{instanceId}/updates"} # type: ignore - def _import_update_initial( # pylint: disable=inconsistent-return-statements + @distributed_trace + def list_operation_statuses( self, - update_to_import: Union[List[_models.ImportUpdateInputItem], IO], + filter: Optional[str] = None, + top: Optional[int] = None, **kwargs: Any - ) -> None: + ) -> Iterable["_models.UpdateOperation"]: + """Get a list of all import update operations. Completed operations are kept for 7 + days before auto-deleted. Delete operations are not returned by this API + version. + + :param filter: Optional to filter operations by status property. Only one specific filter is + supported: "status eq 'NotStarted' or status eq 'Running'". Default value is None. + :type filter: str + :param top: Specifies a non-negative integer n that limits the number of items returned + from a collection. The service returns the number of available items up to but + not greater than the specified value n. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UpdateOperation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.iot.deviceupdate.models.UpdateOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateOperationsList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_operation_statuses_request( + instance_id=self._config.instance_id, + filter=filter, + top=top, + api_version=api_version, + template_url=self.list_operation_statuses.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + else: + + request = build_list_operation_statuses_request( + instance_id=self._config.instance_id, + filter=filter, + top=top, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UpdateOperationsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_operation_statuses.metadata = {'url': "/deviceUpdate/{instanceId}/updates/operations"} # type: ignore + + @distributed_trace + def get_operation_status( + self, + operation_id: str, + access_condition: Optional[_models.AccessCondition] = None, + **kwargs: Any + ) -> _models.UpdateOperation: + """Retrieve operation status. + + :param operation_id: Operation identifier. Required. + :type operation_id: str + :param access_condition: Parameter group. Default value is None. + :type access_condition: ~azure.iot.deviceupdate.models.AccessCondition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UpdateOperation or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.UpdateOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateOperation] - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_to_import, (IO, bytes)): - _content = update_to_import - else: - _json = self._serialize.body(update_to_import, '[ImportUpdateInputItem]') + _if_none_match = None + if access_condition is not None: + _if_none_match = access_condition.if_none_match - request = build_import_update_request( + request = build_get_operation_status_request( + operation_id=operation_id, instance_id=self._config.instance_id, + if_none_match=_if_none_match, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._import_update_initial.metadata['url'], + template_url=self.get_operation_status.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -622,390 +735,31 @@ def _import_update_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) - - - if cls: - return cls(pipeline_response, None, response_headers) - - _import_update_initial.metadata = {'url': "/deviceUpdate/{instanceId}/updates:import"} # type: ignore - - - @overload - def begin_import_update( - self, - update_to_import: List[_models.ImportUpdateInputItem], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Import new update version. This is a long-running-operation; use Operation-Location response - header value to check for operation status. - - :param update_to_import: The update to be imported (see schema - https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for details). - Required. - :type update_to_import: list[~deviceupdateclient.models.ImportUpdateInputItem] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_import_update( - self, - update_to_import: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Import new update version. This is a long-running-operation; use Operation-Location response - header value to check for operation status. - - :param update_to_import: The update to be imported (see schema - https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for details). - Required. - :type update_to_import: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - - @distributed_trace - def begin_import_update( - self, - update_to_import: Union[List[_models.ImportUpdateInputItem], IO], - **kwargs: Any - ) -> LROPoller[None]: - """Import new update version. This is a long-running-operation; use Operation-Location response - header value to check for operation status. - - :param update_to_import: The update to be imported (see schema - https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for details). Is - either a list type or a IO type. Required. - :type update_to_import: list[~deviceupdateclient.models.ImportUpdateInputItem] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._import_update_initial( # type: ignore - update_to_import=update_to_import, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - - if polling is True: - polling_method = cast(PollingMethod, LROBasePolling( - lro_delay, - - path_format_arguments=path_format_arguments, - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_import_update.metadata = {'url': "/deviceUpdate/{instanceId}/updates:import"} # type: ignore - - @distributed_trace - def get_update( - self, - provider: str, - name: str, - version: str, - access_condition: Optional[_models.AccessCondition] = None, - **kwargs: Any - ) -> _models.Update: - """Get a specific update version. - - :param provider: Update provider. Required. - :type provider: str - :param name: Update name. Required. - :type name: str - :param version: Update version. Required. - :type version: str - :param access_condition: Parameter group. Default value is None. - :type access_condition: ~deviceupdateclient.models.AccessCondition - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Update or the result of cls(response) - :rtype: ~deviceupdateclient.models.Update - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Update] - - _if_none_match = None - if access_condition is not None: - _if_none_match = access_condition.if_none_match - - request = build_get_update_request( - provider=provider, - name=name, - version=version, - instance_id=self._config.instance_id, - if_none_match=_if_none_match, - api_version=api_version, - template_url=self.get_update.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('Update', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_update.metadata = {'url': "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}"} # type: ignore - - - def _delete_update_initial( # pylint: disable=inconsistent-return-statements - self, - provider: str, - name: str, - version: str, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - - - request = build_delete_update_request( - provider=provider, - name=name, - version=version, - instance_id=self._config.instance_id, - api_version=api_version, - template_url=self._delete_update_initial.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) - - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_update_initial.metadata = {'url': "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}"} # type: ignore - - - @distributed_trace - def begin_delete_update( - self, - provider: str, - name: str, - version: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a specific update version. This is a long-running-operation; use Operation-Location - response header value to check for operation status. - - :param provider: Update provider. Required. - :type provider: str - :param name: Update name. Required. - :type name: str - :param version: Update version. Required. - :type version: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_update_initial( # type: ignore - provider=provider, - name=name, - version=version, - api_version=api_version, - cls=lambda x,y,z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop('error_map', None) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) + deserialized = self._deserialize('UpdateOperation', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } + return deserialized - if polling is True: - polling_method = cast(PollingMethod, LROBasePolling( - lro_delay, - - path_format_arguments=path_format_arguments, - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + get_operation_status.metadata = {'url': "/deviceUpdate/{instanceId}/updates/operations/{operationId}"} # type: ignore - begin_delete_update.metadata = {'url': "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}"} # type: ignore @distributed_trace def list_providers( self, **kwargs: Any ) -> Iterable[str]: - """Get a list of all update providers that have been imported to Device Update for IoT Hub. + """Get a list of all update providers that have been imported to Device Update for + IoT Hub. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either str or the result of cls(response) @@ -1034,7 +788,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1049,12 +803,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -1127,7 +881,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1143,12 +897,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -1229,7 +983,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1247,12 +1001,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -1287,6 +1041,225 @@ def get_next(next_link=None): ) list_versions.metadata = {'url': "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions"} # type: ignore + @distributed_trace + def get_update( + self, + provider: str, + name: str, + version: str, + access_condition: Optional[_models.AccessCondition] = None, + **kwargs: Any + ) -> _models.Update: + """Get a specific update version. + + :param provider: Update provider. Required. + :type provider: str + :param name: Update name. Required. + :type name: str + :param version: Update version. Required. + :type version: str + :param access_condition: Parameter group. Default value is None. + :type access_condition: ~azure.iot.deviceupdate.models.AccessCondition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Update or the result of cls(response) + :rtype: ~azure.iot.deviceupdate.models.Update + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Update] + + _if_none_match = None + if access_condition is not None: + _if_none_match = access_condition.if_none_match + + request = build_get_update_request( + provider=provider, + name=name, + version=version, + instance_id=self._config.instance_id, + if_none_match=_if_none_match, + api_version=api_version, + template_url=self.get_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Update', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_update.metadata = {'url': "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}"} # type: ignore + + + def _delete_update_initial( # pylint: disable=inconsistent-return-statements + self, + provider: str, + name: str, + version: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_update_request( + provider=provider, + name=name, + version=version, + instance_id=self._config.instance_id, + api_version=api_version, + template_url=self._delete_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_update_initial.metadata = {'url': "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}"} # type: ignore + + + @distributed_trace + def begin_delete_update( + self, + provider: str, + name: str, + version: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a specific update version. This is a long-running-operation; use + Operation-Location response header value to check for operation status. + + :param provider: Update provider. Required. + :type provider: str + :param name: Update name. Required. + :type name: str + :param version: Update version. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_update_initial( # type: ignore + provider=provider, + name=name, + version=version, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + + if polling is True: + polling_method = cast(PollingMethod, LROBasePolling( + lro_delay, + lro_options={'final-state-via': 'operation-location'}, + path_format_arguments=path_format_arguments, + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete_update.metadata = {'url': "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}"} # type: ignore + @distributed_trace def list_files( self, @@ -1333,7 +1306,7 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1351,12 +1324,12 @@ def prepare_request(next_link=None): ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.method = "GET" return request @@ -1412,10 +1385,10 @@ def get_file( :param file_id: File identifier. Required. :type file_id: str :param access_condition: Parameter group. Default value is None. - :type access_condition: ~deviceupdateclient.models.AccessCondition + :type access_condition: ~azure.iot.deviceupdate.models.AccessCondition :keyword callable cls: A custom type or function that will be passed the direct response :return: UpdateFile or the result of cls(response) - :rtype: ~deviceupdateclient.models.UpdateFile + :rtype: ~azure.iot.deviceupdate.models.UpdateFile :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1447,7 +1420,7 @@ def get_file( ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1474,154 +1447,44 @@ def get_file( get_file.metadata = {'url': "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files/{fileId}"} # type: ignore - @distributed_trace - def list_operation_statuses( - self, - filter: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.UpdateOperation"]: - """Get a list of all import update operations. Completed operations are kept for 7 days before - auto-deleted. Delete operations are not returned by this API version. - - :param filter: Optional to filter operations by status property. Only one specific filter is - supported: "status eq 'NotStarted' or status eq 'Running'". Default value is None. - :type filter: str - :param top: Specifies a non-negative integer n that limits the number of items returned from a - collection. The service returns the number of available items up to but not greater than the - specified value n. Default value is None. - :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UpdateOperation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~deviceupdateclient.models.UpdateOperation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateOperationsList] - - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_operation_statuses_request( - instance_id=self._config.instance_id, - filter=filter, - top=top, - api_version=api_version, - template_url=self.list_operation_statuses.metadata['url'], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - else: - - request = build_list_operation_statuses_request( - instance_id=self._config.instance_id, - filter=filter, - top=top, - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateOperationsList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_operation_statuses.metadata = {'url': "/deviceUpdate/{instanceId}/updates/operations"} # type: ignore - - @distributed_trace - def get_operation_status( + def _import_update_initial( self, - operation_id: str, - access_condition: Optional[_models.AccessCondition] = None, + update_to_import: Union[List[_models.ImportUpdateInputItem], IO], **kwargs: Any - ) -> _models.UpdateOperation: - """Retrieve operation status. - - :param operation_id: Operation identifier. Required. - :type operation_id: str - :param access_condition: Parameter group. Default value is None. - :type access_condition: ~deviceupdateclient.models.AccessCondition - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UpdateOperation or the result of cls(response) - :rtype: ~deviceupdateclient.models.UpdateOperation - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Optional[_models.Update]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateOperation] + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Update]] - _if_none_match = None - if access_condition is not None: - _if_none_match = access_condition.if_none_match + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_to_import, (IO, bytes)): + _content = update_to_import + else: + _json = self._serialize.body(update_to_import, '[ImportUpdateInputItem]') - request = build_get_operation_status_request( - operation_id=operation_id, + request = build_import_update_request( instance_id=self._config.instance_id, - if_none_match=_if_none_match, api_version=api_version, - template_url=self.get_operation_status.metadata['url'], + content_type=content_type, + json=_json, + content=_content, + template_url=self._import_update_initial.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -1633,20 +1496,170 @@ def get_operation_status( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) + deserialized = None response_headers = {} - response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + if response.status_code == 200: + deserialized = self._deserialize('Update', pipeline_response) - deserialized = self._deserialize('UpdateOperation', pipeline_response) + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_operation_status.metadata = {'url': "/deviceUpdate/{instanceId}/updates/operations/{operationId}"} # type: ignore + _import_update_initial.metadata = {'url': "/deviceUpdate/{instanceId}/updates:import"} # type: ignore + + + @overload + def begin_import_update( + self, + update_to_import: List[_models.ImportUpdateInputItem], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Update]: + """Import new update version. This is a long-running-operation; use + Operation-Location response header value to check for operation status. + + :param update_to_import: The update to be imported (see schema + https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + details). Required. + :type update_to_import: list[~azure.iot.deviceupdate.models.ImportUpdateInputItem] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Update or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.iot.deviceupdate.models.Update] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_import_update( + self, + update_to_import: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Update]: + """Import new update version. This is a long-running-operation; use + Operation-Location response header value to check for operation status. + + :param update_to_import: The update to be imported (see schema + https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + details). Required. + :type update_to_import: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Update or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.iot.deviceupdate.models.Update] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + + @distributed_trace + def begin_import_update( + self, + update_to_import: Union[List[_models.ImportUpdateInputItem], IO], + **kwargs: Any + ) -> LROPoller[_models.Update]: + """Import new update version. This is a long-running-operation; use + Operation-Location response header value to check for operation status. + + :param update_to_import: The update to be imported (see schema + https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + details). Is either a list type or a IO type. Required. + :type update_to_import: list[~azure.iot.deviceupdate.models.ImportUpdateInputItem] or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Update or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.iot.deviceupdate.models.Update] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Update] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._import_update_initial( # type: ignore + update_to_import=update_to_import, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Update', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str'), + } + + if polling is True: + polling_method = cast(PollingMethod, LROBasePolling( + lro_delay, + lro_options={'final-state-via': 'operation-location'}, + path_format_arguments=path_format_arguments, + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_import_update.metadata = {'url': "/deviceUpdate/{instanceId}/updates:import"} # type: ignore From eed843c9256d8895695c3dcb562c0286f2966879 Mon Sep 17 00:00:00 2001 From: Ketki Date: Fri, 26 Jun 2026 15:14:10 -0700 Subject: [PATCH 4/9] feat: Add --download-security parameter to adu device deployment create --- azext_iot/deviceupdate/_help.py | 2 +- azext_iot/deviceupdate/params.py | 2 +- azext_iot/tests/deviceupdate/test_adu_update_int.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/azext_iot/deviceupdate/_help.py b/azext_iot/deviceupdate/_help.py index f522fa556..b3a895c4e 100644 --- a/azext_iot/deviceupdate/_help.py +++ b/azext_iot/deviceupdate/_help.py @@ -590,7 +590,7 @@ def load_deviceupdate_help(): --failed-count 10 --failed-percentage 5 --rollback-update-name {rollback_update_name} --rollback-update-provider {rollback_update_provider} --rollback-update-version {rollback_update_version} - - name: Create a device group deployment using HTTP for update payload downloads. + - name: Create a device group deployment using HTTP (not recommended; compatibility only) for update payload downloads. text: > az iot du device deployment create -n {account_name} -i {instance_name} --group-id {device_group_id} --deployment-id {deployment_id} --update-name {update_name} --update-provider {update_provider} --update-version {update_version} --download-security http diff --git a/azext_iot/deviceupdate/params.py b/azext_iot/deviceupdate/params.py index 6a21b0ddd..167680d84 100644 --- a/azext_iot/deviceupdate/params.py +++ b/azext_iot/deviceupdate/params.py @@ -430,7 +430,7 @@ def load_deviceupdate_arguments(self, _): context.argument( "download_security", options_list=["--download-security"], - help="Protocol used for update payload downloads. Defaults to https for new deployments.", + help="Protocol used for update payload downloads. Defaults to https (TLS). Use http only for compatibility with legacy environments.", arg_type=get_enum_type(ADUDownloadSecurityType), ) diff --git a/azext_iot/tests/deviceupdate/test_adu_update_int.py b/azext_iot/tests/deviceupdate/test_adu_update_int.py index 018647c97..c567c11c4 100644 --- a/azext_iot/tests/deviceupdate/test_adu_update_int.py +++ b/azext_iot/tests/deviceupdate/test_adu_update_int.py @@ -429,6 +429,10 @@ def test_instance_update_lifecycle(provisioned_instances_module: Dict[str, dict] f"iot du device deployment delete -n {account_name} -i {instance_name} " f"--deployment-id {rollback_deployment_id} --group-id {device_group_id} --class-id {device_class_id} -y").success() + # Validate default downloadSecurity behavior for deployments created without --download-security + assert basic_create_deployment["downloadSecurity"] == "https" + assert rollback_create_deployment["downloadSecurity"] == "https" + # Create deployment with explicit --download-security https https_deployment_id = f"deployhttps_{generate_generic_id()}" https_create_deployment = cli.invoke( From cf92a0d8b9ea0fb4891de11e3d83fa118359e302 Mon Sep 17 00:00:00 2001 From: Ketki Date: Fri, 26 Jun 2026 15:41:36 -0700 Subject: [PATCH 5/9] fix: patch IO isinstance check --- .../dataplane/operations/_device_update_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py index 527c6cc0a..9e5f4d5b7 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py +++ b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py @@ -1467,7 +1467,7 @@ def _import_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(update_to_import, (IO, bytes)): + if isinstance(update_to_import, (bytes, bytearray)) or hasattr(update_to_import, "read"): _content = update_to_import else: _json = self._serialize.body(update_to_import, '[ImportUpdateInputItem]') From 8a056434620cab9991d550bca22819d65ddc33eb Mon Sep 17 00:00:00 2001 From: Ketki Date: Fri, 26 Jun 2026 15:49:03 -0700 Subject: [PATCH 6/9] fix: patch autorest generator bugs --- .../dataplane/models/_models_py3.py | 2 +- .../_device_management_operations.py | 92 +++++++++---------- .../operations/_device_update_operations.py | 28 +++--- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py b/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py index 4587a6003..a99e343fa 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py +++ b/azext_iot/sdk/deviceupdate/dataplane/models/_models_py3.py @@ -27,7 +27,7 @@ class AccessCondition(_serialization.Model): """ _attribute_map = { - "if_none_match": {"key": "ifNoneMatch", "type": "str"}, + "if_none_match": {"key": "If-None-Match", "type": "str"}, } def __init__( diff --git a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_management_operations.py b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_management_operations.py index d542183f2..9683df2f6 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_management_operations.py +++ b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_management_operations.py @@ -1527,7 +1527,7 @@ def list_device_classes( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_device_classes_request( instance_id=self._config.instance_id, filter=filter, @@ -1543,7 +1543,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_device_classes_request( instance_id=self._config.instance_id, filter=filter, @@ -1620,7 +1620,7 @@ def get_device_class( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceClass] - + request = build_get_device_class_request( device_class_id=device_class_id, instance_id=self._config.instance_id, @@ -1826,7 +1826,7 @@ def delete_device_class( # pylint: disable=inconsistent-return-statements api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] - + request = build_delete_device_class_request( device_class_id=device_class_id, instance_id=self._config.instance_id, @@ -1887,7 +1887,7 @@ def list_installable_updates_for_device_class( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_installable_updates_for_device_class_request( device_class_id=device_class_id, instance_id=self._config.instance_id, @@ -1903,7 +1903,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_installable_updates_for_device_class_request( device_class_id=device_class_id, instance_id=self._config.instance_id, @@ -1982,7 +1982,7 @@ def list_health_of_devices( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_health_of_devices_request( instance_id=self._config.instance_id, filter=filter, @@ -1998,7 +1998,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_health_of_devices_request( instance_id=self._config.instance_id, filter=filter, @@ -2073,7 +2073,7 @@ def list_log_collections( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_log_collections_request( instance_id=self._config.instance_id, api_version=api_version, @@ -2088,7 +2088,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_log_collections_request( instance_id=self._config.instance_id, api_version=api_version, @@ -2164,7 +2164,7 @@ def get_log_collection( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollection] - + request = build_get_log_collection_request( log_collection_id=log_collection_id, instance_id=self._config.instance_id, @@ -2359,7 +2359,7 @@ def get_log_collection_detailed_status( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.LogCollectionOperationDetailedStatus] - + request = build_get_log_collection_detailed_status_request( log_collection_id=log_collection_id, instance_id=self._config.instance_id, @@ -2427,7 +2427,7 @@ def list_devices( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_devices_request( instance_id=self._config.instance_id, filter=filter, @@ -2443,7 +2443,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_devices_request( instance_id=self._config.instance_id, filter=filter, @@ -2521,7 +2521,7 @@ def get_device( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Device] - + request = build_get_device_request( device_id=device_id, instance_id=self._config.instance_id, @@ -2589,7 +2589,7 @@ def get_device_module( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Device] - + request = build_get_device_module_request( device_id=device_id, module_id=module_id, @@ -2792,7 +2792,7 @@ def list_groups( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_groups_request( instance_id=self._config.instance_id, order_by=order_by, @@ -2808,7 +2808,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_groups_request( instance_id=self._config.instance_id, order_by=order_by, @@ -2885,7 +2885,7 @@ def get_group( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Group] - + request = build_get_group_request( group_id=group_id, instance_id=self._config.instance_id, @@ -2955,7 +2955,7 @@ def delete_group( # pylint: disable=inconsistent-return-statements api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] - + request = build_delete_group_request( group_id=group_id, instance_id=self._config.instance_id, @@ -3019,7 +3019,7 @@ def list_best_updates_for_group( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_best_updates_for_group_request( group_id=group_id, instance_id=self._config.instance_id, @@ -3035,7 +3035,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_best_updates_for_group_request( group_id=group_id, instance_id=self._config.instance_id, @@ -3117,7 +3117,7 @@ def list_deployments_for_group( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_deployments_for_group_request( group_id=group_id, instance_id=self._config.instance_id, @@ -3134,7 +3134,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_deployments_for_group_request( group_id=group_id, instance_id=self._config.instance_id, @@ -3215,7 +3215,7 @@ def get_deployment( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Deployment] - + request = build_get_deployment_request( group_id=group_id, deployment_id=deployment_id, @@ -3423,7 +3423,7 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] - + request = build_delete_deployment_request( group_id=group_id, deployment_id=deployment_id, @@ -3488,7 +3488,7 @@ def get_deployment_status( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DeploymentStatus] - + request = build_get_deployment_status_request( group_id=group_id, deployment_id=deployment_id, @@ -3561,7 +3561,7 @@ def list_device_class_subgroups_for_group( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_device_class_subgroups_for_group_request( group_id=group_id, instance_id=self._config.instance_id, @@ -3578,7 +3578,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_device_class_subgroups_for_group_request( group_id=group_id, instance_id=self._config.instance_id, @@ -3661,7 +3661,7 @@ def get_device_class_subgroup( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceClassSubgroup] - + request = build_get_device_class_subgroup_request( group_id=group_id, device_class_id=device_class_id, @@ -3736,7 +3736,7 @@ def delete_device_class_subgroup( # pylint: disable=inconsistent-return-stateme api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] - + request = build_delete_device_class_subgroup_request( group_id=group_id, device_class_id=device_class_id, @@ -3801,7 +3801,7 @@ def get_best_updates_for_device_class_subgroup( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceClassSubgroupUpdatableDevices] - + request = build_get_best_updates_for_device_class_subgroup_request( group_id=group_id, device_class_id=device_class_id, @@ -3874,7 +3874,7 @@ def list_deployments_for_device_class_subgroup( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_deployments_for_device_class_subgroup_request( group_id=group_id, device_class_id=device_class_id, @@ -3892,7 +3892,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_deployments_for_device_class_subgroup_request( group_id=group_id, device_class_id=device_class_id, @@ -3977,7 +3977,7 @@ def get_deployment_for_device_class_subgroup( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Deployment] - + request = build_get_deployment_for_device_class_subgroup_request( group_id=group_id, device_class_id=device_class_id, @@ -4049,7 +4049,7 @@ def delete_deployment_for_device_class_subgroup( # pylint: disable=inconsistent api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] - + request = build_delete_deployment_for_device_class_subgroup_request( group_id=group_id, device_class_id=device_class_id, @@ -4117,7 +4117,7 @@ def stop_deployment( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Deployment] - + request = build_stop_deployment_request( group_id=group_id, device_class_id=device_class_id, @@ -4189,7 +4189,7 @@ def retry_deployment( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Deployment] - + request = build_retry_deployment_request( group_id=group_id, device_class_id=device_class_id, @@ -4268,7 +4268,7 @@ def list_device_states_for_device_class_subgroup_deployment( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_device_states_for_device_class_subgroup_deployment_request( group_id=group_id, device_class_id=device_class_id, @@ -4287,7 +4287,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_device_states_for_device_class_subgroup_deployment_request( group_id=group_id, device_class_id=device_class_id, @@ -4374,7 +4374,7 @@ def get_device_class_subgroup_deployment_status( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DeviceClassSubgroupDeploymentStatus] - + request = build_get_device_class_subgroup_deployment_status_request( group_id=group_id, device_class_id=device_class_id, @@ -4445,7 +4445,7 @@ def get_device_class_subgroup_update_compliance( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateCompliance] - + request = build_get_device_class_subgroup_update_compliance_request( group_id=group_id, device_class_id=device_class_id, @@ -4512,7 +4512,7 @@ def get_update_compliance_for_group( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateCompliance] - + request = build_get_update_compliance_for_group_request( group_id=group_id, instance_id=self._config.instance_id, @@ -4584,7 +4584,7 @@ def list_operation_statuses( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_operation_statuses_request( instance_id=self._config.instance_id, filter=filter, @@ -4601,7 +4601,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_operation_statuses_request( instance_id=self._config.instance_id, filter=filter, @@ -4751,7 +4751,7 @@ def get_update_compliance( api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.UpdateCompliance] - + request = build_get_update_compliance_request( instance_id=self._config.instance_id, api_version=api_version, diff --git a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py index 9e5f4d5b7..2db4bc009 100644 --- a/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py +++ b/azext_iot/sdk/deviceupdate/dataplane/operations/_device_update_operations.py @@ -506,7 +506,7 @@ def list_updates( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_updates_request( instance_id=self._config.instance_id, search=search, @@ -523,7 +523,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_updates_request( instance_id=self._config.instance_id, search=search, @@ -610,7 +610,7 @@ def list_operation_statuses( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_operation_statuses_request( instance_id=self._config.instance_id, filter=filter, @@ -627,7 +627,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_operation_statuses_request( instance_id=self._config.instance_id, filter=filter, @@ -778,7 +778,7 @@ def list_providers( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_providers_request( instance_id=self._config.instance_id, api_version=api_version, @@ -793,7 +793,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_providers_request( instance_id=self._config.instance_id, api_version=api_version, @@ -870,7 +870,7 @@ def list_names( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_names_request( provider=provider, instance_id=self._config.instance_id, @@ -886,7 +886,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_names_request( provider=provider, instance_id=self._config.instance_id, @@ -970,7 +970,7 @@ def list_versions( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_versions_request( provider=provider, name=name, @@ -988,7 +988,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_versions_request( provider=provider, name=name, @@ -1138,7 +1138,7 @@ def _delete_update_initial( # pylint: disable=inconsistent-return-statements api_version = kwargs.pop('api_version', _params.pop('api-version', self._config.api_version)) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] - + request = build_delete_update_request( provider=provider, name=name, @@ -1293,7 +1293,7 @@ def list_files( error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: - + request = build_list_files_request( provider=provider, name=name, @@ -1311,7 +1311,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore else: - + request = build_list_files_request( provider=provider, name=name, @@ -1508,7 +1508,7 @@ def _import_update_initial( if response.status_code == 202: response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) - + if cls: return cls(pipeline_response, deserialized, response_headers) From abc48ad894a530736757f64428a6edda8f63fea2 Mon Sep 17 00:00:00 2001 From: Ketki Date: Mon, 29 Jun 2026 10:55:47 -0700 Subject: [PATCH 7/9] Updated the help text to be more precise. --- azext_iot/deviceupdate/params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azext_iot/deviceupdate/params.py b/azext_iot/deviceupdate/params.py index 167680d84..4def980c0 100644 --- a/azext_iot/deviceupdate/params.py +++ b/azext_iot/deviceupdate/params.py @@ -430,7 +430,7 @@ def load_deviceupdate_arguments(self, _): context.argument( "download_security", options_list=["--download-security"], - help="Protocol used for update payload downloads. Defaults to https (TLS). Use http only for compatibility with legacy environments.", + help="Protocol used for update payload downloads. Defaults to https (TLS). Use http only when the target environment does not support TLS.", arg_type=get_enum_type(ADUDownloadSecurityType), ) From d55aeaec4192929c0f208ae62fd674c2d3917679 Mon Sep 17 00:00:00 2001 From: Ketki Date: Mon, 29 Jun 2026 13:14:03 -0700 Subject: [PATCH 8/9] Fix mismatched format --- azext_iot/deviceupdate/commands_device.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azext_iot/deviceupdate/commands_device.py b/azext_iot/deviceupdate/commands_device.py index 33f68fee7..1485af455 100644 --- a/azext_iot/deviceupdate/commands_device.py +++ b/azext_iot/deviceupdate/commands_device.py @@ -29,8 +29,7 @@ def import_devices( ) try: - # @digimaun - There is a mismatch between spec and implementation expectation. - return data_manager.data_client.device_management.begin_import_devices(import_type={"importType": import_type}) + return data_manager.data_client.device_management.begin_import_devices(import_type=import_type) except AzureError as e: handle_service_exception(e) From 0a7690170f7b844cba6662dae7e54212b4e4915e Mon Sep 17 00:00:00 2001 From: Ketki Date: Mon, 29 Jun 2026 13:37:23 -0700 Subject: [PATCH 9/9] fix: E501 line too long in params help text --- azext_iot/deviceupdate/params.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azext_iot/deviceupdate/params.py b/azext_iot/deviceupdate/params.py index 4def980c0..ff44fd81b 100644 --- a/azext_iot/deviceupdate/params.py +++ b/azext_iot/deviceupdate/params.py @@ -430,7 +430,8 @@ def load_deviceupdate_arguments(self, _): context.argument( "download_security", options_list=["--download-security"], - help="Protocol used for update payload downloads. Defaults to https (TLS). Use http only when the target environment does not support TLS.", + help="Protocol used for update payload downloads. Defaults to https (TLS). " + "Use http only when the target environment does not support TLS.", arg_type=get_enum_type(ADUDownloadSecurityType), )