From 6129b8f540df1745047fc2f8fe9d6abd4994d6f1 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 11 May 2021 08:53:34 +0000 Subject: [PATCH 1/4] CodeGen from PR 14349 in Azure/azure-rest-api-specs iothub readme config (#14349) --- sdk/iothub/azure-mgmt-iothub/MANIFEST.in | 1 + sdk/iothub/azure-mgmt-iothub/_meta.json | 8 + .../azure/mgmt/iothub/_configuration.py | 7 +- .../azure/mgmt/iothub/_iot_hub_client.py | 97 +- .../azure/mgmt/iothub/aio/_configuration.py | 9 +- .../azure/mgmt/iothub/aio/_iot_hub_client.py | 99 +- .../azure/mgmt/iothub/models.py | 2 +- .../iothub/v2016_02_03/_iot_hub_client.py | 21 +- .../mgmt/iothub/v2016_02_03/_metadata.json | 62 +- .../azure/mgmt/iothub/v2016_02_03/_version.py | 2 +- .../iothub/v2016_02_03/aio/_iot_hub_client.py | 20 +- .../_iot_hub_resource_operations.py | 121 +- .../mgmt/iothub/v2016_02_03/models/_models.py | 88 +- .../iothub/v2016_02_03/models/_models_py3.py | 88 +- .../_iot_hub_resource_operations.py | 121 +- .../iothub/v2017_01_19/_iot_hub_client.py | 21 +- .../mgmt/iothub/v2017_01_19/_metadata.json | 62 +- .../azure/mgmt/iothub/v2017_01_19/_version.py | 2 +- .../iothub/v2017_01_19/aio/_iot_hub_client.py | 20 +- .../_iot_hub_resource_operations.py | 121 +- .../mgmt/iothub/v2017_01_19/models/_models.py | 106 +- .../iothub/v2017_01_19/models/_models_py3.py | 106 +- .../_iot_hub_resource_operations.py | 121 +- .../iothub/v2017_07_01/_iot_hub_client.py | 25 +- .../mgmt/iothub/v2017_07_01/_metadata.json | 62 +- .../azure/mgmt/iothub/v2017_07_01/_version.py | 2 +- .../iothub/v2017_07_01/aio/_iot_hub_client.py | 24 +- .../operations/_certificates_operations.py | 28 +- .../_iot_hub_resource_operations.py | 121 +- .../v2017_07_01/aio/operations/_operations.py | 6 +- .../mgmt/iothub/v2017_07_01/models/_models.py | 119 +- .../iothub/v2017_07_01/models/_models_py3.py | 119 +- .../operations/_certificates_operations.py | 28 +- .../_iot_hub_resource_operations.py | 121 +- .../v2017_07_01/operations/_operations.py | 6 +- .../iothub/v2018_01_22/_iot_hub_client.py | 25 +- .../mgmt/iothub/v2018_01_22/_metadata.json | 62 +- .../azure/mgmt/iothub/v2018_01_22/_version.py | 2 +- .../iothub/v2018_01_22/aio/_iot_hub_client.py | 24 +- .../operations/_certificates_operations.py | 28 +- .../_iot_hub_resource_operations.py | 129 +- .../v2018_01_22/aio/operations/_operations.py | 6 +- .../mgmt/iothub/v2018_01_22/models/_models.py | 121 +- .../iothub/v2018_01_22/models/_models_py3.py | 121 +- .../operations/_certificates_operations.py | 28 +- .../_iot_hub_resource_operations.py | 129 +- .../v2018_01_22/operations/_operations.py | 6 +- .../iothub/v2018_04_01/_iot_hub_client.py | 27 +- .../mgmt/iothub/v2018_04_01/_metadata.json | 62 +- .../azure/mgmt/iothub/v2018_04_01/_version.py | 2 +- .../iothub/v2018_04_01/aio/_iot_hub_client.py | 26 +- .../operations/_certificates_operations.py | 28 +- .../_iot_hub_resource_operations.py | 145 +- .../v2018_04_01/aio/operations/_operations.py | 6 +- .../_resource_provider_common_operations.py | 6 +- .../mgmt/iothub/v2018_04_01/models/_models.py | 173 +- .../iothub/v2018_04_01/models/_models_py3.py | 179 +- .../operations/_certificates_operations.py | 28 +- .../_iot_hub_resource_operations.py | 145 +- .../v2018_04_01/operations/_operations.py | 6 +- .../_resource_provider_common_operations.py | 6 +- .../iothub/v2019_03_22/_iot_hub_client.py | 29 +- .../mgmt/iothub/v2019_03_22/_metadata.json | 62 +- .../azure/mgmt/iothub/v2019_03_22/_version.py | 2 +- .../iothub/v2019_03_22/aio/_iot_hub_client.py | 28 +- .../operations/_certificates_operations.py | 28 +- .../aio/operations/_iot_hub_operations.py | 10 +- .../_iot_hub_resource_operations.py | 145 +- .../v2019_03_22/aio/operations/_operations.py | 6 +- .../_resource_provider_common_operations.py | 6 +- .../mgmt/iothub/v2019_03_22/models/_models.py | 176 +- .../iothub/v2019_03_22/models/_models_py3.py | 182 +- .../operations/_certificates_operations.py | 28 +- .../operations/_iot_hub_operations.py | 10 +- .../_iot_hub_resource_operations.py | 145 +- .../v2019_03_22/operations/_operations.py | 6 +- .../_resource_provider_common_operations.py | 6 +- .../iothub/v2019_07_01_preview/__init__.py | 19 + .../v2019_07_01_preview/_configuration.py | 71 + .../v2019_07_01_preview/_iot_hub_client.py | 109 + .../iothub/v2019_07_01_preview/_metadata.json | 107 + .../iothub/v2019_07_01_preview/_version.py | 9 + .../v2019_07_01_preview/aio/__init__.py | 10 + .../v2019_07_01_preview/aio/_configuration.py | 67 + .../aio/_iot_hub_client.py | 102 + .../aio/operations/__init__.py | 21 + .../operations/_certificates_operations.py | 464 +++ .../aio/operations/_iot_hub_operations.py | 164 + .../_iot_hub_resource_operations.py | 1849 +++++++++ .../aio/operations/_operations.py | 105 + .../_resource_provider_common_operations.py | 94 + .../v2019_07_01_preview/models/__init__.py | 250 ++ .../models/_iot_hub_client_enums.py | 181 + .../v2019_07_01_preview/models/_models.py | 2413 ++++++++++++ .../v2019_07_01_preview/models/_models_py3.py | 2625 +++++++++++++ .../operations/__init__.py | 21 + .../operations/_certificates_operations.py | 474 +++ .../operations/_iot_hub_operations.py | 170 + .../_iot_hub_resource_operations.py | 1879 +++++++++ .../operations/_operations.py | 110 + .../_resource_provider_common_operations.py | 99 + .../mgmt/iothub/v2019_07_01_preview/py.typed | 1 + .../iothub/v2019_11_04/_iot_hub_client.py | 29 +- .../mgmt/iothub/v2019_11_04/_metadata.json | 62 +- .../azure/mgmt/iothub/v2019_11_04/_version.py | 2 +- .../iothub/v2019_11_04/aio/_iot_hub_client.py | 28 +- .../operations/_certificates_operations.py | 28 +- .../aio/operations/_iot_hub_operations.py | 10 +- .../_iot_hub_resource_operations.py | 145 +- .../v2019_11_04/aio/operations/_operations.py | 6 +- .../_resource_provider_common_operations.py | 6 +- .../mgmt/iothub/v2019_11_04/models/_models.py | 178 +- .../iothub/v2019_11_04/models/_models_py3.py | 184 +- .../operations/_certificates_operations.py | 28 +- .../operations/_iot_hub_operations.py | 10 +- .../_iot_hub_resource_operations.py | 145 +- .../v2019_11_04/operations/_operations.py | 6 +- .../_resource_provider_common_operations.py | 6 +- .../iothub/v2020_03_01/_iot_hub_client.py | 33 +- .../mgmt/iothub/v2020_03_01/_metadata.json | 62 +- .../azure/mgmt/iothub/v2020_03_01/_version.py | 2 +- .../iothub/v2020_03_01/aio/_iot_hub_client.py | 32 +- .../operations/_certificates_operations.py | 28 +- .../aio/operations/_iot_hub_operations.py | 10 +- .../_iot_hub_resource_operations.py | 145 +- .../v2020_03_01/aio/operations/_operations.py | 6 +- ...private_endpoint_connections_operations.py | 28 +- .../_private_link_resources_operations.py | 10 +- .../_resource_provider_common_operations.py | 6 +- .../mgmt/iothub/v2020_03_01/models/_models.py | 213 +- .../iothub/v2020_03_01/models/_models_py3.py | 219 +- .../operations/_certificates_operations.py | 28 +- .../operations/_iot_hub_operations.py | 10 +- .../_iot_hub_resource_operations.py | 145 +- .../v2020_03_01/operations/_operations.py | 6 +- ...private_endpoint_connections_operations.py | 28 +- .../_private_link_resources_operations.py | 10 +- .../_resource_provider_common_operations.py | 6 +- .../iothub/v2021_03_03_preview/__init__.py | 19 + .../v2021_03_03_preview/_configuration.py | 71 + .../v2021_03_03_preview/_iot_hub_client.py | 119 + .../iothub/v2021_03_03_preview/_metadata.json | 109 + .../iothub/v2021_03_03_preview/_version.py | 9 + .../v2021_03_03_preview/aio/__init__.py | 10 + .../v2021_03_03_preview/aio/_configuration.py | 67 + .../aio/_iot_hub_client.py | 112 + .../aio/operations/__init__.py | 25 + .../operations/_certificates_operations.py | 464 +++ .../aio/operations/_iot_hub_operations.py | 167 + .../_iot_hub_resource_operations.py | 1855 +++++++++ .../aio/operations/_operations.py | 105 + ...private_endpoint_connections_operations.py | 436 +++ .../_private_link_resources_operations.py | 167 + .../_resource_provider_common_operations.py | 94 + .../v2021_03_03_preview/models/__init__.py | 310 ++ .../models/_iot_hub_client_enums.py | 232 ++ .../v2021_03_03_preview/models/_models.py | 3059 +++++++++++++++ .../v2021_03_03_preview/models/_models_py3.py | 3349 +++++++++++++++++ .../operations/__init__.py | 25 + .../operations/_certificates_operations.py | 474 +++ .../operations/_iot_hub_operations.py | 173 + .../_iot_hub_resource_operations.py | 1885 ++++++++++ .../operations/_operations.py | 110 + ...private_endpoint_connections_operations.py | 446 +++ .../_private_link_resources_operations.py | 173 + .../_resource_provider_common_operations.py | 99 + .../mgmt/iothub/v2021_03_03_preview/py.typed | 1 + .../azure/mgmt/iothub/v2021_03_31/__init__.py | 19 + .../mgmt/iothub/v2021_03_31/_configuration.py | 71 + .../iothub/v2021_03_31/_iot_hub_client.py | 119 + .../mgmt/iothub/v2021_03_31/_metadata.json | 109 + .../azure/mgmt/iothub/v2021_03_31/_version.py | 9 + .../mgmt/iothub/v2021_03_31/aio/__init__.py | 10 + .../iothub/v2021_03_31/aio/_configuration.py | 67 + .../iothub/v2021_03_31/aio/_iot_hub_client.py | 112 + .../v2021_03_31/aio/operations/__init__.py | 25 + .../operations/_certificates_operations.py | 464 +++ .../aio/operations/_iot_hub_operations.py | 167 + .../_iot_hub_resource_operations.py | 1857 +++++++++ .../v2021_03_31/aio/operations/_operations.py | 105 + ...private_endpoint_connections_operations.py | 436 +++ .../_private_link_resources_operations.py | 167 + .../_resource_provider_common_operations.py | 94 + .../iothub/v2021_03_31/models/__init__.py | 301 ++ .../models/_iot_hub_client_enums.py | 231 ++ .../mgmt/iothub/v2021_03_31/models/_models.py | 2997 +++++++++++++++ .../iothub/v2021_03_31/models/_models_py3.py | 3281 ++++++++++++++++ .../iothub/v2021_03_31/operations/__init__.py | 25 + .../operations/_certificates_operations.py | 474 +++ .../operations/_iot_hub_operations.py | 173 + .../_iot_hub_resource_operations.py | 1887 ++++++++++ .../v2021_03_31/operations/_operations.py | 110 + ...private_endpoint_connections_operations.py | 446 +++ .../_private_link_resources_operations.py | 173 + .../_resource_provider_common_operations.py | 99 + .../azure/mgmt/iothub/v2021_03_31/py.typed | 1 + 196 files changed, 43188 insertions(+), 2675 deletions(-) create mode 100644 sdk/iothub/azure-mgmt-iothub/_meta.json create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_iot_hub_client_enums.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/py.typed create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_iot_hub_client_enums.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/py.typed create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_iot_hub_client_enums.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/py.typed diff --git a/sdk/iothub/azure-mgmt-iothub/MANIFEST.in b/sdk/iothub/azure-mgmt-iothub/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/iothub/azure-mgmt-iothub/MANIFEST.in +++ b/sdk/iothub/azure-mgmt-iothub/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/iothub/azure-mgmt-iothub/_meta.json b/sdk/iothub/azure-mgmt-iothub/_meta.json new file mode 100644 index 000000000000..2426a3f90ba0 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.3.0", + "use": "@autorest/python@5.6.6", + "commit": "495e6fd12856cf3d909125b1119c83a3a9f18a8a", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/iothub/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.6 --version=3.3.0", + "readme": "specification/iothub/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_configuration.py index 326ead794610..7a56f8497059 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,6 +16,11 @@ from ._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential class IotHubClientConfiguration(Configuration): """Configuration for IotHubClient. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py index 7e6280024ada..5b416c4da857 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py @@ -9,13 +9,22 @@ # regenerated. # -------------------------------------------------------------------------- -from azure.mgmt.core import ARMPipelineClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING +from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + from ._configuration import IotHubClientConfiguration +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -38,15 +47,16 @@ class IotHubClient(MultiApiClientMixin, _SDKClient): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param str api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2020-03-01' + DEFAULT_API_VERSION = '2021-03-31' _PROFILE_TAG = "azure.mgmt.iothub.IotHubClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -59,9 +69,9 @@ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, + api_version=None, # type: Optional[str] + base_url=None, # type: Optional[str] + profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): if not base_url: @@ -87,8 +97,11 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2018-01-22: :mod:`v2018_01_22.models` * 2018-04-01: :mod:`v2018_04_01.models` * 2019-03-22: :mod:`v2019_03_22.models` + * 2019-07-01-preview: :mod:`v2019_07_01_preview.models` * 2019-11-04: :mod:`v2019_11_04.models` * 2020-03-01: :mod:`v2020_03_01.models` + * 2021-03-03-preview: :mod:`v2021_03_03_preview.models` + * 2021-03-31: :mod:`v2021_03_31.models` """ if api_version == '2016-02-03': from .v2016_02_03 import models @@ -108,12 +121,21 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-03-22': from .v2019_03_22 import models return models + elif api_version == '2019-07-01-preview': + from .v2019_07_01_preview import models + return models elif api_version == '2019-11-04': from .v2019_11_04 import models return models elif api_version == '2020-03-01': from .v2020_03_01 import models return models + elif api_version == '2021-03-03-preview': + from .v2021_03_03_preview import models + return models + elif api_version == '2021-03-31': + from .v2021_03_31 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -124,8 +146,11 @@ def certificates(self): * 2018-01-22: :class:`CertificatesOperations` * 2018-04-01: :class:`CertificatesOperations` * 2019-03-22: :class:`CertificatesOperations` + * 2019-07-01-preview: :class:`CertificatesOperations` * 2019-11-04: :class:`CertificatesOperations` * 2020-03-01: :class:`CertificatesOperations` + * 2021-03-03-preview: :class:`CertificatesOperations` + * 2021-03-31: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2017-07-01': @@ -136,10 +161,16 @@ def certificates(self): from .v2018_04_01.operations import CertificatesOperations as OperationClass elif api_version == '2019-03-22': from .v2019_03_22.operations import CertificatesOperations as OperationClass + elif api_version == '2019-07-01-preview': + from .v2019_07_01_preview.operations import CertificatesOperations as OperationClass elif api_version == '2019-11-04': from .v2019_11_04.operations import CertificatesOperations as OperationClass elif api_version == '2020-03-01': from .v2020_03_01.operations import CertificatesOperations as OperationClass + elif api_version == '2021-03-03-preview': + from .v2021_03_03_preview.operations import CertificatesOperations as OperationClass + elif api_version == '2021-03-31': + from .v2021_03_31.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -149,16 +180,25 @@ def iot_hub(self): """Instance depends on the API version: * 2019-03-22: :class:`IotHubOperations` + * 2019-07-01-preview: :class:`IotHubOperations` * 2019-11-04: :class:`IotHubOperations` * 2020-03-01: :class:`IotHubOperations` + * 2021-03-03-preview: :class:`IotHubOperations` + * 2021-03-31: :class:`IotHubOperations` """ api_version = self._get_api_version('iot_hub') if api_version == '2019-03-22': from .v2019_03_22.operations import IotHubOperations as OperationClass + elif api_version == '2019-07-01-preview': + from .v2019_07_01_preview.operations import IotHubOperations as OperationClass elif api_version == '2019-11-04': from .v2019_11_04.operations import IotHubOperations as OperationClass elif api_version == '2020-03-01': from .v2020_03_01.operations import IotHubOperations as OperationClass + elif api_version == '2021-03-03-preview': + from .v2021_03_03_preview.operations import IotHubOperations as OperationClass + elif api_version == '2021-03-31': + from .v2021_03_31.operations import IotHubOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -173,8 +213,11 @@ def iot_hub_resource(self): * 2018-01-22: :class:`IotHubResourceOperations` * 2018-04-01: :class:`IotHubResourceOperations` * 2019-03-22: :class:`IotHubResourceOperations` + * 2019-07-01-preview: :class:`IotHubResourceOperations` * 2019-11-04: :class:`IotHubResourceOperations` * 2020-03-01: :class:`IotHubResourceOperations` + * 2021-03-03-preview: :class:`IotHubResourceOperations` + * 2021-03-31: :class:`IotHubResourceOperations` """ api_version = self._get_api_version('iot_hub_resource') if api_version == '2016-02-03': @@ -189,10 +232,16 @@ def iot_hub_resource(self): from .v2018_04_01.operations import IotHubResourceOperations as OperationClass elif api_version == '2019-03-22': from .v2019_03_22.operations import IotHubResourceOperations as OperationClass + elif api_version == '2019-07-01-preview': + from .v2019_07_01_preview.operations import IotHubResourceOperations as OperationClass elif api_version == '2019-11-04': from .v2019_11_04.operations import IotHubResourceOperations as OperationClass elif api_version == '2020-03-01': from .v2020_03_01.operations import IotHubResourceOperations as OperationClass + elif api_version == '2021-03-03-preview': + from .v2021_03_03_preview.operations import IotHubResourceOperations as OperationClass + elif api_version == '2021-03-31': + from .v2021_03_31.operations import IotHubResourceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub_resource'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -205,8 +254,11 @@ def operations(self): * 2018-01-22: :class:`Operations` * 2018-04-01: :class:`Operations` * 2019-03-22: :class:`Operations` + * 2019-07-01-preview: :class:`Operations` * 2019-11-04: :class:`Operations` * 2020-03-01: :class:`Operations` + * 2021-03-03-preview: :class:`Operations` + * 2021-03-31: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-07-01': @@ -217,10 +269,16 @@ def operations(self): from .v2018_04_01.operations import Operations as OperationClass elif api_version == '2019-03-22': from .v2019_03_22.operations import Operations as OperationClass + elif api_version == '2019-07-01-preview': + from .v2019_07_01_preview.operations import Operations as OperationClass elif api_version == '2019-11-04': from .v2019_11_04.operations import Operations as OperationClass elif api_version == '2020-03-01': from .v2020_03_01.operations import Operations as OperationClass + elif api_version == '2021-03-03-preview': + from .v2021_03_03_preview.operations import Operations as OperationClass + elif api_version == '2021-03-31': + from .v2021_03_31.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -230,10 +288,16 @@ def private_endpoint_connections(self): """Instance depends on the API version: * 2020-03-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-03-03-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-03-31: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-03-01': from .v2020_03_01.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-03-03-preview': + from .v2021_03_03_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-03-31': + from .v2021_03_31.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -243,10 +307,16 @@ def private_link_resources(self): """Instance depends on the API version: * 2020-03-01: :class:`PrivateLinkResourcesOperations` + * 2021-03-03-preview: :class:`PrivateLinkResourcesOperations` + * 2021-03-31: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-03-01': from .v2020_03_01.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-03-03-preview': + from .v2021_03_03_preview.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-03-31': + from .v2021_03_31.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -257,18 +327,27 @@ def resource_provider_common(self): * 2018-04-01: :class:`ResourceProviderCommonOperations` * 2019-03-22: :class:`ResourceProviderCommonOperations` + * 2019-07-01-preview: :class:`ResourceProviderCommonOperations` * 2019-11-04: :class:`ResourceProviderCommonOperations` * 2020-03-01: :class:`ResourceProviderCommonOperations` + * 2021-03-03-preview: :class:`ResourceProviderCommonOperations` + * 2021-03-31: :class:`ResourceProviderCommonOperations` """ api_version = self._get_api_version('resource_provider_common') if api_version == '2018-04-01': from .v2018_04_01.operations import ResourceProviderCommonOperations as OperationClass elif api_version == '2019-03-22': from .v2019_03_22.operations import ResourceProviderCommonOperations as OperationClass + elif api_version == '2019-07-01-preview': + from .v2019_07_01_preview.operations import ResourceProviderCommonOperations as OperationClass elif api_version == '2019-11-04': from .v2019_11_04.operations import ResourceProviderCommonOperations as OperationClass elif api_version == '2020-03-01': from .v2020_03_01.operations import ResourceProviderCommonOperations as OperationClass + elif api_version == '2021-03-03-preview': + from .v2021_03_03_preview.operations import ResourceProviderCommonOperations as OperationClass + elif api_version == '2021-03-31': + from .v2021_03_31.operations import ResourceProviderCommonOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_provider_common'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_configuration.py index 2cedaf1707ac..bcb59dbd5672 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_configuration.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,6 +16,9 @@ from .._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential class IotHubClientConfiguration(Configuration): """Configuration for IotHubClient. @@ -31,8 +34,8 @@ class IotHubClientConfiguration(Configuration): def __init__( self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str + credential: "AsyncTokenCredential", + subscription_id: str, **kwargs # type: Any ) -> None: if credential is None: diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py index 512cb8b0e4b2..08328758a18d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py @@ -9,13 +9,20 @@ # regenerated. # -------------------------------------------------------------------------- -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Serializer, Deserializer +from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + from ._configuration import IotHubClientConfiguration +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -38,15 +45,16 @@ class IotHubClient(MultiApiClientMixin, _SDKClient): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param str api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2020-03-01' + DEFAULT_API_VERSION = '2021-03-31' _PROFILE_TAG = "azure.mgmt.iothub.IotHubClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -57,11 +65,11 @@ class IotHubClient(MultiApiClientMixin, _SDKClient): def __init__( self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, + credential: "AsyncTokenCredential", + subscription_id: str, + api_version: Optional[str] = None, + base_url: Optional[str] = None, + profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: if not base_url: @@ -87,8 +95,11 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2018-01-22: :mod:`v2018_01_22.models` * 2018-04-01: :mod:`v2018_04_01.models` * 2019-03-22: :mod:`v2019_03_22.models` + * 2019-07-01-preview: :mod:`v2019_07_01_preview.models` * 2019-11-04: :mod:`v2019_11_04.models` * 2020-03-01: :mod:`v2020_03_01.models` + * 2021-03-03-preview: :mod:`v2021_03_03_preview.models` + * 2021-03-31: :mod:`v2021_03_31.models` """ if api_version == '2016-02-03': from ..v2016_02_03 import models @@ -108,12 +119,21 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-03-22': from ..v2019_03_22 import models return models + elif api_version == '2019-07-01-preview': + from ..v2019_07_01_preview import models + return models elif api_version == '2019-11-04': from ..v2019_11_04 import models return models elif api_version == '2020-03-01': from ..v2020_03_01 import models return models + elif api_version == '2021-03-03-preview': + from ..v2021_03_03_preview import models + return models + elif api_version == '2021-03-31': + from ..v2021_03_31 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -124,8 +144,11 @@ def certificates(self): * 2018-01-22: :class:`CertificatesOperations` * 2018-04-01: :class:`CertificatesOperations` * 2019-03-22: :class:`CertificatesOperations` + * 2019-07-01-preview: :class:`CertificatesOperations` * 2019-11-04: :class:`CertificatesOperations` * 2020-03-01: :class:`CertificatesOperations` + * 2021-03-03-preview: :class:`CertificatesOperations` + * 2021-03-31: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2017-07-01': @@ -136,10 +159,16 @@ def certificates(self): from ..v2018_04_01.aio.operations import CertificatesOperations as OperationClass elif api_version == '2019-03-22': from ..v2019_03_22.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2019-07-01-preview': + from ..v2019_07_01_preview.aio.operations import CertificatesOperations as OperationClass elif api_version == '2019-11-04': from ..v2019_11_04.aio.operations import CertificatesOperations as OperationClass elif api_version == '2020-03-01': from ..v2020_03_01.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2021-03-03-preview': + from ..v2021_03_03_preview.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2021-03-31': + from ..v2021_03_31.aio.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -149,16 +178,25 @@ def iot_hub(self): """Instance depends on the API version: * 2019-03-22: :class:`IotHubOperations` + * 2019-07-01-preview: :class:`IotHubOperations` * 2019-11-04: :class:`IotHubOperations` * 2020-03-01: :class:`IotHubOperations` + * 2021-03-03-preview: :class:`IotHubOperations` + * 2021-03-31: :class:`IotHubOperations` """ api_version = self._get_api_version('iot_hub') if api_version == '2019-03-22': from ..v2019_03_22.aio.operations import IotHubOperations as OperationClass + elif api_version == '2019-07-01-preview': + from ..v2019_07_01_preview.aio.operations import IotHubOperations as OperationClass elif api_version == '2019-11-04': from ..v2019_11_04.aio.operations import IotHubOperations as OperationClass elif api_version == '2020-03-01': from ..v2020_03_01.aio.operations import IotHubOperations as OperationClass + elif api_version == '2021-03-03-preview': + from ..v2021_03_03_preview.aio.operations import IotHubOperations as OperationClass + elif api_version == '2021-03-31': + from ..v2021_03_31.aio.operations import IotHubOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -173,8 +211,11 @@ def iot_hub_resource(self): * 2018-01-22: :class:`IotHubResourceOperations` * 2018-04-01: :class:`IotHubResourceOperations` * 2019-03-22: :class:`IotHubResourceOperations` + * 2019-07-01-preview: :class:`IotHubResourceOperations` * 2019-11-04: :class:`IotHubResourceOperations` * 2020-03-01: :class:`IotHubResourceOperations` + * 2021-03-03-preview: :class:`IotHubResourceOperations` + * 2021-03-31: :class:`IotHubResourceOperations` """ api_version = self._get_api_version('iot_hub_resource') if api_version == '2016-02-03': @@ -189,10 +230,16 @@ def iot_hub_resource(self): from ..v2018_04_01.aio.operations import IotHubResourceOperations as OperationClass elif api_version == '2019-03-22': from ..v2019_03_22.aio.operations import IotHubResourceOperations as OperationClass + elif api_version == '2019-07-01-preview': + from ..v2019_07_01_preview.aio.operations import IotHubResourceOperations as OperationClass elif api_version == '2019-11-04': from ..v2019_11_04.aio.operations import IotHubResourceOperations as OperationClass elif api_version == '2020-03-01': from ..v2020_03_01.aio.operations import IotHubResourceOperations as OperationClass + elif api_version == '2021-03-03-preview': + from ..v2021_03_03_preview.aio.operations import IotHubResourceOperations as OperationClass + elif api_version == '2021-03-31': + from ..v2021_03_31.aio.operations import IotHubResourceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub_resource'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -205,8 +252,11 @@ def operations(self): * 2018-01-22: :class:`Operations` * 2018-04-01: :class:`Operations` * 2019-03-22: :class:`Operations` + * 2019-07-01-preview: :class:`Operations` * 2019-11-04: :class:`Operations` * 2020-03-01: :class:`Operations` + * 2021-03-03-preview: :class:`Operations` + * 2021-03-31: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-07-01': @@ -217,10 +267,16 @@ def operations(self): from ..v2018_04_01.aio.operations import Operations as OperationClass elif api_version == '2019-03-22': from ..v2019_03_22.aio.operations import Operations as OperationClass + elif api_version == '2019-07-01-preview': + from ..v2019_07_01_preview.aio.operations import Operations as OperationClass elif api_version == '2019-11-04': from ..v2019_11_04.aio.operations import Operations as OperationClass elif api_version == '2020-03-01': from ..v2020_03_01.aio.operations import Operations as OperationClass + elif api_version == '2021-03-03-preview': + from ..v2021_03_03_preview.aio.operations import Operations as OperationClass + elif api_version == '2021-03-31': + from ..v2021_03_31.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -230,10 +286,16 @@ def private_endpoint_connections(self): """Instance depends on the API version: * 2020-03-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-03-03-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-03-31: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-03-01': from ..v2020_03_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-03-03-preview': + from ..v2021_03_03_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-03-31': + from ..v2021_03_31.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -243,10 +305,16 @@ def private_link_resources(self): """Instance depends on the API version: * 2020-03-01: :class:`PrivateLinkResourcesOperations` + * 2021-03-03-preview: :class:`PrivateLinkResourcesOperations` + * 2021-03-31: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-03-01': from ..v2020_03_01.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-03-03-preview': + from ..v2021_03_03_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-03-31': + from ..v2021_03_31.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -257,18 +325,27 @@ def resource_provider_common(self): * 2018-04-01: :class:`ResourceProviderCommonOperations` * 2019-03-22: :class:`ResourceProviderCommonOperations` + * 2019-07-01-preview: :class:`ResourceProviderCommonOperations` * 2019-11-04: :class:`ResourceProviderCommonOperations` * 2020-03-01: :class:`ResourceProviderCommonOperations` + * 2021-03-03-preview: :class:`ResourceProviderCommonOperations` + * 2021-03-31: :class:`ResourceProviderCommonOperations` """ api_version = self._get_api_version('resource_provider_common') if api_version == '2018-04-01': from ..v2018_04_01.aio.operations import ResourceProviderCommonOperations as OperationClass elif api_version == '2019-03-22': from ..v2019_03_22.aio.operations import ResourceProviderCommonOperations as OperationClass + elif api_version == '2019-07-01-preview': + from ..v2019_07_01_preview.aio.operations import ResourceProviderCommonOperations as OperationClass elif api_version == '2019-11-04': from ..v2019_11_04.aio.operations import ResourceProviderCommonOperations as OperationClass elif api_version == '2020-03-01': from ..v2020_03_01.aio.operations import ResourceProviderCommonOperations as OperationClass + elif api_version == '2021-03-03-preview': + from ..v2021_03_03_preview.aio.operations import ResourceProviderCommonOperations as OperationClass + elif api_version == '2021-03-31': + from ..v2021_03_31.aio.operations import ResourceProviderCommonOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_provider_common'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/models.py index c4144f2b448c..741ec6871f50 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2020_03_01.models import * +from .v2021_03_31.models import * diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_iot_hub_client.py index 2db7b32744cf..7c66155ebf72 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_iot_hub_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import IotHubClientConfiguration from .operations import IotHubResourceOperations @@ -26,7 +27,7 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2016_02_03.operations.IotHubResourceOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. @@ -56,6 +57,24 @@ def __init__( self.iot_hub_resource = IotHubResourceOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_metadata.json index a0830e645f49..4989a0a94e69 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription identifier.", "docstring_type": "str", "required": true @@ -42,20 +44,60 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "iot_hub_resource": "IotHubResourceOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py index e5754a47ce68..ba617b3fa777 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "0.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_iot_hub_client.py index 269ae856b23e..1671dff2185d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/_iot_hub_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -24,7 +25,7 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.aio.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2016_02_03.aio.operations.IotHubResourceOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. @@ -53,6 +54,23 @@ def __init__( self.iot_hub_resource = IotHubResourceOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py index 328621dbc933..384ab94f1da4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py @@ -28,7 +28,7 @@ class IotHubResourceOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2016_02_03.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ async def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -147,7 +147,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -173,22 +173,24 @@ async def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub to create or update. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -242,12 +244,10 @@ async def _delete_initial( resource_group_name: str, resource_name: str, **kwargs - ) -> Optional["_models.IotHubDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-02-03" @@ -274,9 +274,9 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -286,6 +286,9 @@ async def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -297,7 +300,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, **kwargs - ) -> AsyncLROPoller["_models.IotHubDescription"]: + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. Delete an IoT hub. @@ -308,16 +311,16 @@ async def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -371,7 +374,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -419,7 +422,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -443,7 +446,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -492,7 +495,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -519,7 +522,7 @@ async def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -553,7 +556,7 @@ async def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -580,7 +583,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -630,7 +633,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -661,7 +664,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -712,7 +715,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -745,7 +748,7 @@ async def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -781,7 +784,7 @@ async def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -814,7 +817,7 @@ async def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -850,7 +853,7 @@ async def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -919,7 +922,7 @@ async def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -944,7 +947,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -994,7 +997,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1025,7 +1028,7 @@ async def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1060,7 +1063,7 @@ async def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1087,7 +1090,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1137,7 +1140,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1159,10 +1162,10 @@ async def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2016_02_03.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1199,7 +1202,7 @@ async def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1227,7 +1230,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1277,7 +1280,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1308,7 +1311,7 @@ async def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1343,7 +1346,7 @@ async def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1364,18 +1367,18 @@ async def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1414,7 +1417,7 @@ async def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1435,18 +1438,18 @@ async def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1485,7 +1488,7 @@ async def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models.py index a03aa93486bc..0d8e6e2c47ff 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models.py @@ -14,15 +14,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2016_02_03.models.FeedbackProperties """ _validation = { @@ -150,8 +150,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -225,12 +225,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -297,7 +297,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2016_02_03.models.IotHubScaleType """ _validation = { @@ -397,9 +397,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: The properties of an IoT hub. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2016_02_03.models.IotHubProperties :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuInfo """ _validation = { @@ -443,7 +443,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -475,7 +475,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2016_02_03.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -509,9 +509,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2016_02_03.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar host_name: The name of the host. @@ -519,30 +519,32 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2016_02_03.models.EventHubProperties] :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2016_02_03.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2016_02_03.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2016_02_03.models.CloudToDeviceProperties :param comments: Comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2016_02_03.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2016_02_03.models.Capabilities """ _validation = { @@ -625,7 +627,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -658,9 +660,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuInfo :param capacity: Required. IoT Hub capacity information. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2016_02_03.models.IotHubCapacity """ _validation = { @@ -691,7 +693,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -722,9 +724,9 @@ class IotHubSkuInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2016_02_03.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuTier :param capacity: Required. The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -761,7 +763,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2016_02_03.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -803,10 +805,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2016_02_03.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2016_02_03.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -858,7 +860,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -884,12 +886,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/en- - us/azure/iot-hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub- - devguide-file-upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload. @@ -945,7 +947,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2016_02_03.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1013,7 +1015,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2016_02_03.models.AccessRights """ _validation = { @@ -1045,7 +1047,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -1074,8 +1076,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models_py3.py index 428bedd08a50..f97b61ce6d61 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/models/_models_py3.py @@ -19,15 +19,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2016_02_03.models.FeedbackProperties """ _validation = { @@ -165,8 +165,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -246,12 +246,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -325,7 +325,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2016_02_03.models.IotHubScaleType """ _validation = { @@ -428,9 +428,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: The properties of an IoT hub. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2016_02_03.models.IotHubProperties :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuInfo """ _validation = { @@ -482,7 +482,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -516,7 +516,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2016_02_03.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -552,9 +552,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2016_02_03.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar host_name: The name of the host. @@ -562,30 +562,32 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2016_02_03.models.EventHubProperties] :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2016_02_03.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2016_02_03.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2016_02_03.models.CloudToDeviceProperties :param comments: Comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2016_02_03.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2016_02_03.models.Capabilities """ _validation = { @@ -679,7 +681,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -714,9 +716,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuInfo :param capacity: Required. IoT Hub capacity information. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2016_02_03.models.IotHubCapacity """ _validation = { @@ -750,7 +752,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -783,9 +785,9 @@ class IotHubSkuInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2016_02_03.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuTier :param capacity: Required. The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -825,7 +827,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2016_02_03.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -871,10 +873,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2016_02_03.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2016_02_03.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -926,7 +928,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -954,12 +956,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/en- - us/azure/iot-hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub- - devguide-file-upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1021,7 +1023,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2016_02_03.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1091,7 +1093,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2016_02_03.models.AccessRights """ _validation = { @@ -1128,7 +1130,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -1159,8 +1161,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py index 96140ba6a09c..d9fd44c0541b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py @@ -32,7 +32,7 @@ class IotHubResourceOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2016_02_03.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,7 +64,7 @@ def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -153,7 +153,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -180,22 +180,24 @@ def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub to create or update. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -250,12 +252,10 @@ def _delete_initial( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["_models.IotHubDescription"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2016-02-03" @@ -282,9 +282,9 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -294,6 +294,9 @@ def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -306,7 +309,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.IotHubDescription"] + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] """Delete an IoT hub. Delete an IoT hub. @@ -317,16 +320,16 @@ def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -381,7 +384,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -429,7 +432,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -454,7 +457,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -503,7 +506,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -531,7 +534,7 @@ def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -565,7 +568,7 @@ def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -593,7 +596,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -643,7 +646,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -675,7 +678,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -726,7 +729,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -760,7 +763,7 @@ def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -796,7 +799,7 @@ def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -830,7 +833,7 @@ def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -866,7 +869,7 @@ def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -936,7 +939,7 @@ def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -962,7 +965,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1012,7 +1015,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1044,7 +1047,7 @@ def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1079,7 +1082,7 @@ def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1107,7 +1110,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1157,7 +1160,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1180,10 +1183,10 @@ def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2016_02_03.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1220,7 +1223,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1249,7 +1252,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1299,7 +1302,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1331,7 +1334,7 @@ def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1366,7 +1369,7 @@ def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1388,18 +1391,18 @@ def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1438,7 +1441,7 @@ def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1460,18 +1463,18 @@ def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2016_02_03.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2016_02_03.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1510,7 +1513,7 @@ def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_iot_hub_client.py index 2db7b32744cf..8c8d8b271367 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_iot_hub_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import IotHubClientConfiguration from .operations import IotHubResourceOperations @@ -26,7 +27,7 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2017_01_19.operations.IotHubResourceOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. @@ -56,6 +57,24 @@ def __init__( self.iot_hub_resource = IotHubResourceOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_metadata.json index 7a948f21dea6..555c8a442721 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription identifier.", "docstring_type": "str", "required": true @@ -42,20 +44,60 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "iot_hub_resource": "IotHubResourceOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py index e5754a47ce68..ba617b3fa777 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "0.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_iot_hub_client.py index 269ae856b23e..88adc4d8567b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/_iot_hub_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -24,7 +25,7 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.aio.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2017_01_19.aio.operations.IotHubResourceOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. @@ -53,6 +54,23 @@ def __init__( self.iot_hub_resource = IotHubResourceOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py index ffecd69db599..0995929a66c0 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py @@ -28,7 +28,7 @@ class IotHubResourceOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2017_01_19.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ async def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -147,7 +147,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -173,22 +173,24 @@ async def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub to create or update. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -242,12 +244,10 @@ async def _delete_initial( resource_group_name: str, resource_name: str, **kwargs - ) -> Optional["_models.IotHubDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2017-01-19" @@ -274,9 +274,9 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -286,6 +286,9 @@ async def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -297,7 +300,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, **kwargs - ) -> AsyncLROPoller["_models.IotHubDescription"]: + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. Delete an IoT hub. @@ -308,16 +311,16 @@ async def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -371,7 +374,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -419,7 +422,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -443,7 +446,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -492,7 +495,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -519,7 +522,7 @@ async def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -553,7 +556,7 @@ async def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -580,7 +583,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -630,7 +633,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -661,7 +664,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -712,7 +715,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -745,7 +748,7 @@ async def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -781,7 +784,7 @@ async def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -814,7 +817,7 @@ async def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -850,7 +853,7 @@ async def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -919,7 +922,7 @@ async def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -944,7 +947,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -994,7 +997,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1025,7 +1028,7 @@ async def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1060,7 +1063,7 @@ async def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1087,7 +1090,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1137,7 +1140,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1159,10 +1162,10 @@ async def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2017_01_19.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1199,7 +1202,7 @@ async def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1227,7 +1230,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1277,7 +1280,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1308,7 +1311,7 @@ async def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1343,7 +1346,7 @@ async def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1364,18 +1367,18 @@ async def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2017_01_19.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1414,7 +1417,7 @@ async def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1435,18 +1438,18 @@ async def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2017_01_19.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1485,7 +1488,7 @@ async def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models.py index 67039dfcd809..bf2f0fbc358d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models.py @@ -14,15 +14,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2017_01_19.models.FeedbackProperties """ _validation = { @@ -150,8 +150,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -226,7 +226,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. e.g. DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2017_01_19.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -269,12 +269,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -341,7 +341,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2017_01_19.models.IotHubScaleType """ _validation = { @@ -441,9 +441,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: The properties of an IoT hub. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2017_01_19.models.IotHubProperties :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuInfo """ _validation = { @@ -487,7 +487,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -519,7 +519,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2017_01_19.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -553,9 +553,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2017_01_19.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar host_name: The name of the host. @@ -563,23 +563,25 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2017_01_19.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2017_01_19.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2017_01_19.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2017_01_19.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2017_01_19.models.CloudToDeviceProperties :param comments: Comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. @@ -587,10 +589,10 @@ class IotHubProperties(msrest.serialization.Model): DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2017_01_19.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2017_01_19.models.Capabilities """ _validation = { @@ -675,7 +677,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -708,9 +710,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuInfo :param capacity: Required. IoT Hub capacity information. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2017_01_19.models.IotHubCapacity """ _validation = { @@ -741,7 +743,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -772,9 +774,9 @@ class IotHubSkuInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2017_01_19.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuTier :param capacity: Required. The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -811,7 +813,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2017_01_19.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -853,10 +855,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2017_01_19.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2017_01_19.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -908,7 +910,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -934,12 +936,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -995,7 +997,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2017_01_19.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1057,7 +1059,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2017_01_19.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1102,14 +1104,14 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2017_01_19.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2017_01_19.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2017_01_19.models.RoutingEventHubProperties] """ _attribute_map = { @@ -1176,16 +1178,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2017_01_19.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2017_01_19.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2017_01_19.models.FallbackRouteProperties """ _attribute_map = { @@ -1306,7 +1308,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2017_01_19.models.AccessRights """ _validation = { @@ -1338,7 +1340,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -1367,8 +1369,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models_py3.py index 0b77bda8ded5..bb53ed355109 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/models/_models_py3.py @@ -19,15 +19,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2017_01_19.models.FeedbackProperties """ _validation = { @@ -165,8 +165,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -247,7 +247,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. e.g. DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2017_01_19.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -295,12 +295,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -374,7 +374,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2017_01_19.models.IotHubScaleType """ _validation = { @@ -477,9 +477,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: The properties of an IoT hub. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2017_01_19.models.IotHubProperties :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuInfo """ _validation = { @@ -531,7 +531,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -565,7 +565,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2017_01_19.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -601,9 +601,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2017_01_19.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar host_name: The name of the host. @@ -611,23 +611,25 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2017_01_19.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2017_01_19.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2017_01_19.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2017_01_19.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2017_01_19.models.CloudToDeviceProperties :param comments: Comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. @@ -635,10 +637,10 @@ class IotHubProperties(msrest.serialization.Model): DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2017_01_19.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2017_01_19.models.Capabilities """ _validation = { @@ -735,7 +737,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -770,9 +772,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuInfo :param capacity: Required. IoT Hub capacity information. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2017_01_19.models.IotHubCapacity """ _validation = { @@ -806,7 +808,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -839,9 +841,9 @@ class IotHubSkuInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2017_01_19.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuTier :param capacity: Required. The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -881,7 +883,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2017_01_19.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -927,10 +929,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2017_01_19.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2017_01_19.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -982,7 +984,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1010,12 +1012,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1077,7 +1079,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2017_01_19.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1141,7 +1143,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2017_01_19.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1192,14 +1194,14 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2017_01_19.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2017_01_19.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2017_01_19.models.RoutingEventHubProperties] """ _attribute_map = { @@ -1275,16 +1277,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2017_01_19.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2017_01_19.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2017_01_19.models.FallbackRouteProperties """ _attribute_map = { @@ -1419,7 +1421,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2017_01_19.models.AccessRights """ _validation = { @@ -1456,7 +1458,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -1487,8 +1489,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py index f5e9109f0810..d2e9ea4df1e5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py @@ -32,7 +32,7 @@ class IotHubResourceOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2017_01_19.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,7 +64,7 @@ def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -153,7 +153,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -180,22 +180,24 @@ def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub to create or update. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -250,12 +252,10 @@ def _delete_initial( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["_models.IotHubDescription"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2017-01-19" @@ -282,9 +282,9 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -294,6 +294,9 @@ def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -306,7 +309,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.IotHubDescription"] + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] """Delete an IoT hub. Delete an IoT hub. @@ -317,16 +320,16 @@ def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -381,7 +384,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -429,7 +432,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -454,7 +457,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -503,7 +506,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -531,7 +534,7 @@ def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -565,7 +568,7 @@ def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -593,7 +596,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -643,7 +646,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -675,7 +678,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -726,7 +729,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -760,7 +763,7 @@ def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -796,7 +799,7 @@ def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -830,7 +833,7 @@ def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -866,7 +869,7 @@ def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -936,7 +939,7 @@ def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -962,7 +965,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1012,7 +1015,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1044,7 +1047,7 @@ def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1079,7 +1082,7 @@ def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1107,7 +1110,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1157,7 +1160,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1180,10 +1183,10 @@ def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2017_01_19.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1220,7 +1223,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1249,7 +1252,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1299,7 +1302,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1331,7 +1334,7 @@ def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1366,7 +1369,7 @@ def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1388,18 +1391,18 @@ def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2017_01_19.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1438,7 +1441,7 @@ def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1460,18 +1463,18 @@ def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2017_01_19.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_01_19.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1510,7 +1513,7 @@ def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py index 1c90e57f900e..51b896d37d36 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_iot_hub_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import IotHubClientConfiguration from .operations import Operations @@ -28,11 +29,11 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.operations.Operations + :vartype operations: azure.mgmt.iothub.v2017_07_01.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2017_07_01.operations.IotHubResourceOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2017_07_01.operations.CertificatesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. @@ -66,6 +67,24 @@ def __init__( self.certificates = CertificatesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json index a8445b69f983..829fdb083487 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription identifier.", "docstring_type": "str", "required": true @@ -42,22 +44,62 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", "iot_hub_resource": "IotHubResourceOperations", "certificates": "CertificatesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py index e5754a47ce68..ba617b3fa777 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "0.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py index 975b27acd505..364861ddd0af 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/_iot_hub_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -26,11 +27,11 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.aio.operations.Operations + :vartype operations: azure.mgmt.iothub.v2017_07_01.aio.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.aio.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2017_07_01.aio.operations.IotHubResourceOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2017_07_01.aio.operations.CertificatesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. @@ -63,6 +64,23 @@ def __init__( self.certificates = CertificatesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py index 1ea32942be41..7496b1975f37 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py @@ -25,7 +25,7 @@ class CertificatesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2017_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -56,7 +56,7 @@ async def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -90,7 +90,7 @@ async def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -120,7 +120,7 @@ async def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -155,7 +155,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -186,13 +186,13 @@ async def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2017_07_01.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -234,7 +234,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -307,7 +307,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,7 +338,7 @@ async def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -374,7 +374,7 @@ async def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -408,10 +408,10 @@ async def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2017_07_01.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -452,7 +452,7 @@ async def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py index eec7068fe33b..25662122bb60 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py @@ -28,7 +28,7 @@ class IotHubResourceOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2017_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ async def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -150,7 +150,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -177,25 +177,27 @@ async def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -250,12 +252,10 @@ async def _delete_initial( resource_group_name: str, resource_name: str, **kwargs - ) -> Optional["_models.IotHubDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2017-07-01" @@ -282,9 +282,9 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -294,6 +294,9 @@ async def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -305,7 +308,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, **kwargs - ) -> AsyncLROPoller["_models.IotHubDescription"]: + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. Delete an IoT hub. @@ -316,16 +319,16 @@ async def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -379,7 +382,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -427,7 +430,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -451,7 +454,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -500,7 +503,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -527,7 +530,7 @@ async def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -561,7 +564,7 @@ async def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -588,7 +591,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -638,7 +641,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -669,7 +672,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -720,7 +723,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -753,7 +756,7 @@ async def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -789,7 +792,7 @@ async def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -822,7 +825,7 @@ async def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -858,7 +861,7 @@ async def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -927,7 +930,7 @@ async def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -952,7 +955,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_07_01.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1002,7 +1005,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1033,7 +1036,7 @@ async def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1068,7 +1071,7 @@ async def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1095,7 +1098,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_07_01.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1145,7 +1148,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1167,10 +1170,10 @@ async def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2017_07_01.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1207,7 +1210,7 @@ async def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1235,7 +1238,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1285,7 +1288,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1316,7 +1319,7 @@ async def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1351,7 +1354,7 @@ async def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1372,18 +1375,18 @@ async def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2017_07_01.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1422,7 +1425,7 @@ async def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1443,18 +1446,18 @@ async def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2017_07_01.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1493,7 +1496,7 @@ async def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py index 70b92afdb329..515a81d13e04 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py @@ -26,7 +26,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2017_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,7 +49,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2017_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -93,7 +93,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models.py index 33648cf2d4b4..9a4f10a6f243 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models.py @@ -36,7 +36,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2017_07_01.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -78,7 +78,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription] """ _attribute_map = { @@ -226,7 +226,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2017_07_01.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -268,15 +268,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2017_07_01.models.FeedbackProperties """ _validation = { @@ -404,8 +404,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -480,7 +480,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2017_07_01.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -523,12 +523,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -595,7 +595,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubScaleType """ _validation = { @@ -695,9 +695,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: The properties of an IoT hub. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2017_07_01.models.IotHubProperties :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuInfo """ _validation = { @@ -741,7 +741,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -773,7 +773,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -807,9 +807,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2017_07_01.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar host_name: The name of the host. @@ -817,23 +817,25 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2017_07_01.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2017_07_01.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2017_07_01.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2017_07_01.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2017_07_01.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. @@ -841,10 +843,10 @@ class IotHubProperties(msrest.serialization.Model): DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2017_07_01.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2017_07_01.models.Capabilities """ _validation = { @@ -929,7 +931,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -962,9 +964,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuInfo :param capacity: Required. IoT Hub capacity information. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2017_07_01.models.IotHubCapacity """ _validation = { @@ -995,7 +997,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1026,9 +1028,9 @@ class IotHubSkuInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuTier :param capacity: Required. The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1065,7 +1067,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2017_07_01.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1107,10 +1109,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2017_07_01.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2017_07_01.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1162,7 +1164,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1188,12 +1190,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1228,7 +1230,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2017_07_01.models.OperationDisplay """ _validation = { @@ -1315,7 +1317,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2017_07_01.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1343,7 +1345,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2017_07_01.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1405,7 +1407,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2017_07_01.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1450,17 +1452,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2017_07_01.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2017_07_01.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2017_07_01.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2017_07_01.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1529,16 +1532,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2017_07_01.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2017_07_01.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2017_07_01.models.FallbackRouteProperties """ _attribute_map = { @@ -1728,7 +1731,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2017_07_01.models.AccessRights """ _validation = { @@ -1760,7 +1763,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -1789,8 +1792,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py index 5157df2b4c0e..064d79995980 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/models/_models_py3.py @@ -43,7 +43,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2017_07_01.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -87,7 +87,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription] """ _attribute_map = { @@ -239,7 +239,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2017_07_01.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -283,15 +283,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2017_07_01.models.FeedbackProperties """ _validation = { @@ -429,8 +429,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -511,7 +511,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2017_07_01.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -559,12 +559,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -638,7 +638,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubScaleType """ _validation = { @@ -741,9 +741,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: The properties of an IoT hub. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2017_07_01.models.IotHubProperties :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuInfo """ _validation = { @@ -795,7 +795,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -829,7 +829,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -865,9 +865,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2017_07_01.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar host_name: The name of the host. @@ -875,23 +875,25 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2017_07_01.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2017_07_01.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2017_07_01.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2017_07_01.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2017_07_01.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. @@ -899,10 +901,10 @@ class IotHubProperties(msrest.serialization.Model): DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2017_07_01.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2017_07_01.models.Capabilities """ _validation = { @@ -999,7 +1001,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1034,9 +1036,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuInfo :param capacity: Required. IoT Hub capacity information. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2017_07_01.models.IotHubCapacity """ _validation = { @@ -1070,7 +1072,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1103,9 +1105,9 @@ class IotHubSkuInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuTier :param capacity: Required. The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1145,7 +1147,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2017_07_01.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1191,10 +1193,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2017_07_01.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2017_07_01.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1246,7 +1248,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1274,12 +1276,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1318,7 +1320,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2017_07_01.models.OperationDisplay """ _validation = { @@ -1409,7 +1411,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2017_07_01.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1437,7 +1439,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2017_07_01.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1501,7 +1503,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2017_07_01.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1552,17 +1554,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2017_07_01.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2017_07_01.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2017_07_01.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2017_07_01.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1641,16 +1644,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2017_07_01.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2017_07_01.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2017_07_01.models.FallbackRouteProperties """ _attribute_map = { @@ -1864,7 +1867,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2017_07_01.models.AccessRights """ _validation = { @@ -1901,7 +1904,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -1932,8 +1935,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py index 204dc8a858a3..164e27cd88c5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_certificates_operations.py @@ -29,7 +29,7 @@ class CertificatesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2017_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -61,7 +61,7 @@ def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -95,7 +95,7 @@ def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -126,7 +126,7 @@ def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -161,7 +161,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -193,13 +193,13 @@ def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2017_07_01.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -241,7 +241,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -315,7 +315,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -347,7 +347,7 @@ def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -383,7 +383,7 @@ def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -418,10 +418,10 @@ def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2017_07_01.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -462,7 +462,7 @@ def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py index 7ace79f02977..643d440b9067 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py @@ -32,7 +32,7 @@ class IotHubResourceOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2017_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,7 +64,7 @@ def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -156,7 +156,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -184,25 +184,27 @@ def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -258,12 +260,10 @@ def _delete_initial( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["_models.IotHubDescription"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2017-07-01" @@ -290,9 +290,9 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -302,6 +302,9 @@ def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -314,7 +317,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.IotHubDescription"] + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] """Delete an IoT hub. Delete an IoT hub. @@ -325,16 +328,16 @@ def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -389,7 +392,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -437,7 +440,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -462,7 +465,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_07_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -511,7 +514,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -539,7 +542,7 @@ def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -573,7 +576,7 @@ def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -601,7 +604,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_07_01.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -651,7 +654,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -683,7 +686,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -734,7 +737,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -768,7 +771,7 @@ def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -804,7 +807,7 @@ def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -838,7 +841,7 @@ def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -874,7 +877,7 @@ def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -944,7 +947,7 @@ def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -970,7 +973,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_07_01.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1020,7 +1023,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1052,7 +1055,7 @@ def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1087,7 +1090,7 @@ def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1115,7 +1118,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_07_01.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1165,7 +1168,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1188,10 +1191,10 @@ def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2017_07_01.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1228,7 +1231,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1257,7 +1260,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1307,7 +1310,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1339,7 +1342,7 @@ def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1374,7 +1377,7 @@ def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1396,18 +1399,18 @@ def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2017_07_01.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1446,7 +1449,7 @@ def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1468,18 +1471,18 @@ def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2017_07_01.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2017_07_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1518,7 +1521,7 @@ def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py index b784ed9b0555..8a0e549c5986 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_operations.py @@ -30,7 +30,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2017_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2017_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py index 1c90e57f900e..7f5c336afba6 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_iot_hub_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import IotHubClientConfiguration from .operations import Operations @@ -28,11 +29,11 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.operations.Operations + :vartype operations: azure.mgmt.iothub.v2018_01_22.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2018_01_22.operations.IotHubResourceOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2018_01_22.operations.CertificatesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. @@ -66,6 +67,24 @@ def __init__( self.certificates = CertificatesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json index ce7c095043d8..423759ef29b5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription identifier.", "docstring_type": "str", "required": true @@ -42,22 +44,62 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", "iot_hub_resource": "IotHubResourceOperations", "certificates": "CertificatesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py index e5754a47ce68..ba617b3fa777 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "0.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py index 975b27acd505..4d778632863e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/_iot_hub_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -26,11 +27,11 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.aio.operations.Operations + :vartype operations: azure.mgmt.iothub.v2018_01_22.aio.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.aio.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2018_01_22.aio.operations.IotHubResourceOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2018_01_22.aio.operations.CertificatesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. @@ -63,6 +64,23 @@ def __init__( self.certificates = CertificatesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py index 4580eabb7199..deeaa6708f2d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py @@ -25,7 +25,7 @@ class CertificatesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_01_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -56,7 +56,7 @@ async def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -90,7 +90,7 @@ async def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -120,7 +120,7 @@ async def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -155,7 +155,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -186,13 +186,13 @@ async def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2018_01_22.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -234,7 +234,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -307,7 +307,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,7 +338,7 @@ async def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -374,7 +374,7 @@ async def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -408,10 +408,10 @@ async def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2018_01_22.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -452,7 +452,7 @@ async def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py index f5f8960618d9..203567972d98 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py @@ -28,7 +28,7 @@ class IotHubResourceOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_01_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ async def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -150,7 +150,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -177,25 +177,27 @@ async def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -314,15 +316,15 @@ async def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2018_01_22.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -376,12 +378,10 @@ async def _delete_initial( resource_group_name: str, resource_name: str, **kwargs - ) -> Optional["_models.IotHubDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-01-22" @@ -408,9 +408,9 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -420,6 +420,9 @@ async def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -431,7 +434,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, **kwargs - ) -> AsyncLROPoller["_models.IotHubDescription"]: + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. Delete an IoT hub. @@ -442,16 +445,16 @@ async def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -505,7 +508,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -553,7 +556,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -577,7 +580,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -626,7 +629,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -653,7 +656,7 @@ async def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -687,7 +690,7 @@ async def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -714,7 +717,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -764,7 +767,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -795,7 +798,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -846,7 +849,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -879,7 +882,7 @@ async def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -915,7 +918,7 @@ async def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -948,7 +951,7 @@ async def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -984,7 +987,7 @@ async def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1053,7 +1056,7 @@ async def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1078,7 +1081,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_01_22.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1128,7 +1131,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1159,7 +1162,7 @@ async def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1194,7 +1197,7 @@ async def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1221,7 +1224,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_01_22.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1271,7 +1274,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1293,10 +1296,10 @@ async def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2018_01_22.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1333,7 +1336,7 @@ async def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1361,7 +1364,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1411,7 +1414,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1442,7 +1445,7 @@ async def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1477,7 +1480,7 @@ async def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1498,18 +1501,18 @@ async def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2018_01_22.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1548,7 +1551,7 @@ async def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1569,18 +1572,18 @@ async def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2018_01_22.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1619,7 +1622,7 @@ async def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py index 83bdc1f64b4c..aaa7b933a784 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py @@ -26,7 +26,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_01_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,7 +49,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_01_22.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -93,7 +93,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models.py index 1caa89ca326a..478c725fba93 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models.py @@ -36,7 +36,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2018_01_22.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -78,7 +78,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription] """ _attribute_map = { @@ -226,7 +226,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2018_01_22.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -268,15 +268,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2018_01_22.models.FeedbackProperties """ _validation = { @@ -389,7 +389,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -421,8 +421,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -500,7 +500,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2018_01_22.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -545,12 +545,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -617,7 +617,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubScaleType """ _validation = { @@ -712,9 +712,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: The properties of an IoT hub. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2018_01_22.models.IotHubProperties :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuInfo """ _validation = { @@ -752,7 +752,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -784,7 +784,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -818,9 +818,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2018_01_22.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -830,23 +830,25 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2018_01_22.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2018_01_22.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2018_01_22.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2018_01_22.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2018_01_22.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. @@ -854,10 +856,10 @@ class IotHubProperties(msrest.serialization.Model): DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2018_01_22.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2018_01_22.models.Capabilities """ _validation = { @@ -945,7 +947,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -978,9 +980,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuInfo :param capacity: Required. IoT Hub capacity information. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2018_01_22.models.IotHubCapacity """ _validation = { @@ -1011,7 +1013,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1042,9 +1044,9 @@ class IotHubSkuInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1080,7 +1082,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2018_01_22.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1122,10 +1124,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2018_01_22.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2018_01_22.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1177,7 +1179,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1203,12 +1205,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1243,7 +1245,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2018_01_22.models.OperationDisplay """ _validation = { @@ -1330,7 +1332,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2018_01_22.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1358,7 +1360,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2018_01_22.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1420,7 +1422,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2018_01_22.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1465,17 +1467,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2018_01_22.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2018_01_22.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2018_01_22.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2018_01_22.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1544,16 +1547,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2018_01_22.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2018_01_22.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2018_01_22.models.FallbackRouteProperties """ _attribute_map = { @@ -1743,7 +1746,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2018_01_22.models.AccessRights """ _validation = { @@ -1775,7 +1778,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -1804,8 +1807,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py index bb7fc6c2d3ac..a4f67c3579ba 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/models/_models_py3.py @@ -43,7 +43,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2018_01_22.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -87,7 +87,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription] """ _attribute_map = { @@ -239,7 +239,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2018_01_22.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -283,15 +283,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2018_01_22.models.FeedbackProperties """ _validation = { @@ -410,7 +410,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -444,8 +444,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -529,7 +529,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2018_01_22.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -580,12 +580,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -659,7 +659,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubScaleType """ _validation = { @@ -757,9 +757,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: The properties of an IoT hub. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2018_01_22.models.IotHubProperties :param sku: Required. Information about the SKU of the IoT hub. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuInfo """ _validation = { @@ -803,7 +803,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -837,7 +837,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -873,9 +873,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2018_01_22.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -885,23 +885,25 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2018_01_22.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2018_01_22.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2018_01_22.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2018_01_22.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2018_01_22.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. @@ -909,10 +911,10 @@ class IotHubProperties(msrest.serialization.Model): DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2018_01_22.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2018_01_22.models.Capabilities """ _validation = { @@ -1012,7 +1014,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1047,9 +1049,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuInfo :param capacity: Required. IoT Hub capacity information. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2018_01_22.models.IotHubCapacity """ _validation = { @@ -1083,7 +1085,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1116,9 +1118,9 @@ class IotHubSkuInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1157,7 +1159,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2018_01_22.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1203,10 +1205,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2018_01_22.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2018_01_22.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1258,7 +1260,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1286,12 +1288,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1330,7 +1332,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2018_01_22.models.OperationDisplay """ _validation = { @@ -1421,7 +1423,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2018_01_22.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1449,7 +1451,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2018_01_22.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1513,7 +1515,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2018_01_22.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1564,17 +1566,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2018_01_22.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2018_01_22.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2018_01_22.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2018_01_22.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1653,16 +1656,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2018_01_22.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2018_01_22.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2018_01_22.models.FallbackRouteProperties """ _attribute_map = { @@ -1876,7 +1879,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2018_01_22.models.AccessRights """ _validation = { @@ -1913,7 +1916,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -1944,8 +1947,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py index ca9a32493f39..35f9c53f2ca1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_certificates_operations.py @@ -29,7 +29,7 @@ class CertificatesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_01_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -61,7 +61,7 @@ def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -95,7 +95,7 @@ def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -126,7 +126,7 @@ def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -161,7 +161,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -193,13 +193,13 @@ def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2018_01_22.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -241,7 +241,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -315,7 +315,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -347,7 +347,7 @@ def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -383,7 +383,7 @@ def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -418,10 +418,10 @@ def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2018_01_22.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -462,7 +462,7 @@ def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py index 7e6f65b90494..3f4fffc7ec75 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py @@ -32,7 +32,7 @@ class IotHubResourceOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_01_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,7 +64,7 @@ def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -156,7 +156,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -184,25 +184,27 @@ def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -323,15 +325,15 @@ def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2018_01_22.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -386,12 +388,10 @@ def _delete_initial( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["_models.IotHubDescription"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-01-22" @@ -418,9 +418,9 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -430,6 +430,9 @@ def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -442,7 +445,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.IotHubDescription"] + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] """Delete an IoT hub. Delete an IoT hub. @@ -453,16 +456,16 @@ def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -517,7 +520,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -565,7 +568,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -590,7 +593,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_01_22.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -639,7 +642,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -667,7 +670,7 @@ def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -701,7 +704,7 @@ def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -729,7 +732,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_01_22.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -779,7 +782,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -811,7 +814,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -862,7 +865,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -896,7 +899,7 @@ def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -932,7 +935,7 @@ def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -966,7 +969,7 @@ def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -1002,7 +1005,7 @@ def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1072,7 +1075,7 @@ def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1098,7 +1101,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_01_22.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1148,7 +1151,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1180,7 +1183,7 @@ def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1215,7 +1218,7 @@ def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1243,7 +1246,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_01_22.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1293,7 +1296,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1316,10 +1319,10 @@ def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2018_01_22.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1356,7 +1359,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1385,7 +1388,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1435,7 +1438,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1467,7 +1470,7 @@ def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1502,7 +1505,7 @@ def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1524,18 +1527,18 @@ def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2018_01_22.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1574,7 +1577,7 @@ def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1596,18 +1599,18 @@ def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2018_01_22.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_01_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1646,7 +1649,7 @@ def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py index 422ad00d0c1d..753e76714763 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_operations.py @@ -30,7 +30,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_01_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_01_22.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py index a2a7562c1541..961242fbb475 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_iot_hub_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import IotHubClientConfiguration from .operations import Operations @@ -29,13 +30,13 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.operations.Operations + :vartype operations: azure.mgmt.iothub.v2018_04_01.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2018_04_01.operations.IotHubResourceOperations :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: azure.mgmt.iothub.operations.ResourceProviderCommonOperations + :vartype resource_provider_common: azure.mgmt.iothub.v2018_04_01.operations.ResourceProviderCommonOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2018_04_01.operations.CertificatesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. @@ -71,6 +72,24 @@ def __init__( self.certificates = CertificatesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json index 00a397838618..1879addea0cf 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription identifier.", "docstring_type": "str", "required": true @@ -42,23 +44,63 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", "iot_hub_resource": "IotHubResourceOperations", "resource_provider_common": "ResourceProviderCommonOperations", "certificates": "CertificatesOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py index e5754a47ce68..ba617b3fa777 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "0.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py index 43e71b0bd992..66af50401262 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/_iot_hub_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -27,13 +28,13 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.aio.operations.Operations + :vartype operations: azure.mgmt.iothub.v2018_04_01.aio.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.aio.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2018_04_01.aio.operations.IotHubResourceOperations :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: azure.mgmt.iothub.aio.operations.ResourceProviderCommonOperations + :vartype resource_provider_common: azure.mgmt.iothub.v2018_04_01.aio.operations.ResourceProviderCommonOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2018_04_01.aio.operations.CertificatesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. @@ -68,6 +69,23 @@ def __init__( self.certificates = CertificatesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py index 622030f66130..f7bada776fde 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py @@ -25,7 +25,7 @@ class CertificatesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -56,7 +56,7 @@ async def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -90,7 +90,7 @@ async def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -120,7 +120,7 @@ async def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -155,7 +155,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -186,13 +186,13 @@ async def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2018_04_01.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -234,7 +234,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -307,7 +307,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,7 +338,7 @@ async def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -374,7 +374,7 @@ async def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -408,10 +408,10 @@ async def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2018_04_01.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -452,7 +452,7 @@ async def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py index 1c1f2c2eeefb..66b41de9ecc3 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py @@ -28,7 +28,7 @@ class IotHubResourceOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ async def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -150,7 +150,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -177,25 +177,27 @@ async def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -314,15 +316,15 @@ async def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2018_04_01.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -376,12 +378,10 @@ async def _delete_initial( resource_group_name: str, resource_name: str, **kwargs - ) -> Optional["_models.IotHubDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-04-01" @@ -408,9 +408,9 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -420,6 +420,9 @@ async def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -431,7 +434,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, **kwargs - ) -> AsyncLROPoller["_models.IotHubDescription"]: + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. Delete an IoT hub. @@ -442,16 +445,16 @@ async def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -505,7 +508,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -553,7 +556,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -577,7 +580,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -626,7 +629,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -653,7 +656,7 @@ async def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -687,7 +690,7 @@ async def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -714,7 +717,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -764,7 +767,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -795,7 +798,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -846,7 +849,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -879,7 +882,7 @@ async def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -915,7 +918,7 @@ async def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -948,7 +951,7 @@ async def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -984,7 +987,7 @@ async def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1053,7 +1056,7 @@ async def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1078,7 +1081,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_04_01.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1128,7 +1131,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1159,7 +1162,7 @@ async def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1194,7 +1197,7 @@ async def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1221,7 +1224,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_04_01.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1271,7 +1274,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1298,7 +1301,7 @@ def get_endpoint_health( :type iot_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EndpointHealthDataListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_04_01.models.EndpointHealthDataListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] @@ -1348,7 +1351,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1370,10 +1373,10 @@ async def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2018_04_01.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1410,7 +1413,7 @@ async def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1437,10 +1440,10 @@ async def test_all_routes( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Input for testing all routes. - :type input: ~azure.mgmt.iothub.models.TestAllRoutesInput + :type input: ~azure.mgmt.iothub.v2018_04_01.models.TestAllRoutesInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestAllRoutesResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestAllRoutesResult + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.TestAllRoutesResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] @@ -1479,7 +1482,7 @@ async def test_all_routes( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) @@ -1506,10 +1509,10 @@ async def test_route( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Route that needs to be tested. - :type input: ~azure.mgmt.iothub.models.TestRouteInput + :type input: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestRouteResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestRouteResult + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] @@ -1548,7 +1551,7 @@ async def test_route( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestRouteResult', pipeline_response) @@ -1576,7 +1579,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1626,7 +1629,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1657,7 +1660,7 @@ async def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1692,7 +1695,7 @@ async def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1713,18 +1716,18 @@ async def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2018_04_01.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1763,7 +1766,7 @@ async def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1784,18 +1787,18 @@ async def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2018_04_01.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1834,7 +1837,7 @@ async def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py index e87bd0e213b8..1a0d52047cad 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py @@ -26,7 +26,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,7 +49,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2018_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -93,7 +93,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py index 0178f6299c69..e0089dac35b7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py @@ -25,7 +25,7 @@ class ResourceProviderCommonOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -50,7 +50,7 @@ async def get_subscription_quota( :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSubscriptionQuotaListResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.UserSubscriptionQuotaListResult + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.UserSubscriptionQuotaListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] @@ -82,7 +82,7 @@ async def get_subscription_quota( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models.py index af0d6780daac..5178b3abdbcc 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models.py @@ -36,7 +36,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -78,7 +78,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription] """ _attribute_map = { @@ -235,7 +235,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -277,15 +277,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2018_04_01.models.FeedbackProperties """ _validation = { @@ -315,7 +315,7 @@ class EndpointHealthData(msrest.serialization.Model): :type endpoint_id: str :param health_status: The health status code of the endpoint. Possible values include: "unknown", "healthy", "unhealthy", "dead". - :type health_status: str or ~azure.mgmt.iothub.models.EndpointHealthStatus + :type health_status: str or ~azure.mgmt.iothub.v2018_04_01.models.EndpointHealthStatus """ _attribute_map = { @@ -338,7 +338,7 @@ class EndpointHealthDataListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: JSON-serialized array of Endpoint health data. - :type value: list[~azure.mgmt.iothub.models.EndpointHealthData] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.EndpointHealthData] :ivar next_link: Link to more results. :vartype next_link: str """ @@ -451,7 +451,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -483,8 +483,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -562,7 +562,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -607,12 +607,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -679,7 +679,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2018_04_01.models.IotHubScaleType """ _validation = { @@ -774,9 +774,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: IotHub properties. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.IotHubProperties :param sku: Required. IotHub SKU info. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuInfo """ _validation = { @@ -814,7 +814,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -846,7 +846,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2018_04_01.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -880,9 +880,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2018_04_01.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -892,23 +892,25 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2018_04_01.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2018_04_01.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2018_04_01.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2018_04_01.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2018_04_01.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. @@ -916,10 +918,10 @@ class IotHubProperties(msrest.serialization.Model): DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2018_04_01.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2018_04_01.models.Capabilities """ _validation = { @@ -1007,7 +1009,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1040,9 +1042,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuInfo :param capacity: Required. IotHub capacity. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2018_04_01.models.IotHubCapacity """ _validation = { @@ -1073,7 +1075,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1105,10 +1107,10 @@ class IotHubSkuInfo(msrest.serialization.Model): :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", "B1", "B2", "B3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2018_04_01.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", "Basic". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1144,7 +1146,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2018_04_01.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1186,10 +1188,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2018_04_01.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2018_04_01.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1241,7 +1243,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1268,7 +1270,7 @@ class MatchedRoute(msrest.serialization.Model): """Routes that matched. :param properties: Properties of routes that matched. - :type properties: ~azure.mgmt.iothub.models.RouteProperties + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.RouteProperties """ _attribute_map = { @@ -1286,12 +1288,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1349,7 +1351,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2018_04_01.models.OperationDisplay """ _validation = { @@ -1436,7 +1438,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2018_04_01.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1464,7 +1466,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2018_04_01.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1520,9 +1522,9 @@ class RouteCompilationError(msrest.serialization.Model): :param message: Route error message. :type message: str :param severity: Severity of the route error. Possible values include: "error", "warning". - :type severity: str or ~azure.mgmt.iothub.models.RouteErrorSeverity + :type severity: str or ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorSeverity :param location: Location where the route error happened. - :type location: ~azure.mgmt.iothub.models.RouteErrorRange + :type location: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorRange """ _attribute_map = { @@ -1568,9 +1570,9 @@ class RouteErrorRange(msrest.serialization.Model): """Range of route errors. :param start: Start where the route error happened. - :type start: ~azure.mgmt.iothub.models.RouteErrorPosition + :type start: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorPosition :param end: End where the route error happened. - :type end: ~azure.mgmt.iothub.models.RouteErrorPosition + :type end: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorPosition """ _attribute_map = { @@ -1599,7 +1601,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1644,17 +1646,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2018_04_01.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2018_04_01.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2018_04_01.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2018_04_01.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1750,16 +1753,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2018_04_01.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2018_04_01.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2018_04_01.models.FallbackRouteProperties """ _attribute_map = { @@ -1935,13 +1938,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: object + :type tags: str :param properties: - :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -1958,14 +1961,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired_properties: Twin desired properties. - :type desired_properties: object + :type desired_properties: str :param reported_properties: Twin desired properties. - :type reported_properties: object + :type reported_properties: str """ _attribute_map = { - 'desired_properties': {'key': 'desiredProperties', 'type': 'object'}, - 'reported_properties': {'key': 'reportedProperties', 'type': 'object'}, + 'desired_properties': {'key': 'desiredProperties', 'type': 'str'}, + 'reported_properties': {'key': 'reportedProperties', 'type': 'str'}, } def __init__( @@ -1995,7 +1998,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2018_04_01.models.AccessRights """ _validation = { @@ -2027,7 +2030,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -2056,8 +2059,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. @@ -2112,11 +2115,11 @@ class TestAllRoutesInput(msrest.serialization.Model): :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource + :type routing_source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2018_04_01.models.RoutingMessage :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwin """ _attribute_map = { @@ -2139,7 +2142,7 @@ class TestAllRoutesResult(msrest.serialization.Model): """Result of testing all routes. :param routes: JSON-serialized array of matched routes. - :type routes: list[~azure.mgmt.iothub.models.MatchedRoute] + :type routes: list[~azure.mgmt.iothub.v2018_04_01.models.MatchedRoute] """ _attribute_map = { @@ -2160,11 +2163,11 @@ class TestRouteInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2018_04_01.models.RoutingMessage :param route: Required. Route properties. - :type route: ~azure.mgmt.iothub.models.RouteProperties + :type route: ~azure.mgmt.iothub.v2018_04_01.models.RouteProperties :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwin """ _validation = { @@ -2191,9 +2194,9 @@ class TestRouteResult(msrest.serialization.Model): """Result of testing one route. :param result: Result of testing route. Possible values include: "undefined", "false", "true". - :type result: str or ~azure.mgmt.iothub.models.TestResultStatus + :type result: str or ~azure.mgmt.iothub.v2018_04_01.models.TestResultStatus :param details: Detailed result of testing route. - :type details: ~azure.mgmt.iothub.models.TestRouteResultDetails + :type details: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteResultDetails """ _attribute_map = { @@ -2214,7 +2217,7 @@ class TestRouteResultDetails(msrest.serialization.Model): """Detailed result of testing a route. :param compilation_errors: JSON-serialized list of route compilation errors. - :type compilation_errors: list[~azure.mgmt.iothub.models.RouteCompilationError] + :type compilation_errors: list[~azure.mgmt.iothub.v2018_04_01.models.RouteCompilationError] """ _attribute_map = { @@ -2243,7 +2246,7 @@ class UserSubscriptionQuota(msrest.serialization.Model): :param limit: Numerical limit on IotHub type. :type limit: int :param name: IotHub type. - :type name: ~azure.mgmt.iothub.models.Name + :type name: ~azure.mgmt.iothub.v2018_04_01.models.Name """ _attribute_map = { @@ -2274,7 +2277,7 @@ class UserSubscriptionQuotaListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: - :type value: list[~azure.mgmt.iothub.models.UserSubscriptionQuota] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.UserSubscriptionQuota] :ivar next_link: :vartype next_link: str """ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py index 6f6958156e97..4142210dac5e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py @@ -43,7 +43,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -87,7 +87,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription] """ _attribute_map = { @@ -250,7 +250,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -294,15 +294,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2018_04_01.models.FeedbackProperties """ _validation = { @@ -336,7 +336,7 @@ class EndpointHealthData(msrest.serialization.Model): :type endpoint_id: str :param health_status: The health status code of the endpoint. Possible values include: "unknown", "healthy", "unhealthy", "dead". - :type health_status: str or ~azure.mgmt.iothub.models.EndpointHealthStatus + :type health_status: str or ~azure.mgmt.iothub.v2018_04_01.models.EndpointHealthStatus """ _attribute_map = { @@ -362,7 +362,7 @@ class EndpointHealthDataListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: JSON-serialized array of Endpoint health data. - :type value: list[~azure.mgmt.iothub.models.EndpointHealthData] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.EndpointHealthData] :ivar next_link: Link to more results. :vartype next_link: str """ @@ -479,7 +479,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -513,8 +513,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -598,7 +598,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -649,12 +649,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -728,7 +728,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2018_04_01.models.IotHubScaleType """ _validation = { @@ -826,9 +826,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: IotHub properties. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.IotHubProperties :param sku: Required. IotHub SKU info. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuInfo """ _validation = { @@ -872,7 +872,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -906,7 +906,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2018_04_01.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -942,9 +942,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2018_04_01.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -954,23 +954,25 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The possible keys to this dictionary are events and operationsMonitoringEvents. Both of these keys have to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2018_04_01.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2018_04_01.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2018_04_01.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2018_04_01.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2018_04_01.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param operations_monitoring_properties: The operations monitoring properties for the IoT hub. @@ -978,10 +980,10 @@ class IotHubProperties(msrest.serialization.Model): DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :type operations_monitoring_properties: - ~azure.mgmt.iothub.models.OperationsMonitoringProperties + ~azure.mgmt.iothub.v2018_04_01.models.OperationsMonitoringProperties :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2018_04_01.models.Capabilities """ _validation = { @@ -1081,7 +1083,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1116,9 +1118,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuInfo :param capacity: Required. IotHub capacity. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2018_04_01.models.IotHubCapacity """ _validation = { @@ -1152,7 +1154,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1186,10 +1188,10 @@ class IotHubSkuInfo(msrest.serialization.Model): :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", "B1", "B2", "B3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2018_04_01.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", "Basic". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1228,7 +1230,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2018_04_01.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1274,10 +1276,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2018_04_01.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2018_04_01.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1329,7 +1331,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1358,7 +1360,7 @@ class MatchedRoute(msrest.serialization.Model): """Routes that matched. :param properties: Properties of routes that matched. - :type properties: ~azure.mgmt.iothub.models.RouteProperties + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.RouteProperties """ _attribute_map = { @@ -1378,12 +1380,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1448,7 +1450,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2018_04_01.models.OperationDisplay """ _validation = { @@ -1539,7 +1541,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2018_04_01.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1567,7 +1569,7 @@ class OperationsMonitoringProperties(msrest.serialization.Model): """The operations monitoring properties for the IoT hub. The possible keys to the dictionary are Connections, DeviceTelemetry, C2DCommands, DeviceIdentityOperations, FileUploadOperations, Routes, D2CTwinOperations, C2DTwinOperations, TwinQueries, JobsOperations, DirectMethods. :param events: Dictionary of :code:``. - :type events: dict[str, str or ~azure.mgmt.iothub.models.OperationMonitoringLevel] + :type events: dict[str, str or ~azure.mgmt.iothub.v2018_04_01.models.OperationMonitoringLevel] """ _attribute_map = { @@ -1625,9 +1627,9 @@ class RouteCompilationError(msrest.serialization.Model): :param message: Route error message. :type message: str :param severity: Severity of the route error. Possible values include: "error", "warning". - :type severity: str or ~azure.mgmt.iothub.models.RouteErrorSeverity + :type severity: str or ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorSeverity :param location: Location where the route error happened. - :type location: ~azure.mgmt.iothub.models.RouteErrorRange + :type location: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorRange """ _attribute_map = { @@ -1680,9 +1682,9 @@ class RouteErrorRange(msrest.serialization.Model): """Range of route errors. :param start: Start where the route error happened. - :type start: ~azure.mgmt.iothub.models.RouteErrorPosition + :type start: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorPosition :param end: End where the route error happened. - :type end: ~azure.mgmt.iothub.models.RouteErrorPosition + :type end: ~azure.mgmt.iothub.v2018_04_01.models.RouteErrorPosition """ _attribute_map = { @@ -1714,7 +1716,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1765,17 +1767,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2018_04_01.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2018_04_01.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2018_04_01.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2018_04_01.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1885,16 +1888,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2018_04_01.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2018_04_01.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2018_04_01.models.FallbackRouteProperties """ _attribute_map = { @@ -2094,20 +2097,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: object + :type tags: str :param properties: - :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + :type properties: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[object] = None, + tags: Optional[str] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2120,21 +2123,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired_properties: Twin desired properties. - :type desired_properties: object + :type desired_properties: str :param reported_properties: Twin desired properties. - :type reported_properties: object + :type reported_properties: str """ _attribute_map = { - 'desired_properties': {'key': 'desiredProperties', 'type': 'object'}, - 'reported_properties': {'key': 'reportedProperties', 'type': 'object'}, + 'desired_properties': {'key': 'desiredProperties', 'type': 'str'}, + 'reported_properties': {'key': 'reportedProperties', 'type': 'str'}, } def __init__( self, *, - desired_properties: Optional[object] = None, - reported_properties: Optional[object] = None, + desired_properties: Optional[str] = None, + reported_properties: Optional[str] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) @@ -2160,7 +2163,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2018_04_01.models.AccessRights """ _validation = { @@ -2197,7 +2200,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -2228,8 +2231,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. @@ -2290,11 +2293,11 @@ class TestAllRoutesInput(msrest.serialization.Model): :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource + :type routing_source: str or ~azure.mgmt.iothub.v2018_04_01.models.RoutingSource :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2018_04_01.models.RoutingMessage :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwin """ _attribute_map = { @@ -2321,7 +2324,7 @@ class TestAllRoutesResult(msrest.serialization.Model): """Result of testing all routes. :param routes: JSON-serialized array of matched routes. - :type routes: list[~azure.mgmt.iothub.models.MatchedRoute] + :type routes: list[~azure.mgmt.iothub.v2018_04_01.models.MatchedRoute] """ _attribute_map = { @@ -2344,11 +2347,11 @@ class TestRouteInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2018_04_01.models.RoutingMessage :param route: Required. Route properties. - :type route: ~azure.mgmt.iothub.models.RouteProperties + :type route: ~azure.mgmt.iothub.v2018_04_01.models.RouteProperties :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwin """ _validation = { @@ -2379,9 +2382,9 @@ class TestRouteResult(msrest.serialization.Model): """Result of testing one route. :param result: Result of testing route. Possible values include: "undefined", "false", "true". - :type result: str or ~azure.mgmt.iothub.models.TestResultStatus + :type result: str or ~azure.mgmt.iothub.v2018_04_01.models.TestResultStatus :param details: Detailed result of testing route. - :type details: ~azure.mgmt.iothub.models.TestRouteResultDetails + :type details: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteResultDetails """ _attribute_map = { @@ -2405,7 +2408,7 @@ class TestRouteResultDetails(msrest.serialization.Model): """Detailed result of testing a route. :param compilation_errors: JSON-serialized list of route compilation errors. - :type compilation_errors: list[~azure.mgmt.iothub.models.RouteCompilationError] + :type compilation_errors: list[~azure.mgmt.iothub.v2018_04_01.models.RouteCompilationError] """ _attribute_map = { @@ -2436,7 +2439,7 @@ class UserSubscriptionQuota(msrest.serialization.Model): :param limit: Numerical limit on IotHub type. :type limit: int :param name: IotHub type. - :type name: ~azure.mgmt.iothub.models.Name + :type name: ~azure.mgmt.iothub.v2018_04_01.models.Name """ _attribute_map = { @@ -2474,7 +2477,7 @@ class UserSubscriptionQuotaListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: - :type value: list[~azure.mgmt.iothub.models.UserSubscriptionQuota] + :type value: list[~azure.mgmt.iothub.v2018_04_01.models.UserSubscriptionQuota] :ivar next_link: :vartype next_link: str """ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py index a3de7b893803..bb33c114ae39 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_certificates_operations.py @@ -29,7 +29,7 @@ class CertificatesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -61,7 +61,7 @@ def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -95,7 +95,7 @@ def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -126,7 +126,7 @@ def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -161,7 +161,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -193,13 +193,13 @@ def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2018_04_01.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -241,7 +241,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -315,7 +315,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -347,7 +347,7 @@ def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -383,7 +383,7 @@ def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -418,10 +418,10 @@ def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2018_04_01.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -462,7 +462,7 @@ def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py index dc6b5e4bd402..cf2e2c7a5757 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py @@ -32,7 +32,7 @@ class IotHubResourceOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,7 +64,7 @@ def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -156,7 +156,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -184,25 +184,27 @@ def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -323,15 +325,15 @@ def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2018_04_01.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -386,12 +388,10 @@ def _delete_initial( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["_models.IotHubDescription"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2018-04-01" @@ -418,9 +418,9 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -430,6 +430,9 @@ def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -442,7 +445,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.IotHubDescription"] + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] """Delete an IoT hub. Delete an IoT hub. @@ -453,16 +456,16 @@ def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -517,7 +520,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -565,7 +568,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -590,7 +593,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_04_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -639,7 +642,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -667,7 +670,7 @@ def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -701,7 +704,7 @@ def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -729,7 +732,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_04_01.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -779,7 +782,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -811,7 +814,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -862,7 +865,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -896,7 +899,7 @@ def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -932,7 +935,7 @@ def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -966,7 +969,7 @@ def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -1002,7 +1005,7 @@ def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1072,7 +1075,7 @@ def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1098,7 +1101,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_04_01.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1148,7 +1151,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1180,7 +1183,7 @@ def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1215,7 +1218,7 @@ def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1243,7 +1246,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_04_01.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1293,7 +1296,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1321,7 +1324,7 @@ def get_endpoint_health( :type iot_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EndpointHealthDataListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_04_01.models.EndpointHealthDataListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] @@ -1371,7 +1374,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1394,10 +1397,10 @@ def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2018_04_01.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1434,7 +1437,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1462,10 +1465,10 @@ def test_all_routes( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Input for testing all routes. - :type input: ~azure.mgmt.iothub.models.TestAllRoutesInput + :type input: ~azure.mgmt.iothub.v2018_04_01.models.TestAllRoutesInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestAllRoutesResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestAllRoutesResult + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.TestAllRoutesResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] @@ -1504,7 +1507,7 @@ def test_all_routes( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) @@ -1532,10 +1535,10 @@ def test_route( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Route that needs to be tested. - :type input: ~azure.mgmt.iothub.models.TestRouteInput + :type input: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestRouteResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestRouteResult + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.TestRouteResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] @@ -1574,7 +1577,7 @@ def test_route( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestRouteResult', pipeline_response) @@ -1603,7 +1606,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1653,7 +1656,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1685,7 +1688,7 @@ def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1720,7 +1723,7 @@ def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1742,18 +1745,18 @@ def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2018_04_01.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1792,7 +1795,7 @@ def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1814,18 +1817,18 @@ def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2018_04_01.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1864,7 +1867,7 @@ def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py index 88993af48e3b..56cbb8f8603b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_operations.py @@ -30,7 +30,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2018_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py index 19346d1ded9c..563d41bf8ee8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_resource_provider_common_operations.py @@ -29,7 +29,7 @@ class ResourceProviderCommonOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2018_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -55,7 +55,7 @@ def get_subscription_quota( :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSubscriptionQuotaListResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.UserSubscriptionQuotaListResult + :rtype: ~azure.mgmt.iothub.v2018_04_01.models.UserSubscriptionQuotaListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] @@ -87,7 +87,7 @@ def get_subscription_quota( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py index 03d5edfa9ec0..afb5e82a33be 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_iot_hub_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import IotHubClientConfiguration from .operations import Operations @@ -30,15 +31,15 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.operations.Operations + :vartype operations: azure.mgmt.iothub.v2019_03_22.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2019_03_22.operations.IotHubResourceOperations :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: azure.mgmt.iothub.operations.ResourceProviderCommonOperations + :vartype resource_provider_common: azure.mgmt.iothub.v2019_03_22.operations.ResourceProviderCommonOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2019_03_22.operations.CertificatesOperations :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.operations.IotHubOperations + :vartype iot_hub: azure.mgmt.iothub.v2019_03_22.operations.IotHubOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. @@ -76,6 +77,24 @@ def __init__( self.iot_hub = IotHubOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json index eeb57595b5e8..55db6dc09a6e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription identifier.", "docstring_type": "str", "required": true @@ -42,14 +44,58 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", @@ -57,9 +103,5 @@ "resource_provider_common": "ResourceProviderCommonOperations", "certificates": "CertificatesOperations", "iot_hub": "IotHubOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py index e5754a47ce68..ba617b3fa777 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "0.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py index ae994eecb9e3..f93a57bde18e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/_iot_hub_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -28,15 +29,15 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.aio.operations.Operations + :vartype operations: azure.mgmt.iothub.v2019_03_22.aio.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.aio.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2019_03_22.aio.operations.IotHubResourceOperations :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: azure.mgmt.iothub.aio.operations.ResourceProviderCommonOperations + :vartype resource_provider_common: azure.mgmt.iothub.v2019_03_22.aio.operations.ResourceProviderCommonOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2019_03_22.aio.operations.CertificatesOperations :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.aio.operations.IotHubOperations + :vartype iot_hub: azure.mgmt.iothub.v2019_03_22.aio.operations.IotHubOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. @@ -73,6 +74,23 @@ def __init__( self.iot_hub = IotHubOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py index c29f7a410b72..cb3ee9059642 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py @@ -25,7 +25,7 @@ class CertificatesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -56,7 +56,7 @@ async def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -90,7 +90,7 @@ async def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -120,7 +120,7 @@ async def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -155,7 +155,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -186,13 +186,13 @@ async def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2019_03_22.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -234,7 +234,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -307,7 +307,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,7 +338,7 @@ async def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -374,7 +374,7 @@ async def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -408,10 +408,10 @@ async def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2019_03_22.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -452,7 +452,7 @@ async def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py index a278998c592d..f01e44a77654 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py @@ -27,7 +27,7 @@ class IotHubOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -85,7 +85,7 @@ async def _manual_failover_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -112,11 +112,11 @@ async def begin_manual_failover( :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see https://aka.ms/manualfailover/region. - :type failover_input: ~azure.mgmt.iothub.models.FailoverInput + :type failover_input: ~azure.mgmt.iothub.v2019_03_22.models.FailoverInput :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py index ac8baef3ced6..6721dfe911b5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py @@ -28,7 +28,7 @@ class IotHubResourceOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ async def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -150,7 +150,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -177,25 +177,27 @@ async def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -314,15 +316,15 @@ async def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2019_03_22.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -376,12 +378,10 @@ async def _delete_initial( resource_group_name: str, resource_name: str, **kwargs - ) -> Optional["_models.IotHubDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-03-22" @@ -408,9 +408,9 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -420,6 +420,9 @@ async def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -431,7 +434,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, **kwargs - ) -> AsyncLROPoller["_models.IotHubDescription"]: + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. Delete an IoT hub. @@ -442,16 +445,16 @@ async def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -505,7 +508,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -553,7 +556,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -577,7 +580,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -626,7 +629,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -653,7 +656,7 @@ async def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -687,7 +690,7 @@ async def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -714,7 +717,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -764,7 +767,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -795,7 +798,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -846,7 +849,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -879,7 +882,7 @@ async def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -915,7 +918,7 @@ async def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -948,7 +951,7 @@ async def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -984,7 +987,7 @@ async def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1053,7 +1056,7 @@ async def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1078,7 +1081,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_03_22.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1128,7 +1131,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1159,7 +1162,7 @@ async def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1194,7 +1197,7 @@ async def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1221,7 +1224,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_03_22.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1271,7 +1274,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1298,7 +1301,7 @@ def get_endpoint_health( :type iot_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EndpointHealthDataListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_03_22.models.EndpointHealthDataListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] @@ -1348,7 +1351,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1370,10 +1373,10 @@ async def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2019_03_22.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1410,7 +1413,7 @@ async def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1437,10 +1440,10 @@ async def test_all_routes( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Input for testing all routes. - :type input: ~azure.mgmt.iothub.models.TestAllRoutesInput + :type input: ~azure.mgmt.iothub.v2019_03_22.models.TestAllRoutesInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestAllRoutesResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestAllRoutesResult + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.TestAllRoutesResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] @@ -1479,7 +1482,7 @@ async def test_all_routes( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) @@ -1506,10 +1509,10 @@ async def test_route( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Route that needs to be tested. - :type input: ~azure.mgmt.iothub.models.TestRouteInput + :type input: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestRouteResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestRouteResult + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] @@ -1548,7 +1551,7 @@ async def test_route( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestRouteResult', pipeline_response) @@ -1576,7 +1579,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1626,7 +1629,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1657,7 +1660,7 @@ async def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1692,7 +1695,7 @@ async def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1713,18 +1716,18 @@ async def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2019_03_22.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1763,7 +1766,7 @@ async def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1784,18 +1787,18 @@ async def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2019_03_22.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1834,7 +1837,7 @@ async def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py index c65dd4700d2c..767d94699063 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py @@ -26,7 +26,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,7 +49,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_03_22.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -93,7 +93,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py index 51666cfc6a5e..6e0eaaa66f08 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py @@ -25,7 +25,7 @@ class ResourceProviderCommonOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -50,7 +50,7 @@ async def get_subscription_quota( :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSubscriptionQuotaListResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.UserSubscriptionQuotaListResult + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.UserSubscriptionQuotaListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] @@ -82,7 +82,7 @@ async def get_subscription_quota( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models.py index b0617c7df2e6..b8c0e90a3bc3 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models.py @@ -36,7 +36,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -78,7 +78,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription] """ _attribute_map = { @@ -235,7 +235,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -277,15 +277,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2019_03_22.models.FeedbackProperties """ _validation = { @@ -323,7 +323,7 @@ class EndpointHealthData(msrest.serialization.Model): the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected from this endpoint. Possible values include: "unknown", "healthy", "unhealthy", "dead". - :type health_status: str or ~azure.mgmt.iothub.models.EndpointHealthStatus + :type health_status: str or ~azure.mgmt.iothub.v2019_03_22.models.EndpointHealthStatus """ _attribute_map = { @@ -346,7 +346,7 @@ class EndpointHealthDataListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: JSON-serialized array of Endpoint health data. - :type value: list[~azure.mgmt.iothub.models.EndpointHealthData] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.EndpointHealthData] :ivar next_link: Link to more results. :vartype next_link: str """ @@ -459,7 +459,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -491,8 +491,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -595,7 +595,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -640,12 +640,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -712,7 +712,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubScaleType """ _validation = { @@ -807,9 +807,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: IotHub properties. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.IotHubProperties :param sku: Required. IotHub SKU info. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuInfo """ _validation = { @@ -847,7 +847,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -879,7 +879,7 @@ class IotHubLocationDescription(msrest.serialization.Model): where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. Possible values include: "primary", "secondary". - :type role: str or ~azure.mgmt.iothub.models.IotHubReplicaRoleType + :type role: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubReplicaRoleType """ _attribute_map = { @@ -905,7 +905,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -939,9 +939,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2019_03_22.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -951,30 +951,32 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible keys to this dictionary is events. This key has to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2019_03_22.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2019_03_22.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_03_22.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_03_22.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2019_03_22.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2019_03_22.models.Capabilities :ivar locations: Primary and secondary location for iot hub. - :vartype locations: list[~azure.mgmt.iothub.models.IotHubLocationDescription] + :vartype locations: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubLocationDescription] """ _validation = { @@ -1063,7 +1065,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1096,9 +1098,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuInfo :param capacity: Required. IotHub capacity. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2019_03_22.models.IotHubCapacity """ _validation = { @@ -1129,7 +1131,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1161,10 +1163,10 @@ class IotHubSkuInfo(msrest.serialization.Model): :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", "B1", "B2", "B3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", "Basic". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1200,7 +1202,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2019_03_22.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1242,10 +1244,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2019_03_22.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2019_03_22.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1297,7 +1299,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1324,7 +1326,7 @@ class MatchedRoute(msrest.serialization.Model): """Routes that matched. :param properties: Properties of routes that matched. - :type properties: ~azure.mgmt.iothub.models.RouteProperties + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.RouteProperties """ _attribute_map = { @@ -1342,12 +1344,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1405,7 +1407,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2019_03_22.models.OperationDisplay """ _validation = { @@ -1497,7 +1499,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2019_03_22.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1562,9 +1564,9 @@ class RouteCompilationError(msrest.serialization.Model): :param message: Route error message. :type message: str :param severity: Severity of the route error. Possible values include: "error", "warning". - :type severity: str or ~azure.mgmt.iothub.models.RouteErrorSeverity + :type severity: str or ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorSeverity :param location: Location where the route error happened. - :type location: ~azure.mgmt.iothub.models.RouteErrorRange + :type location: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorRange """ _attribute_map = { @@ -1610,9 +1612,9 @@ class RouteErrorRange(msrest.serialization.Model): """Range of route errors. :param start: Start where the route error happened. - :type start: ~azure.mgmt.iothub.models.RouteErrorPosition + :type start: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorPosition :param end: End where the route error happened. - :type end: ~azure.mgmt.iothub.models.RouteErrorPosition + :type end: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorPosition """ _attribute_map = { @@ -1641,7 +1643,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1686,17 +1688,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2019_03_22.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2019_03_22.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2019_03_22.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2019_03_22.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1792,16 +1795,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2019_03_22.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2019_03_22.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2019_03_22.models.FallbackRouteProperties """ _attribute_map = { @@ -1935,7 +1938,8 @@ class RoutingStorageContainerProperties(msrest.serialization.Model): :param encoding: Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", "AvroDeflate", "JSON". - :type encoding: str or ~azure.mgmt.iothub.models.RoutingStorageContainerPropertiesEncoding + :type encoding: str or + ~azure.mgmt.iothub.v2019_03_22.models.RoutingStorageContainerPropertiesEncoding """ _validation = { @@ -1978,13 +1982,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: object + :type tags: str :param properties: - :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -2001,14 +2005,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: object + :type desired: str :param reported: Twin desired properties. - :type reported: object + :type reported: str """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, } def __init__( @@ -2038,7 +2042,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2019_03_22.models.AccessRights """ _validation = { @@ -2070,7 +2074,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -2099,8 +2103,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. @@ -2155,11 +2159,11 @@ class TestAllRoutesInput(msrest.serialization.Model): :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource + :type routing_source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2019_03_22.models.RoutingMessage :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwin """ _attribute_map = { @@ -2182,7 +2186,7 @@ class TestAllRoutesResult(msrest.serialization.Model): """Result of testing all routes. :param routes: JSON-serialized array of matched routes. - :type routes: list[~azure.mgmt.iothub.models.MatchedRoute] + :type routes: list[~azure.mgmt.iothub.v2019_03_22.models.MatchedRoute] """ _attribute_map = { @@ -2203,11 +2207,11 @@ class TestRouteInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2019_03_22.models.RoutingMessage :param route: Required. Route properties. - :type route: ~azure.mgmt.iothub.models.RouteProperties + :type route: ~azure.mgmt.iothub.v2019_03_22.models.RouteProperties :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwin """ _validation = { @@ -2234,9 +2238,9 @@ class TestRouteResult(msrest.serialization.Model): """Result of testing one route. :param result: Result of testing route. Possible values include: "undefined", "false", "true". - :type result: str or ~azure.mgmt.iothub.models.TestResultStatus + :type result: str or ~azure.mgmt.iothub.v2019_03_22.models.TestResultStatus :param details: Detailed result of testing route. - :type details: ~azure.mgmt.iothub.models.TestRouteResultDetails + :type details: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteResultDetails """ _attribute_map = { @@ -2257,7 +2261,7 @@ class TestRouteResultDetails(msrest.serialization.Model): """Detailed result of testing a route. :param compilation_errors: JSON-serialized list of route compilation errors. - :type compilation_errors: list[~azure.mgmt.iothub.models.RouteCompilationError] + :type compilation_errors: list[~azure.mgmt.iothub.v2019_03_22.models.RouteCompilationError] """ _attribute_map = { @@ -2286,7 +2290,7 @@ class UserSubscriptionQuota(msrest.serialization.Model): :param limit: Numerical limit on IotHub type. :type limit: int :param name: IotHub type. - :type name: ~azure.mgmt.iothub.models.Name + :type name: ~azure.mgmt.iothub.v2019_03_22.models.Name """ _attribute_map = { @@ -2317,7 +2321,7 @@ class UserSubscriptionQuotaListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: - :type value: list[~azure.mgmt.iothub.models.UserSubscriptionQuota] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.UserSubscriptionQuota] :ivar next_link: :vartype next_link: str """ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py index bbe71453ec88..f9c35a23e451 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py @@ -43,7 +43,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -87,7 +87,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription] """ _attribute_map = { @@ -250,7 +250,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -294,15 +294,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2019_03_22.models.FeedbackProperties """ _validation = { @@ -344,7 +344,7 @@ class EndpointHealthData(msrest.serialization.Model): the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected from this endpoint. Possible values include: "unknown", "healthy", "unhealthy", "dead". - :type health_status: str or ~azure.mgmt.iothub.models.EndpointHealthStatus + :type health_status: str or ~azure.mgmt.iothub.v2019_03_22.models.EndpointHealthStatus """ _attribute_map = { @@ -370,7 +370,7 @@ class EndpointHealthDataListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: JSON-serialized array of Endpoint health data. - :type value: list[~azure.mgmt.iothub.models.EndpointHealthData] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.EndpointHealthData] :ivar next_link: Link to more results. :vartype next_link: str """ @@ -487,7 +487,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -521,8 +521,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -633,7 +633,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -684,12 +684,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -763,7 +763,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubScaleType """ _validation = { @@ -861,9 +861,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: IotHub properties. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.IotHubProperties :param sku: Required. IotHub SKU info. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuInfo """ _validation = { @@ -907,7 +907,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -941,7 +941,7 @@ class IotHubLocationDescription(msrest.serialization.Model): where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. Possible values include: "primary", "secondary". - :type role: str or ~azure.mgmt.iothub.models.IotHubReplicaRoleType + :type role: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubReplicaRoleType """ _attribute_map = { @@ -970,7 +970,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -1006,9 +1006,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2019_03_22.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -1018,30 +1018,32 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible keys to this dictionary is events. This key has to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2019_03_22.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2019_03_22.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_03_22.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_03_22.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2019_03_22.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2019_03_22.models.Capabilities :ivar locations: Primary and secondary location for iot hub. - :vartype locations: list[~azure.mgmt.iothub.models.IotHubLocationDescription] + :vartype locations: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubLocationDescription] """ _validation = { @@ -1141,7 +1143,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1176,9 +1178,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuInfo :param capacity: Required. IotHub capacity. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2019_03_22.models.IotHubCapacity """ _validation = { @@ -1212,7 +1214,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1246,10 +1248,10 @@ class IotHubSkuInfo(msrest.serialization.Model): :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", "B1", "B2", "B3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", "Basic". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1288,7 +1290,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2019_03_22.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1334,10 +1336,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2019_03_22.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2019_03_22.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1389,7 +1391,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1418,7 +1420,7 @@ class MatchedRoute(msrest.serialization.Model): """Routes that matched. :param properties: Properties of routes that matched. - :type properties: ~azure.mgmt.iothub.models.RouteProperties + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.RouteProperties """ _attribute_map = { @@ -1438,12 +1440,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1508,7 +1510,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2019_03_22.models.OperationDisplay """ _validation = { @@ -1604,7 +1606,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2019_03_22.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1669,9 +1671,9 @@ class RouteCompilationError(msrest.serialization.Model): :param message: Route error message. :type message: str :param severity: Severity of the route error. Possible values include: "error", "warning". - :type severity: str or ~azure.mgmt.iothub.models.RouteErrorSeverity + :type severity: str or ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorSeverity :param location: Location where the route error happened. - :type location: ~azure.mgmt.iothub.models.RouteErrorRange + :type location: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorRange """ _attribute_map = { @@ -1724,9 +1726,9 @@ class RouteErrorRange(msrest.serialization.Model): """Range of route errors. :param start: Start where the route error happened. - :type start: ~azure.mgmt.iothub.models.RouteErrorPosition + :type start: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorPosition :param end: End where the route error happened. - :type end: ~azure.mgmt.iothub.models.RouteErrorPosition + :type end: ~azure.mgmt.iothub.v2019_03_22.models.RouteErrorPosition """ _attribute_map = { @@ -1758,7 +1760,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1809,17 +1811,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2019_03_22.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2019_03_22.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2019_03_22.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2019_03_22.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1929,16 +1932,16 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2019_03_22.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2019_03_22.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2019_03_22.models.FallbackRouteProperties """ _attribute_map = { @@ -2086,7 +2089,8 @@ class RoutingStorageContainerProperties(msrest.serialization.Model): :param encoding: Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", "AvroDeflate", "JSON". - :type encoding: str or ~azure.mgmt.iothub.models.RoutingStorageContainerPropertiesEncoding + :type encoding: str or + ~azure.mgmt.iothub.v2019_03_22.models.RoutingStorageContainerPropertiesEncoding """ _validation = { @@ -2139,20 +2143,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: object + :type tags: str :param properties: - :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + :type properties: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[object] = None, + tags: Optional[str] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2165,21 +2169,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: object + :type desired: str :param reported: Twin desired properties. - :type reported: object + :type reported: str """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, } def __init__( self, *, - desired: Optional[object] = None, - reported: Optional[object] = None, + desired: Optional[str] = None, + reported: Optional[str] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) @@ -2205,7 +2209,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2019_03_22.models.AccessRights """ _validation = { @@ -2242,7 +2246,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -2273,8 +2277,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. @@ -2335,11 +2339,11 @@ class TestAllRoutesInput(msrest.serialization.Model): :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource + :type routing_source: str or ~azure.mgmt.iothub.v2019_03_22.models.RoutingSource :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2019_03_22.models.RoutingMessage :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwin """ _attribute_map = { @@ -2366,7 +2370,7 @@ class TestAllRoutesResult(msrest.serialization.Model): """Result of testing all routes. :param routes: JSON-serialized array of matched routes. - :type routes: list[~azure.mgmt.iothub.models.MatchedRoute] + :type routes: list[~azure.mgmt.iothub.v2019_03_22.models.MatchedRoute] """ _attribute_map = { @@ -2389,11 +2393,11 @@ class TestRouteInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2019_03_22.models.RoutingMessage :param route: Required. Route properties. - :type route: ~azure.mgmt.iothub.models.RouteProperties + :type route: ~azure.mgmt.iothub.v2019_03_22.models.RouteProperties :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwin """ _validation = { @@ -2424,9 +2428,9 @@ class TestRouteResult(msrest.serialization.Model): """Result of testing one route. :param result: Result of testing route. Possible values include: "undefined", "false", "true". - :type result: str or ~azure.mgmt.iothub.models.TestResultStatus + :type result: str or ~azure.mgmt.iothub.v2019_03_22.models.TestResultStatus :param details: Detailed result of testing route. - :type details: ~azure.mgmt.iothub.models.TestRouteResultDetails + :type details: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteResultDetails """ _attribute_map = { @@ -2450,7 +2454,7 @@ class TestRouteResultDetails(msrest.serialization.Model): """Detailed result of testing a route. :param compilation_errors: JSON-serialized list of route compilation errors. - :type compilation_errors: list[~azure.mgmt.iothub.models.RouteCompilationError] + :type compilation_errors: list[~azure.mgmt.iothub.v2019_03_22.models.RouteCompilationError] """ _attribute_map = { @@ -2481,7 +2485,7 @@ class UserSubscriptionQuota(msrest.serialization.Model): :param limit: Numerical limit on IotHub type. :type limit: int :param name: IotHub type. - :type name: ~azure.mgmt.iothub.models.Name + :type name: ~azure.mgmt.iothub.v2019_03_22.models.Name """ _attribute_map = { @@ -2519,7 +2523,7 @@ class UserSubscriptionQuotaListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: - :type value: list[~azure.mgmt.iothub.models.UserSubscriptionQuota] + :type value: list[~azure.mgmt.iothub.v2019_03_22.models.UserSubscriptionQuota] :ivar next_link: :vartype next_link: str """ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py index 65c8e5fceb7b..8d9b4615329e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_certificates_operations.py @@ -29,7 +29,7 @@ class CertificatesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -61,7 +61,7 @@ def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -95,7 +95,7 @@ def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -126,7 +126,7 @@ def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -161,7 +161,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -193,13 +193,13 @@ def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2019_03_22.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -241,7 +241,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -315,7 +315,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -347,7 +347,7 @@ def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -383,7 +383,7 @@ def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -418,10 +418,10 @@ def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2019_03_22.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -462,7 +462,7 @@ def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py index 23c7d1eabe29..28329370db17 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py @@ -31,7 +31,7 @@ class IotHubOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -90,7 +90,7 @@ def _manual_failover_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -118,11 +118,11 @@ def begin_manual_failover( :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see https://aka.ms/manualfailover/region. - :type failover_input: ~azure.mgmt.iothub.models.FailoverInput + :type failover_input: ~azure.mgmt.iothub.v2019_03_22.models.FailoverInput :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py index fab2bc5919a0..a6dce212eef9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py @@ -32,7 +32,7 @@ class IotHubResourceOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,7 +64,7 @@ def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -156,7 +156,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -184,25 +184,27 @@ def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -323,15 +325,15 @@ def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2019_03_22.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -386,12 +388,10 @@ def _delete_initial( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["_models.IotHubDescription"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-03-22" @@ -418,9 +418,9 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -430,6 +430,9 @@ def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -442,7 +445,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.IotHubDescription"] + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] """Delete an IoT hub. Delete an IoT hub. @@ -453,16 +456,16 @@ def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -517,7 +520,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -565,7 +568,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -590,7 +593,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_03_22.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -639,7 +642,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -667,7 +670,7 @@ def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -701,7 +704,7 @@ def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -729,7 +732,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_03_22.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -779,7 +782,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -811,7 +814,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -862,7 +865,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -896,7 +899,7 @@ def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -932,7 +935,7 @@ def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -966,7 +969,7 @@ def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -1002,7 +1005,7 @@ def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1072,7 +1075,7 @@ def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1098,7 +1101,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_03_22.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1148,7 +1151,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1180,7 +1183,7 @@ def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1215,7 +1218,7 @@ def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1243,7 +1246,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_03_22.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1293,7 +1296,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1321,7 +1324,7 @@ def get_endpoint_health( :type iot_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EndpointHealthDataListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_03_22.models.EndpointHealthDataListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] @@ -1371,7 +1374,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1394,10 +1397,10 @@ def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2019_03_22.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1434,7 +1437,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1462,10 +1465,10 @@ def test_all_routes( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Input for testing all routes. - :type input: ~azure.mgmt.iothub.models.TestAllRoutesInput + :type input: ~azure.mgmt.iothub.v2019_03_22.models.TestAllRoutesInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestAllRoutesResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestAllRoutesResult + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.TestAllRoutesResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] @@ -1504,7 +1507,7 @@ def test_all_routes( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) @@ -1532,10 +1535,10 @@ def test_route( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Route that needs to be tested. - :type input: ~azure.mgmt.iothub.models.TestRouteInput + :type input: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestRouteResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestRouteResult + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.TestRouteResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] @@ -1574,7 +1577,7 @@ def test_route( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestRouteResult', pipeline_response) @@ -1603,7 +1606,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1653,7 +1656,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1685,7 +1688,7 @@ def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1720,7 +1723,7 @@ def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1742,18 +1745,18 @@ def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2019_03_22.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1792,7 +1795,7 @@ def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1814,18 +1817,18 @@ def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2019_03_22.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1864,7 +1867,7 @@ def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py index a950911db570..9d502342d248 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_operations.py @@ -30,7 +30,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_03_22.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py index 4fb8e0c91578..9e5df89897da 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_resource_provider_common_operations.py @@ -29,7 +29,7 @@ class ResourceProviderCommonOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_03_22.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -55,7 +55,7 @@ def get_subscription_quota( :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSubscriptionQuotaListResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.UserSubscriptionQuotaListResult + :rtype: ~azure.mgmt.iothub.v2019_03_22.models.UserSubscriptionQuotaListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] @@ -87,7 +87,7 @@ def get_subscription_quota( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py new file mode 100644 index 000000000000..8883d8041fab --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._iot_hub_client import IotHubClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['IotHubClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py new file mode 100644 index 000000000000..6a35364fe0fd --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class IotHubClientConfiguration(Configuration): + """Configuration for IotHubClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotHubClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-07-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py new file mode 100644 index 000000000000..2c1d9c91c1fb --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_iot_hub_client.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import IotHubClientConfiguration +from .operations import Operations +from .operations import IotHubResourceOperations +from .operations import ResourceProviderCommonOperations +from .operations import CertificatesOperations +from .operations import IotHubOperations +from . import models + + +class IotHubClient(object): + """Use this API to manage the IoT hubs in your Azure subscription. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothub.v2019_07_01_preview.operations.Operations + :ivar iot_hub_resource: IotHubResourceOperations operations + :vartype iot_hub_resource: azure.mgmt.iothub.v2019_07_01_preview.operations.IotHubResourceOperations + :ivar resource_provider_common: ResourceProviderCommonOperations operations + :vartype resource_provider_common: azure.mgmt.iothub.v2019_07_01_preview.operations.ResourceProviderCommonOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.iothub.v2019_07_01_preview.operations.CertificatesOperations + :ivar iot_hub: IotHubOperations operations + :vartype iot_hub: azure.mgmt.iothub.v2019_07_01_preview.operations.IotHubOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, 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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub_resource = IotHubResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_provider_common = ResourceProviderCommonOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub = IotHubOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> IotHubClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json new file mode 100644 index 000000000000..5cf978bb9225 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_metadata.json @@ -0,0 +1,107 @@ +{ + "chosen_version": "2019-07-01-preview", + "total_api_version_list": ["2019-07-01-preview"], + "client": { + "name": "IotHubClient", + "filename": "_iot_hub_client", + "description": "Use this API to manage the IoT hubs in your Azure subscription.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "iot_hub_resource": "IotHubResourceOperations", + "resource_provider_common": "ResourceProviderCommonOperations", + "certificates": "CertificatesOperations", + "iot_hub": "IotHubOperations" + } +} \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py new file mode 100644 index 000000000000..ba617b3fa777 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py new file mode 100644 index 000000000000..a84cf700a930 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._iot_hub_client import IotHubClient +__all__ = ['IotHubClient'] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..f2211de659ad --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class IotHubClientConfiguration(Configuration): + """Configuration for IotHubClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotHubClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-07-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py new file mode 100644 index 000000000000..e14c3d1d3665 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/_iot_hub_client.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import IotHubClientConfiguration +from .operations import Operations +from .operations import IotHubResourceOperations +from .operations import ResourceProviderCommonOperations +from .operations import CertificatesOperations +from .operations import IotHubOperations +from .. import models + + +class IotHubClient(object): + """Use this API to manage the IoT hubs in your Azure subscription. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothub.v2019_07_01_preview.aio.operations.Operations + :ivar iot_hub_resource: IotHubResourceOperations operations + :vartype iot_hub_resource: azure.mgmt.iothub.v2019_07_01_preview.aio.operations.IotHubResourceOperations + :ivar resource_provider_common: ResourceProviderCommonOperations operations + :vartype resource_provider_common: azure.mgmt.iothub.v2019_07_01_preview.aio.operations.ResourceProviderCommonOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.iothub.v2019_07_01_preview.aio.operations.CertificatesOperations + :ivar iot_hub: IotHubOperations operations + :vartype iot_hub: azure.mgmt.iothub.v2019_07_01_preview.aio.operations.IotHubOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, 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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub_resource = IotHubResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_provider_common = ResourceProviderCommonOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub = IotHubOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "IotHubClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..b95fca917d02 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._operations import Operations +from ._iot_hub_resource_operations import IotHubResourceOperations +from ._resource_provider_common_operations import ResourceProviderCommonOperations +from ._certificates_operations import CertificatesOperations +from ._iot_hub_operations import IotHubOperations + +__all__ = [ + 'Operations', + 'IotHubResourceOperations', + 'ResourceProviderCommonOperations', + 'CertificatesOperations', + 'IotHubOperations', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py new file mode 100644 index 000000000000..fbbb35d4a06f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py @@ -0,0 +1,464 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_by_iot_hub( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.CertificateListDescription": + """Get the certificate list. + + Returns the list of certificates. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_iot_hub.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_iot_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + **kwargs + ) -> "_models.CertificateDescription": + """Get the certificate. + + Returns the certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + certificate_description: "_models.CertificateBodyDescription", + if_match: Optional[str] = None, + **kwargs + ) -> "_models.CertificateDescription": + """Upload the certificate to the IoT hub. + + Adds new or replaces existing certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateBodyDescription + :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. + Required to update an existing certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_description, 'CertificateBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + **kwargs + ) -> None: + """Delete an X509 certificate. + + Deletes an existing X509 certificate or does nothing if it does not exist. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def generate_verification_code( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + **kwargs + ) -> "_models.CertificateWithNonceDescription": + """Generate verification code for proof of possession flow. + + Generates verification code for proof of possession flow. The verification code will be used to + generate a leaf certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateWithNonceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateWithNonceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + async def verify( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + certificate_verification_body: "_models.CertificateVerificationDescription", + **kwargs + ) -> "_models.CertificateDescription": + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :param certificate_verification_body: The name of the certificate. + :type certificate_verification_body: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateVerificationDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py new file mode 100644 index 000000000000..b63469b630c0 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py @@ -0,0 +1,164 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IotHubOperations: + """IotHubOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _manual_failover_initial( + self, + iot_hub_name: str, + resource_group_name: str, + failover_input: "_models.FailoverInput", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._manual_failover_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(failover_input, 'FailoverInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + 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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _manual_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore + + async def begin_manual_failover( + self, + iot_hub_name: str, + resource_group_name: str, + failover_input: "_models.FailoverInput", + **kwargs + ) -> AsyncLROPoller[None]: + """Manual Failover Fail over. + + Perform manual fail over of given hub. + + :param iot_hub_name: IotHub to fail over. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param failover_input: Region to failover to. Must be a azure DR pair. + :type failover_input: ~azure.mgmt.iothub.v2019_07_01_preview.models.FailoverInput + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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 = await self._manual_failover_initial( + iot_hub_name=iot_hub_name, + resource_group_name=resource_group_name, + failover_input=failover_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_manual_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py new file mode 100644 index 000000000000..692350d82ee1 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py @@ -0,0 +1,1849 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IotHubResourceOperations: + """IotHubResourceOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.IotHubDescription": + """Get the non-security related metadata of an IoT hub. + + Get the non-security related metadata of an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + iot_hub_description: "_models.IotHubDescription", + if_match: Optional[str] = None, + **kwargs + ) -> "_models.IotHubDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_description, 'IotHubDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + iot_hub_description: "_models.IotHubDescription", + if_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["_models.IotHubDescription"]: + """Create or update the metadata of an IoT hub. + + Create or update the metadata of an Iot hub. The usual pattern to modify a property is to + retrieve the IoT hub metadata and security metadata, and then combine them with the modified + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param iot_hub_description: The IoT hub metadata and security metadata. + :type iot_hub_description: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription + :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required + to update an existing IoT Hub. + :type if_match: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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 = await self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_description=iot_hub_description, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + iot_hub_tags: "_models.TagsResource", + **kwargs + ) -> "_models.IotHubDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + iot_hub_tags: "_models.TagsResource", + **kwargs + ) -> AsyncLROPoller["_models.IotHubDescription"]: + """Update an existing IoT Hubs tags. + + Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param resource_name: Name of iot hub to update. + :type resource_name: str + :param iot_hub_tags: Updated tag information to set into the iot hub instance. + :type iot_hub_tags: ~azure.mgmt.iothub.v2019_07_01_preview.models.TagsResource + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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 = await self._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_tags=iot_hub_tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + """Delete an IoT hub. + + Delete an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + 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 = await self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: + """Get all the IoT hubs in a subscription. + + Get all the IoT hubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: + """Get all the IoT hubs in a resource group. + + Get all the IoT hubs in a resource group. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + async def get_stats( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.RegistryStatistics": + """Get the statistics from an IoT hub. + + Get the statistics from an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryStatistics, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.RegistryStatistics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_stats.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryStatistics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + + def get_valid_skus( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: + """Get the list of valid SKUs for an IoT hub. + + Get the list of valid SKUs for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_valid_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubSkuDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + + def list_event_hub_consumer_groups( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + **kwargs + ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: + """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + + Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an + IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint. + :type event_hub_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_event_hub_consumer_groups.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubConsumerGroupsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_event_hub_consumer_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'} # type: ignore + + async def get_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + **kwargs + ) -> "_models.EventHubConsumerGroupInfo": + """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to retrieve. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + async def create_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + **kwargs + ) -> "_models.EventHubConsumerGroupInfo": + """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to add. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.create_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + async def delete_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + **kwargs + ) -> None: + """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to delete. + :type name: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def list_jobs( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.JobResponseListResult"]: + """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get a list of all the jobs in an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResponseListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('JobResponseListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + + async def get_job( + self, + resource_group_name: str, + resource_name: str, + job_id: str, + **kwargs + ) -> "_models.JobResponse": + """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get the details of a job from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param job_id: The job identifier. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_job.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + + def get_quota_metrics( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: + """Get the quota metrics for an IoT hub. + + Get the quota metrics for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubQuotaMetricInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_quota_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubQuotaMetricInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + + def get_endpoint_health( + self, + resource_group_name: str, + iot_hub_name: str, + **kwargs + ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: + """Get the health for routing endpoints. + + Get the health for routing endpoints. + + :param resource_group_name: + :type resource_group_name: str + :param iot_hub_name: + :type iot_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.EndpointHealthDataListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_endpoint_health.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EndpointHealthDataListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_endpoint_health.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth'} # type: ignore + + async def check_name_availability( + self, + operation_inputs: "_models.OperationInputs", + **kwargs + ) -> "_models.IotHubNameAvailabilityInfo": + """Check if an IoT hub name is available. + + Check if an IoT hub name is available. + + :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of + the IoT hub to check. + :type operation_inputs: ~azure.mgmt.iothub.v2019_07_01_preview.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubNameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubNameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(operation_inputs, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + + async def test_all_routes( + self, + iot_hub_name: str, + resource_group_name: str, + input: "_models.TestAllRoutesInput", + **kwargs + ) -> "_models.TestAllRoutesResult": + """Test all routes. + + Test all routes configured in this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Input for testing all routes. + :type input: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestAllRoutesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestAllRoutesResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestAllRoutesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_all_routes.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestAllRoutesInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_all_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'} # type: ignore + + async def test_route( + self, + iot_hub_name: str, + resource_group_name: str, + input: "_models.TestRouteInput", + **kwargs + ) -> "_models.TestRouteResult": + """Test the new route. + + Test the new route for this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Route that needs to be tested. + :type input: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestRouteResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_route.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestRouteInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestRouteResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'} # type: ignore + + def list_keys( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: + """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get the security metadata for an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + + async def get_keys_for_key_name( + self, + resource_group_name: str, + resource_name: str, + key_name: str, + **kwargs + ) -> "_models.SharedAccessSignatureAuthorizationRule": + """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get a shared access policy by name from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param key_name: The name of the shared access policy. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_keys_for_key_name.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + + async def export_devices( + self, + resource_group_name: str, + resource_name: str, + export_devices_parameters: "_models.ExportDevicesRequest", + **kwargs + ) -> "_models.JobResponse": + """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Exports all the device identities in the IoT hub identity registry to an Azure Storage blob + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param export_devices_parameters: The parameters that specify the export devices operation. + :type export_devices_parameters: ~azure.mgmt.iothub.v2019_07_01_preview.models.ExportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.export_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + + async def import_devices( + self, + resource_group_name: str, + resource_name: str, + import_devices_parameters: "_models.ImportDevicesRequest", + **kwargs + ) -> "_models.JobResponse": + """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Import, update, or delete device identities in the IoT hub identity registry from a blob. For + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param import_devices_parameters: The parameters that specify the import devices operation. + :type import_devices_parameters: ~azure.mgmt.iothub.v2019_07_01_preview.models.ImportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..72444286966c --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available IoT Hub REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py new file mode 100644 index 000000000000..efc6e9c852c3 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceProviderCommonOperations: + """ResourceProviderCommonOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_subscription_quota( + self, + **kwargs + ) -> "_models.UserSubscriptionQuotaListResult": + """Get the number of iot hubs in the subscription. + + Get the number of free and paid iot hubs in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSubscriptionQuotaListResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.UserSubscriptionQuotaListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_subscription_quota.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_quota.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py new file mode 100644 index 000000000000..58f68bc2924e --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/__init__.py @@ -0,0 +1,250 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import CertificateBodyDescription + from ._models_py3 import CertificateDescription + from ._models_py3 import CertificateListDescription + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificatePropertiesWithNonce + from ._models_py3 import CertificateVerificationDescription + from ._models_py3 import CertificateWithNonceDescription + from ._models_py3 import CloudToDeviceProperties + from ._models_py3 import EndpointHealthData + from ._models_py3 import EndpointHealthDataListResult + from ._models_py3 import EnrichmentProperties + from ._models_py3 import ErrorDetails + from ._models_py3 import EventHubConsumerGroupInfo + from ._models_py3 import EventHubConsumerGroupsListResult + from ._models_py3 import EventHubProperties + from ._models_py3 import ExportDevicesRequest + from ._models_py3 import FailoverInput + from ._models_py3 import FallbackRouteProperties + from ._models_py3 import FeedbackProperties + from ._models_py3 import ImportDevicesRequest + from ._models_py3 import IotHubCapacity + from ._models_py3 import IotHubDescription + from ._models_py3 import IotHubDescriptionListResult + from ._models_py3 import IotHubLocationDescription + from ._models_py3 import IotHubNameAvailabilityInfo + from ._models_py3 import IotHubProperties + from ._models_py3 import IotHubPropertiesDeviceStreams + from ._models_py3 import IotHubQuotaMetricInfo + from ._models_py3 import IotHubQuotaMetricInfoListResult + from ._models_py3 import IotHubSkuDescription + from ._models_py3 import IotHubSkuDescriptionListResult + from ._models_py3 import IotHubSkuInfo + from ._models_py3 import IpFilterRule + from ._models_py3 import JobResponse + from ._models_py3 import JobResponseListResult + from ._models_py3 import MatchedRoute + from ._models_py3 import MessagingEndpointProperties + from ._models_py3 import Name + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationInputs + from ._models_py3 import OperationListResult + from ._models_py3 import RegistryStatistics + from ._models_py3 import Resource + from ._models_py3 import RouteCompilationError + from ._models_py3 import RouteErrorPosition + from ._models_py3 import RouteErrorRange + from ._models_py3 import RouteProperties + from ._models_py3 import RoutingEndpoints + from ._models_py3 import RoutingEventHubProperties + from ._models_py3 import RoutingMessage + from ._models_py3 import RoutingProperties + from ._models_py3 import RoutingServiceBusQueueEndpointProperties + from ._models_py3 import RoutingServiceBusTopicEndpointProperties + from ._models_py3 import RoutingStorageContainerProperties + from ._models_py3 import RoutingTwin + from ._models_py3 import RoutingTwinProperties + from ._models_py3 import SharedAccessSignatureAuthorizationRule + from ._models_py3 import SharedAccessSignatureAuthorizationRuleListResult + from ._models_py3 import StorageEndpointProperties + from ._models_py3 import TagsResource + from ._models_py3 import TestAllRoutesInput + from ._models_py3 import TestAllRoutesResult + from ._models_py3 import TestRouteInput + from ._models_py3 import TestRouteResult + from ._models_py3 import TestRouteResultDetails + from ._models_py3 import UserSubscriptionQuota + from ._models_py3 import UserSubscriptionQuotaListResult +except (SyntaxError, ImportError): + from ._models import CertificateBodyDescription # type: ignore + from ._models import CertificateDescription # type: ignore + from ._models import CertificateListDescription # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificatePropertiesWithNonce # type: ignore + from ._models import CertificateVerificationDescription # type: ignore + from ._models import CertificateWithNonceDescription # type: ignore + from ._models import CloudToDeviceProperties # type: ignore + from ._models import EndpointHealthData # type: ignore + from ._models import EndpointHealthDataListResult # type: ignore + from ._models import EnrichmentProperties # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import EventHubConsumerGroupInfo # type: ignore + from ._models import EventHubConsumerGroupsListResult # type: ignore + from ._models import EventHubProperties # type: ignore + from ._models import ExportDevicesRequest # type: ignore + from ._models import FailoverInput # type: ignore + from ._models import FallbackRouteProperties # type: ignore + from ._models import FeedbackProperties # type: ignore + from ._models import ImportDevicesRequest # type: ignore + from ._models import IotHubCapacity # type: ignore + from ._models import IotHubDescription # type: ignore + from ._models import IotHubDescriptionListResult # type: ignore + from ._models import IotHubLocationDescription # type: ignore + from ._models import IotHubNameAvailabilityInfo # type: ignore + from ._models import IotHubProperties # type: ignore + from ._models import IotHubPropertiesDeviceStreams # type: ignore + from ._models import IotHubQuotaMetricInfo # type: ignore + from ._models import IotHubQuotaMetricInfoListResult # type: ignore + from ._models import IotHubSkuDescription # type: ignore + from ._models import IotHubSkuDescriptionListResult # type: ignore + from ._models import IotHubSkuInfo # type: ignore + from ._models import IpFilterRule # type: ignore + from ._models import JobResponse # type: ignore + from ._models import JobResponseListResult # type: ignore + from ._models import MatchedRoute # type: ignore + from ._models import MessagingEndpointProperties # type: ignore + from ._models import Name # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationInputs # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import RegistryStatistics # type: ignore + from ._models import Resource # type: ignore + from ._models import RouteCompilationError # type: ignore + from ._models import RouteErrorPosition # type: ignore + from ._models import RouteErrorRange # type: ignore + from ._models import RouteProperties # type: ignore + from ._models import RoutingEndpoints # type: ignore + from ._models import RoutingEventHubProperties # type: ignore + from ._models import RoutingMessage # type: ignore + from ._models import RoutingProperties # type: ignore + from ._models import RoutingServiceBusQueueEndpointProperties # type: ignore + from ._models import RoutingServiceBusTopicEndpointProperties # type: ignore + from ._models import RoutingStorageContainerProperties # type: ignore + from ._models import RoutingTwin # type: ignore + from ._models import RoutingTwinProperties # type: ignore + from ._models import SharedAccessSignatureAuthorizationRule # type: ignore + from ._models import SharedAccessSignatureAuthorizationRuleListResult # type: ignore + from ._models import StorageEndpointProperties # type: ignore + from ._models import TagsResource # type: ignore + from ._models import TestAllRoutesInput # type: ignore + from ._models import TestAllRoutesResult # type: ignore + from ._models import TestRouteInput # type: ignore + from ._models import TestRouteResult # type: ignore + from ._models import TestRouteResultDetails # type: ignore + from ._models import UserSubscriptionQuota # type: ignore + from ._models import UserSubscriptionQuotaListResult # type: ignore + +from ._iot_hub_client_enums import ( + AccessRights, + Capabilities, + EndpointHealthStatus, + IotHubNameUnavailabilityReason, + IotHubReplicaRoleType, + IotHubScaleType, + IotHubSku, + IotHubSkuTier, + IpFilterActionType, + JobStatus, + JobType, + RouteErrorSeverity, + RoutingSource, + RoutingStorageContainerPropertiesEncoding, + TestResultStatus, +) + +__all__ = [ + 'CertificateBodyDescription', + 'CertificateDescription', + 'CertificateListDescription', + 'CertificateProperties', + 'CertificatePropertiesWithNonce', + 'CertificateVerificationDescription', + 'CertificateWithNonceDescription', + 'CloudToDeviceProperties', + 'EndpointHealthData', + 'EndpointHealthDataListResult', + 'EnrichmentProperties', + 'ErrorDetails', + 'EventHubConsumerGroupInfo', + 'EventHubConsumerGroupsListResult', + 'EventHubProperties', + 'ExportDevicesRequest', + 'FailoverInput', + 'FallbackRouteProperties', + 'FeedbackProperties', + 'ImportDevicesRequest', + 'IotHubCapacity', + 'IotHubDescription', + 'IotHubDescriptionListResult', + 'IotHubLocationDescription', + 'IotHubNameAvailabilityInfo', + 'IotHubProperties', + 'IotHubPropertiesDeviceStreams', + 'IotHubQuotaMetricInfo', + 'IotHubQuotaMetricInfoListResult', + 'IotHubSkuDescription', + 'IotHubSkuDescriptionListResult', + 'IotHubSkuInfo', + 'IpFilterRule', + 'JobResponse', + 'JobResponseListResult', + 'MatchedRoute', + 'MessagingEndpointProperties', + 'Name', + 'Operation', + 'OperationDisplay', + 'OperationInputs', + 'OperationListResult', + 'RegistryStatistics', + 'Resource', + 'RouteCompilationError', + 'RouteErrorPosition', + 'RouteErrorRange', + 'RouteProperties', + 'RoutingEndpoints', + 'RoutingEventHubProperties', + 'RoutingMessage', + 'RoutingProperties', + 'RoutingServiceBusQueueEndpointProperties', + 'RoutingServiceBusTopicEndpointProperties', + 'RoutingStorageContainerProperties', + 'RoutingTwin', + 'RoutingTwinProperties', + 'SharedAccessSignatureAuthorizationRule', + 'SharedAccessSignatureAuthorizationRuleListResult', + 'StorageEndpointProperties', + 'TagsResource', + 'TestAllRoutesInput', + 'TestAllRoutesResult', + 'TestRouteInput', + 'TestRouteResult', + 'TestRouteResultDetails', + 'UserSubscriptionQuota', + 'UserSubscriptionQuotaListResult', + 'AccessRights', + 'Capabilities', + 'EndpointHealthStatus', + 'IotHubNameUnavailabilityReason', + 'IotHubReplicaRoleType', + 'IotHubScaleType', + 'IotHubSku', + 'IotHubSkuTier', + 'IpFilterActionType', + 'JobStatus', + 'JobType', + 'RouteErrorSeverity', + 'RoutingSource', + 'RoutingStorageContainerPropertiesEncoding', + 'TestResultStatus', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_iot_hub_client_enums.py new file mode 100644 index 000000000000..f76bc658dd59 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_iot_hub_client_enums.py @@ -0,0 +1,181 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The permissions assigned to the shared access policy. + """ + + REGISTRY_READ = "RegistryRead" + REGISTRY_WRITE = "RegistryWrite" + SERVICE_CONNECT = "ServiceConnect" + DEVICE_CONNECT = "DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE = "RegistryRead, RegistryWrite" + REGISTRY_READ_SERVICE_CONNECT = "RegistryRead, ServiceConnect" + REGISTRY_READ_DEVICE_CONNECT = "RegistryRead, DeviceConnect" + REGISTRY_WRITE_SERVICE_CONNECT = "RegistryWrite, ServiceConnect" + REGISTRY_WRITE_DEVICE_CONNECT = "RegistryWrite, DeviceConnect" + SERVICE_CONNECT_DEVICE_CONNECT = "ServiceConnect, DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT = "RegistryRead, RegistryWrite, ServiceConnect" + REGISTRY_READ_REGISTRY_WRITE_DEVICE_CONNECT = "RegistryRead, RegistryWrite, DeviceConnect" + REGISTRY_READ_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryRead, ServiceConnect, DeviceConnect" + REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryWrite, ServiceConnect, DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" + +class Capabilities(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The capabilities and features enabled for the IoT hub. + """ + + NONE = "None" + DEVICE_MANAGEMENT = "DeviceManagement" + +class EndpointHealthStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Health statuses have following meanings. The 'healthy' status shows that the endpoint is + accepting messages as expected. The 'unhealthy' status shows that the endpoint is not accepting + messages as expected and IoT Hub is retrying to send data to this endpoint. The status of an + unhealthy endpoint will be updated to healthy when IoT Hub has established an eventually + consistent state of health. The 'dead' status shows that the endpoint is not accepting + messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub metrics to + identify errors and monitor issues with endpoints. The 'unknown' status shows that the IoT Hub + has not established a connection with the endpoint. No messages have been delivered to or + rejected from this endpoint + """ + + UNKNOWN = "unknown" + HEALTHY = "healthy" + UNHEALTHY = "unhealthy" + DEAD = "dead" + +class IotHubNameUnavailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The reason for unavailability. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class IotHubReplicaRoleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specific Role assigned to this location + """ + + PRIMARY = "primary" + SECONDARY = "secondary" + +class IotHubScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the scaling enabled. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + NONE = "None" + +class IotHubSku(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the SKU. + """ + + F1 = "F1" + S1 = "S1" + S2 = "S2" + S3 = "S3" + B1 = "B1" + B2 = "B2" + B3 = "B3" + +class IotHubSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier for the IoT hub. + """ + + FREE = "Free" + STANDARD = "Standard" + BASIC = "Basic" + +class IpFilterActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The desired action for requests captured by this rule. + """ + + ACCEPT = "Accept" + REJECT = "Reject" + +class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the job. + """ + + UNKNOWN = "unknown" + ENQUEUED = "enqueued" + RUNNING = "running" + COMPLETED = "completed" + FAILED = "failed" + CANCELLED = "cancelled" + +class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the job. + """ + + UNKNOWN = "unknown" + EXPORT = "export" + IMPORT_ENUM = "import" + BACKUP = "backup" + READ_DEVICE_PROPERTIES = "readDeviceProperties" + WRITE_DEVICE_PROPERTIES = "writeDeviceProperties" + UPDATE_DEVICE_CONFIGURATION = "updateDeviceConfiguration" + REBOOT_DEVICE = "rebootDevice" + FACTORY_RESET_DEVICE = "factoryResetDevice" + FIRMWARE_UPDATE = "firmwareUpdate" + +class RouteErrorSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Severity of the route error + """ + + ERROR = "error" + WARNING = "warning" + +class RoutingSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The source that the routing rule is to be applied to, such as DeviceMessages. + """ + + INVALID = "Invalid" + DEVICE_MESSAGES = "DeviceMessages" + TWIN_CHANGE_EVENTS = "TwinChangeEvents" + DEVICE_LIFECYCLE_EVENTS = "DeviceLifecycleEvents" + DEVICE_JOB_LIFECYCLE_EVENTS = "DeviceJobLifecycleEvents" + DIGITAL_TWIN_CHANGE_EVENTS = "DigitalTwinChangeEvents" + +class RoutingStorageContainerPropertiesEncoding(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Encoding that is used to serialize messages to blobs. Supported values are 'avro', + 'avrodeflate', and 'JSON'. Default value is 'avro'. + """ + + AVRO = "Avro" + AVRO_DEFLATE = "AvroDeflate" + JSON = "JSON" + +class TestResultStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Result of testing route + """ + + UNDEFINED = "undefined" + FALSE = "false" + TRUE = "true" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models.py new file mode 100644 index 000000000000..2c9b6d3bacf3 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models.py @@ -0,0 +1,2413 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + + +class CertificateDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate. + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateDescription, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :param certificate: The certificate content. + :type certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.certificate = kwargs.get('certificate', None) + + +class CertificatePropertiesWithNonce(msrest.serialization.Model): + """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :ivar verification_code: The certificate's verification code that will be used for proof of + possession. + :vartype verification_code: str + :ivar certificate: The certificate content. + :vartype certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'verification_code': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificatePropertiesWithNonce, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.verification_code = None + self.certificate = None + + +class CertificateVerificationDescription(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateVerificationDescription, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + + +class CertificateWithNonceDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate including the challenge nonce + issued for the Proof-Of-Possession flow. + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificatePropertiesWithNonce + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificatePropertiesWithNonce'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateWithNonceDescription, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CloudToDeviceProperties(msrest.serialization.Model): + """The IoT hub cloud-to-device messaging properties. + + :param max_delivery_count: The max delivery count for cloud-to-device messages in the device + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type default_ttl_as_iso8601: ~datetime.timedelta + :param feedback: The properties of the feedback queue for cloud-to-device messages. + :type feedback: ~azure.mgmt.iothub.v2019_07_01_preview.models.FeedbackProperties + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + 'default_ttl_as_iso8601': {'key': 'defaultTtlAsIso8601', 'type': 'duration'}, + 'feedback': {'key': 'feedback', 'type': 'FeedbackProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudToDeviceProperties, self).__init__(**kwargs) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.default_ttl_as_iso8601 = kwargs.get('default_ttl_as_iso8601', None) + self.feedback = kwargs.get('feedback', None) + + +class EndpointHealthData(msrest.serialization.Model): + """The health data for an endpoint. + + :param endpoint_id: Id of the endpoint. + :type endpoint_id: str + :param health_status: Health statuses have following meanings. The 'healthy' status shows that + the endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint + is not accepting messages as expected and IoT Hub is retrying to send data to this endpoint. + The status of an unhealthy endpoint will be updated to healthy when IoT Hub has established an + eventually consistent state of health. The 'dead' status shows that the endpoint is not + accepting messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub + metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + the IoT Hub has not established a connection with the endpoint. No messages have been delivered + to or rejected from this endpoint. Possible values include: "unknown", "healthy", "unhealthy", + "dead". + :type health_status: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.EndpointHealthStatus + """ + + _attribute_map = { + 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, + 'health_status': {'key': 'healthStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointHealthData, self).__init__(**kwargs) + self.endpoint_id = kwargs.get('endpoint_id', None) + self.health_status = kwargs.get('health_status', None) + + +class EndpointHealthDataListResult(msrest.serialization.Model): + """The JSON-serialized array of EndpointHealthData objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: JSON-serialized array of Endpoint health data. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EndpointHealthData] + :ivar next_link: Link to more results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EndpointHealthData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointHealthDataListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class EnrichmentProperties(msrest.serialization.Model): + """The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key or name for the enrichment property. + :type key: str + :param value: Required. The value for the enrichment property. + :type value: str + :param endpoint_names: Required. The list of endpoints for which the enrichment is applied to + the message. + :type endpoint_names: list[str] + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'endpoint_names': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(EnrichmentProperties, self).__init__(**kwargs) + self.key = kwargs['key'] + self.value = kwargs['value'] + self.endpoint_names = kwargs['endpoint_names'] + + +class ErrorDetails(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class EventHubConsumerGroupInfo(msrest.serialization.Model): + """The properties of the EventHubConsumerGroupInfo object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The tags. + :type properties: dict[str, str] + :ivar id: The Event Hub-compatible consumer group identifier. + :vartype id: str + :ivar name: The Event Hub-compatible consumer group name. + :vartype name: str + :ivar type: the resource type. + :vartype type: str + :ivar etag: The etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupInfo, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.type = None + self.etag = None + + +class EventHubConsumerGroupsListResult(msrest.serialization.Model): + """The JSON-serialized array of Event Hub-compatible consumer group names with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of consumer groups objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventHubConsumerGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class EventHubProperties(msrest.serialization.Model): + """The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param retention_time_in_days: The retention time for device-to-cloud messages in days. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type retention_time_in_days: long + :param partition_count: The number of partitions for receiving device-to-cloud messages in the + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type partition_count: int + :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. + :vartype partition_ids: list[str] + :ivar path: The Event Hub-compatible name. + :vartype path: str + :ivar endpoint: The Event Hub-compatible endpoint. + :vartype endpoint: str + """ + + _validation = { + 'partition_ids': {'readonly': True}, + 'path': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'retention_time_in_days': {'key': 'retentionTimeInDays', 'type': 'long'}, + 'partition_count': {'key': 'partitionCount', 'type': 'int'}, + 'partition_ids': {'key': 'partitionIds', 'type': '[str]'}, + 'path': {'key': 'path', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubProperties, self).__init__(**kwargs) + self.retention_time_in_days = kwargs.get('retention_time_in_days', None) + self.partition_count = kwargs.get('partition_count', None) + self.partition_ids = None + self.path = None + self.endpoint = None + + +class ExportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an export of all devices in the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param export_blob_container_uri: Required. The export blob container URI. + :type export_blob_container_uri: str + :param exclude_keys: Required. The value indicating whether keys should be excluded during + export. + :type exclude_keys: bool + """ + + _validation = { + 'export_blob_container_uri': {'required': True}, + 'exclude_keys': {'required': True}, + } + + _attribute_map = { + 'export_blob_container_uri': {'key': 'exportBlobContainerUri', 'type': 'str'}, + 'exclude_keys': {'key': 'excludeKeys', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportDevicesRequest, self).__init__(**kwargs) + self.export_blob_container_uri = kwargs['export_blob_container_uri'] + self.exclude_keys = kwargs['exclude_keys'] + + +class FailoverInput(msrest.serialization.Model): + """Use to provide failover region when requesting manual Failover for a hub. + + All required parameters must be populated in order to send to Azure. + + :param failover_region: Required. Region the hub will be failed over to. + :type failover_region: str + """ + + _validation = { + 'failover_region': {'required': True}, + } + + _attribute_map = { + 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FailoverInput, self).__init__(**kwargs) + self.failover_region = kwargs['failover_region'] + + +class FallbackRouteProperties(msrest.serialization.Model): + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the route. The name can only include alphanumeric characters, periods, + underscores, hyphens, has a maximum length of 64 characters, and must be unique. + :type name: str + :param source: Required. The source to which the routing rule is to be applied to. For example, + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DigitalTwinChangeEvents". + :type source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource + :param condition: The condition which is evaluated in order to apply the fallback route. If the + condition is not provided it will evaluate to true by default. For grammar, See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which the messages that satisfy the + condition are routed to. Currently only 1 endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether the fallback route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(FallbackRouteProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.source = kwargs['source'] + self.condition = kwargs.get('condition', None) + self.endpoint_names = kwargs['endpoint_names'] + self.is_enabled = kwargs['is_enabled'] + + +class FeedbackProperties(msrest.serialization.Model): + """The properties of the feedback queue for cloud-to-device messages. + + :param lock_duration_as_iso8601: The lock duration for the feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(FeedbackProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = kwargs.get('lock_duration_as_iso8601', None) + self.ttl_as_iso8601 = kwargs.get('ttl_as_iso8601', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + + +class ImportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an import of all devices in the hub. + + All required parameters must be populated in order to send to Azure. + + :param input_blob_container_uri: Required. The input blob container URI. + :type input_blob_container_uri: str + :param output_blob_container_uri: Required. The output blob container URI. + :type output_blob_container_uri: str + """ + + _validation = { + 'input_blob_container_uri': {'required': True}, + 'output_blob_container_uri': {'required': True}, + } + + _attribute_map = { + 'input_blob_container_uri': {'key': 'inputBlobContainerUri', 'type': 'str'}, + 'output_blob_container_uri': {'key': 'outputBlobContainerUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportDevicesRequest, self).__init__(**kwargs) + self.input_blob_container_uri = kwargs['input_blob_container_uri'] + self.output_blob_container_uri = kwargs['output_blob_container_uri'] + + +class IotHubCapacity(msrest.serialization.Model): + """IoT Hub capacity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum number of units. + :vartype minimum: long + :ivar maximum: The maximum number of units. + :vartype maximum: long + :ivar default: The default number of units. + :vartype default: long + :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", + "Manual", "None". + :vartype scale_type: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubScaleType + """ + + _validation = { + 'minimum': {'readonly': True, 'maximum': 1, 'minimum': 1}, + 'maximum': {'readonly': True}, + 'default': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default': {'key': 'default', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default = None + self.scale_type = None + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class IotHubDescription(Resource): + """The description of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: IotHub properties. + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubProperties + :param sku: Required. IotHub SKU info. + :type sku: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotHubProperties'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDescription, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.properties = kwargs.get('properties', None) + self.sku = kwargs['sku'] + + +class IotHubDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubDescription objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDescriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubLocationDescription(msrest.serialization.Model): + """Public representation of one of the locations where a resource is provisioned. + + :param location: Azure Geo Regions. + :type location: str + :param role: Specific Role assigned to this location. Possible values include: "primary", + "secondary". + :type role: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubReplicaRoleType + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubLocationDescription, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.role = kwargs.get('role', None) + + +class IotHubNameAvailabilityInfo(msrest.serialization.Model): + """The properties indicating whether a given IoT hub name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: The value which indicates whether the provided name is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or + ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = kwargs.get('message', None) + + +class IotHubProperties(msrest.serialization.Model): + """The properties of an IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param authorization_policies: The shared access policies you can use to secure a connection to + the IoT hub. + :type authorization_policies: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule] + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IpFilterRule] + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :ivar state: The hub state. + :vartype state: str + :ivar host_name: The name of the host. + :vartype host_name: str + :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible + keys to this dictionary is events. This key has to be present in the dictionary while making + create or update calls for the IoT hub. + :type event_hub_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubProperties] + :param routing: The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + :type routing: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingProperties + :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. + Currently you can configure only one Azure Storage account and that MUST have its key as + $default. Specifying more than one storage account causes an error to be thrown. Not specifying + a value for this property when the enableFileUploadNotifications property is set to True, + causes an error to be thrown. + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_07_01_preview.models.StorageEndpointProperties] + :param messaging_endpoints: The messaging endpoint properties for the file upload notification + queue. + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_07_01_preview.models.MessagingEndpointProperties] + :param enable_file_upload_notifications: If True, file upload notifications are enabled. + :type enable_file_upload_notifications: bool + :param cloud_to_device: The IoT hub cloud-to-device messaging properties. + :type cloud_to_device: ~azure.mgmt.iothub.v2019_07_01_preview.models.CloudToDeviceProperties + :param comments: IoT hub comments. + :type comments: str + :param device_streams: The device streams properties of iothub. + :type device_streams: + ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubPropertiesDeviceStreams + :param features: The capabilities and features enabled for the IoT hub. Possible values + include: "None", "DeviceManagement". + :type features: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.Capabilities + :ivar locations: Primary and secondary location for iot hub. + :vartype locations: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubLocationDescription] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'host_name': {'readonly': True}, + 'locations': {'readonly': True}, + } + + _attribute_map = { + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'event_hub_endpoints': {'key': 'eventHubEndpoints', 'type': '{EventHubProperties}'}, + 'routing': {'key': 'routing', 'type': 'RoutingProperties'}, + 'storage_endpoints': {'key': 'storageEndpoints', 'type': '{StorageEndpointProperties}'}, + 'messaging_endpoints': {'key': 'messagingEndpoints', 'type': '{MessagingEndpointProperties}'}, + 'enable_file_upload_notifications': {'key': 'enableFileUploadNotifications', 'type': 'bool'}, + 'cloud_to_device': {'key': 'cloudToDevice', 'type': 'CloudToDeviceProperties'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'device_streams': {'key': 'deviceStreams', 'type': 'IotHubPropertiesDeviceStreams'}, + 'features': {'key': 'features', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[IotHubLocationDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubProperties, self).__init__(**kwargs) + self.authorization_policies = kwargs.get('authorization_policies', None) + self.ip_filter_rules = kwargs.get('ip_filter_rules', None) + self.provisioning_state = None + self.state = None + self.host_name = None + self.event_hub_endpoints = kwargs.get('event_hub_endpoints', None) + self.routing = kwargs.get('routing', None) + self.storage_endpoints = kwargs.get('storage_endpoints', None) + self.messaging_endpoints = kwargs.get('messaging_endpoints', None) + self.enable_file_upload_notifications = kwargs.get('enable_file_upload_notifications', None) + self.cloud_to_device = kwargs.get('cloud_to_device', None) + self.comments = kwargs.get('comments', None) + self.device_streams = kwargs.get('device_streams', None) + self.features = kwargs.get('features', None) + self.locations = None + + +class IotHubPropertiesDeviceStreams(msrest.serialization.Model): + """The device streams properties of iothub. + + :param streaming_endpoints: List of Device Streams Endpoints. + :type streaming_endpoints: list[str] + """ + + _attribute_map = { + 'streaming_endpoints': {'key': 'streamingEndpoints', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubPropertiesDeviceStreams, self).__init__(**kwargs) + self.streaming_endpoints = kwargs.get('streaming_endpoints', None) + + +class IotHubQuotaMetricInfo(msrest.serialization.Model): + """Quota metrics properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the quota metric. + :vartype name: str + :ivar current_value: The current value for the quota metric. + :vartype current_value: long + :ivar max_value: The maximum value of the quota metric. + :vartype max_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'current_value': {'readonly': True}, + 'max_value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'max_value': {'key': 'maxValue', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfo, self).__init__(**kwargs) + self.name = None + self.current_value = None + self.max_value = None + + +class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of quota metrics objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubQuotaMetricInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubQuotaMetricInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfoListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubSkuDescription(msrest.serialization.Model): + """SKU properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :param sku: Required. The type of the resource. + :type sku: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuInfo + :param capacity: Required. IotHub capacity. + :type capacity: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'required': True}, + 'capacity': {'required': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'capacity': {'key': 'capacity', 'type': 'IotHubCapacity'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.sku = kwargs['sku'] + self.capacity = kwargs['capacity'] + + +class IotHubSkuDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubSkuDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubSkuDescription. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubSkuDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuDescriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubSkuInfo(msrest.serialization.Model): + """Information about the SKU of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", + "B1", "B2", "B3". + :type name: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSku + :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", + "Basic". + :vartype tier: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuTier + :param capacity: The number of provisioned IoT Hub units. See: + https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + :type capacity: long + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuInfo, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = None + self.capacity = kwargs.get('capacity', None) + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = kwargs['filter_name'] + self.action = kwargs['action'] + self.ip_mask = kwargs['ip_mask'] + + +class JobResponse(msrest.serialization.Model): + """The properties of the Job Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_id: The job identifier. + :vartype job_id: str + :ivar start_time_utc: The start time of the job. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: The time the job stopped processing. + :vartype end_time_utc: ~datetime.datetime + :ivar type: The type of the job. Possible values include: "unknown", "export", "import", + "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", + "rebootDevice", "factoryResetDevice", "firmwareUpdate". + :vartype type: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.JobType + :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", + "completed", "failed", "cancelled". + :vartype status: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.JobStatus + :ivar failure_reason: If status == failed, this string containing the reason for the failure. + :vartype failure_reason: str + :ivar status_message: The status message for the job. + :vartype status_message: str + :ivar parent_job_id: The job identifier of the parent job, if any. + :vartype parent_job_id: str + """ + + _validation = { + 'job_id': {'readonly': True}, + 'start_time_utc': {'readonly': True}, + 'end_time_utc': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'status_message': {'readonly': True}, + 'parent_job_id': {'readonly': True}, + } + + _attribute_map = { + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'rfc-1123'}, + 'end_time_utc': {'key': 'endTimeUtc', 'type': 'rfc-1123'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'parent_job_id': {'key': 'parentJobId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.job_id = None + self.start_time_utc = None + self.end_time_utc = None + self.type = None + self.status = None + self.failure_reason = None + self.status_message = None + self.parent_job_id = None + + +class JobResponseListResult(msrest.serialization.Model): + """The JSON-serialized array of JobResponse objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of JobResponse objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JobResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponseListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class MatchedRoute(msrest.serialization.Model): + """Routes that matched. + + :param properties: Properties of routes that matched. + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RouteProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(MatchedRoute, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class MessagingEndpointProperties(msrest.serialization.Model): + """The properties of the messaging endpoints used by this IoT hub. + + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(MessagingEndpointProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = kwargs.get('lock_duration_as_iso8601', None) + self.ttl_as_iso8601 = kwargs.get('ttl_as_iso8601', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + + +class Name(msrest.serialization.Model): + """Name of Iot Hub type. + + :param value: IotHub type. + :type value: str + :param localized_value: Localized value of name. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Name, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class Operation(msrest.serialization.Model): + """IoT Hub REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothub.v2019_07_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: IotHubs. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationInputs(msrest.serialization.Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the IoT hub to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. + :vartype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class RegistryStatistics(msrest.serialization.Model): + """Identity registry statistics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_device_count: The total count of devices in the identity registry. + :vartype total_device_count: long + :ivar enabled_device_count: The count of enabled devices in the identity registry. + :vartype enabled_device_count: long + :ivar disabled_device_count: The count of disabled devices in the identity registry. + :vartype disabled_device_count: long + """ + + _validation = { + 'total_device_count': {'readonly': True}, + 'enabled_device_count': {'readonly': True}, + 'disabled_device_count': {'readonly': True}, + } + + _attribute_map = { + 'total_device_count': {'key': 'totalDeviceCount', 'type': 'long'}, + 'enabled_device_count': {'key': 'enabledDeviceCount', 'type': 'long'}, + 'disabled_device_count': {'key': 'disabledDeviceCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryStatistics, self).__init__(**kwargs) + self.total_device_count = None + self.enabled_device_count = None + self.disabled_device_count = None + + +class RouteCompilationError(msrest.serialization.Model): + """Compilation error when evaluating route. + + :param message: Route error message. + :type message: str + :param severity: Severity of the route error. Possible values include: "error", "warning". + :type severity: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorSeverity + :param location: Location where the route error happened. + :type location: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorRange + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'RouteErrorRange'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteCompilationError, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.severity = kwargs.get('severity', None) + self.location = kwargs.get('location', None) + + +class RouteErrorPosition(msrest.serialization.Model): + """Position where the route error happened. + + :param line: Line where the route error happened. + :type line: int + :param column: Column where the route error happened. + :type column: int + """ + + _attribute_map = { + 'line': {'key': 'line', 'type': 'int'}, + 'column': {'key': 'column', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteErrorPosition, self).__init__(**kwargs) + self.line = kwargs.get('line', None) + self.column = kwargs.get('column', None) + + +class RouteErrorRange(msrest.serialization.Model): + """Range of route errors. + + :param start: Start where the route error happened. + :type start: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorPosition + :param end: End where the route error happened. + :type end: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorPosition + """ + + _attribute_map = { + 'start': {'key': 'start', 'type': 'RouteErrorPosition'}, + 'end': {'key': 'end', 'type': 'RouteErrorPosition'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteErrorRange, self).__init__(**kwargs) + self.start = kwargs.get('start', None) + self.end = kwargs.get('end', None) + + +class RouteProperties(msrest.serialization.Model): + """The properties of a routing rule that your IoT hub uses to route messages to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route. The name can only include alphanumeric + characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be + unique. + :type name: str + :param source: Required. The source that the routing rule is to be applied to, such as + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DigitalTwinChangeEvents". + :type source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource + :param condition: The condition that is evaluated to apply the routing rule. If no condition is + provided, it evaluates to true by default. For grammar, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which messages that satisfy the + condition are routed. Currently only one endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether a route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteProperties, self).__init__(**kwargs) + self.name = kwargs['name'] + self.source = kwargs['source'] + self.condition = kwargs.get('condition', None) + self.endpoint_names = kwargs['endpoint_names'] + self.is_enabled = kwargs['is_enabled'] + + +class RoutingEndpoints(msrest.serialization.Model): + """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + + :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the + messages to, based on the routing rules. + :type service_bus_queues: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingServiceBusQueueEndpointProperties] + :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the + messages to, based on the routing rules. + :type service_bus_topics: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingServiceBusTopicEndpointProperties] + :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on + the routing rules. This list does not include the built-in Event Hubs endpoint. + :type event_hubs: list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingEventHubProperties] + :param storage_containers: The list of storage container endpoints that IoT hub routes messages + to, based on the routing rules. + :type storage_containers: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingStorageContainerProperties] + """ + + _attribute_map = { + 'service_bus_queues': {'key': 'serviceBusQueues', 'type': '[RoutingServiceBusQueueEndpointProperties]'}, + 'service_bus_topics': {'key': 'serviceBusTopics', 'type': '[RoutingServiceBusTopicEndpointProperties]'}, + 'event_hubs': {'key': 'eventHubs', 'type': '[RoutingEventHubProperties]'}, + 'storage_containers': {'key': 'storageContainers', 'type': '[RoutingStorageContainerProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingEndpoints, self).__init__(**kwargs) + self.service_bus_queues = kwargs.get('service_bus_queues', None) + self.service_bus_topics = kwargs.get('service_bus_topics', None) + self.event_hubs = kwargs.get('event_hubs', None) + self.storage_containers = kwargs.get('storage_containers', None) + + +class RoutingEventHubProperties(msrest.serialization.Model): + """The properties related to an event hub endpoint. + + All required parameters must be populated in order to send to Azure. + + :param connection_string: Required. The connection string of the event hub endpoint. + :type connection_string: str + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the event hub endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the event hub endpoint. + :type resource_group: str + """ + + _validation = { + 'connection_string': {'required': True}, + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingEventHubProperties, self).__init__(**kwargs) + self.connection_string = kwargs['connection_string'] + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingMessage(msrest.serialization.Model): + """Routing message. + + :param body: Body of routing message. + :type body: str + :param app_properties: App properties. + :type app_properties: dict[str, str] + :param system_properties: System properties. + :type system_properties: dict[str, str] + """ + + _attribute_map = { + 'body': {'key': 'body', 'type': 'str'}, + 'app_properties': {'key': 'appProperties', 'type': '{str}'}, + 'system_properties': {'key': 'systemProperties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingMessage, self).__init__(**kwargs) + self.body = kwargs.get('body', None) + self.app_properties = kwargs.get('app_properties', None) + self.system_properties = kwargs.get('system_properties', None) + + +class RoutingProperties(msrest.serialization.Model): + """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + + :param endpoints: The properties related to the custom endpoints to which your IoT hub routes + messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all + endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types + for free hubs. + :type endpoints: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingEndpoints + :param routes: The list of user-provided routing rules that the IoT hub uses to route messages + to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and + a maximum of 5 routing rules are allowed for free hubs. + :type routes: list[~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties] + :param fallback_route: The properties of the route that is used as a fall-back route when none + of the conditions specified in the 'routes' section are met. This is an optional parameter. + When this property is not set, the messages which do not meet any of the conditions specified + in the 'routes' section get routed to the built-in eventhub endpoint. + :type fallback_route: ~azure.mgmt.iothub.v2019_07_01_preview.models.FallbackRouteProperties + :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages + to be delivered to built-in and custom endpoints. See: https://aka.ms/iotmsgenrich. + :type enrichments: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EnrichmentProperties] + """ + + _attribute_map = { + 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, + 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, + 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, + 'enrichments': {'key': 'enrichments', 'type': '[EnrichmentProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingProperties, self).__init__(**kwargs) + self.endpoints = kwargs.get('endpoints', None) + self.routes = kwargs.get('routes', None) + self.fallback_route = kwargs.get('fallback_route', None) + self.enrichments = kwargs.get('enrichments', None) + + +class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): + """The properties related to service bus queue endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param connection_string: Required. The connection string of the service bus queue endpoint. + :type connection_string: str + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual queue + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus queue endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus queue endpoint. + :type resource_group: str + """ + + _validation = { + 'connection_string': {'required': True}, + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingServiceBusQueueEndpointProperties, self).__init__(**kwargs) + self.connection_string = kwargs['connection_string'] + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): + """The properties related to service bus topic endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param connection_string: Required. The connection string of the service bus topic endpoint. + :type connection_string: str + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual topic + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus topic endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus topic endpoint. + :type resource_group: str + """ + + _validation = { + 'connection_string': {'required': True}, + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingServiceBusTopicEndpointProperties, self).__init__(**kwargs) + self.connection_string = kwargs['connection_string'] + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingStorageContainerProperties(msrest.serialization.Model): + """The properties related to a storage container endpoint. + + All required parameters must be populated in order to send to Azure. + + :param connection_string: Required. The connection string of the storage account. + :type connection_string: str + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the storage account. + :type subscription_id: str + :param resource_group: The name of the resource group of the storage account. + :type resource_group: str + :param container_name: Required. The name of storage container in the storage account. + :type container_name: str + :param file_name_format: File name format for the blob. Default format is + {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be + reordered. + :type file_name_format: str + :param batch_frequency_in_seconds: Time interval at which blobs are written to storage. Value + should be between 60 and 720 seconds. Default value is 300 seconds. + :type batch_frequency_in_seconds: int + :param max_chunk_size_in_bytes: Maximum number of bytes for each blob written to storage. Value + should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + :type max_chunk_size_in_bytes: int + :param encoding: Encoding that is used to serialize messages to blobs. Supported values are + 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", + "AvroDeflate", "JSON". + :type encoding: str or + ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingStorageContainerPropertiesEncoding + """ + + _validation = { + 'connection_string': {'required': True}, + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'container_name': {'required': True}, + 'batch_frequency_in_seconds': {'maximum': 720, 'minimum': 60}, + 'max_chunk_size_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'file_name_format': {'key': 'fileNameFormat', 'type': 'str'}, + 'batch_frequency_in_seconds': {'key': 'batchFrequencyInSeconds', 'type': 'int'}, + 'max_chunk_size_in_bytes': {'key': 'maxChunkSizeInBytes', 'type': 'int'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingStorageContainerProperties, self).__init__(**kwargs) + self.connection_string = kwargs['connection_string'] + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + self.container_name = kwargs['container_name'] + self.file_name_format = kwargs.get('file_name_format', None) + self.batch_frequency_in_seconds = kwargs.get('batch_frequency_in_seconds', None) + self.max_chunk_size_in_bytes = kwargs.get('max_chunk_size_in_bytes', None) + self.encoding = kwargs.get('encoding', None) + + +class RoutingTwin(msrest.serialization.Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: A set of tags. Twin Tags. + :type tags: str + :param properties: + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingTwin, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class RoutingTwinProperties(msrest.serialization.Model): + """RoutingTwinProperties. + + :param desired: Twin desired properties. + :type desired: str + :param reported: Twin desired properties. + :type reported: str + """ + + _attribute_map = { + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired = kwargs.get('desired', None) + self.reported = kwargs.get('reported', None) + + +class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): + """The properties of an IoT hub shared access policy. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the shared access policy. + :type key_name: str + :param primary_key: The primary key. + :type primary_key: str + :param secondary_key: The secondary key. + :type secondary_key: str + :param rights: Required. The permissions assigned to the shared access policy. Possible values + include: "RegistryRead", "RegistryWrite", "ServiceConnect", "DeviceConnect", "RegistryRead, + RegistryWrite", "RegistryRead, ServiceConnect", "RegistryRead, DeviceConnect", "RegistryWrite, + ServiceConnect", "RegistryWrite, DeviceConnect", "ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", + "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". + :type rights: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.AccessRights + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRule, self).__init__(**kwargs) + self.key_name = kwargs['key_name'] + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.rights = kwargs['rights'] + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """The list of shared access policies with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class StorageEndpointProperties(msrest.serialization.Model): + """The properties of the Azure Storage endpoint for file upload. + + All required parameters must be populated in order to send to Azure. + + :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + :type sas_ttl_as_iso8601: ~datetime.timedelta + :param connection_string: Required. The connection string for the Azure Storage account to + which files are uploaded. + :type connection_string: str + :param container_name: Required. The name of the root container where you upload files. The + container need not exist but should be creatable using the connectionString specified. + :type container_name: str + """ + + _validation = { + 'connection_string': {'required': True}, + 'container_name': {'required': True}, + } + + _attribute_map = { + 'sas_ttl_as_iso8601': {'key': 'sasTtlAsIso8601', 'type': 'duration'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StorageEndpointProperties, self).__init__(**kwargs) + self.sas_ttl_as_iso8601 = kwargs.get('sas_ttl_as_iso8601', None) + self.connection_string = kwargs['connection_string'] + self.container_name = kwargs['container_name'] + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class TestAllRoutesInput(msrest.serialization.Model): + """Input for testing all routes. + + :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", + "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", + "DigitalTwinChangeEvents". + :type routing_source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingMessage + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwin + """ + + _attribute_map = { + 'routing_source': {'key': 'routingSource', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + **kwargs + ): + super(TestAllRoutesInput, self).__init__(**kwargs) + self.routing_source = kwargs.get('routing_source', None) + self.message = kwargs.get('message', None) + self.twin = kwargs.get('twin', None) + + +class TestAllRoutesResult(msrest.serialization.Model): + """Result of testing all routes. + + :param routes: JSON-serialized array of matched routes. + :type routes: list[~azure.mgmt.iothub.v2019_07_01_preview.models.MatchedRoute] + """ + + _attribute_map = { + 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestAllRoutesResult, self).__init__(**kwargs) + self.routes = kwargs.get('routes', None) + + +class TestRouteInput(msrest.serialization.Model): + """Input for testing route. + + All required parameters must be populated in order to send to Azure. + + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingMessage + :param route: Required. Route properties. + :type route: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwin + """ + + _validation = { + 'route': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteInput, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.route = kwargs['route'] + self.twin = kwargs.get('twin', None) + + +class TestRouteResult(msrest.serialization.Model): + """Result of testing one route. + + :param result: Result of testing route. Possible values include: "undefined", "false", "true". + :type result: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.TestResultStatus + :param details: Detailed result of testing route. + :type details: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteResultDetails + """ + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'TestRouteResultDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteResult, self).__init__(**kwargs) + self.result = kwargs.get('result', None) + self.details = kwargs.get('details', None) + + +class TestRouteResultDetails(msrest.serialization.Model): + """Detailed result of testing a route. + + :param compilation_errors: JSON-serialized list of route compilation errors. + :type compilation_errors: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.RouteCompilationError] + """ + + _attribute_map = { + 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteResultDetails, self).__init__(**kwargs) + self.compilation_errors = kwargs.get('compilation_errors', None) + + +class UserSubscriptionQuota(msrest.serialization.Model): + """User subscription quota response. + + :param id: IotHub type id. + :type id: str + :param type: Response type. + :type type: str + :param unit: Unit of IotHub type. + :type unit: str + :param current_value: Current number of IotHub type. + :type current_value: int + :param limit: Numerical limit on IotHub type. + :type limit: int + :param name: IotHub type. + :type name: ~azure.mgmt.iothub.v2019_07_01_preview.models.Name + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'Name'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSubscriptionQuota, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.unit = kwargs.get('unit', None) + self.current_value = kwargs.get('current_value', None) + self.limit = kwargs.get('limit', None) + self.name = kwargs.get('name', None) + + +class UserSubscriptionQuotaListResult(msrest.serialization.Model): + """Json-serialized array of User subscription quota response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.UserSubscriptionQuota] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSubscriptionQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..1f5dda93152b --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py @@ -0,0 +1,2625 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._iot_hub_client_enums import * + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = certificate + + +class CertificateDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate. + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): + super(CertificateDescription, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateDescription]'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateDescription"]] = None, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = value + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :param certificate: The certificate content. + :type certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.certificate = certificate + + +class CertificatePropertiesWithNonce(msrest.serialization.Model): + """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :ivar verification_code: The certificate's verification code that will be used for proof of + possession. + :vartype verification_code: str + :ivar certificate: The certificate content. + :vartype certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'verification_code': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificatePropertiesWithNonce, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.verification_code = None + self.certificate = None + + +class CertificateVerificationDescription(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateVerificationDescription, self).__init__(**kwargs) + self.certificate = certificate + + +class CertificateWithNonceDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate including the challenge nonce + issued for the Proof-Of-Possession flow. + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificatePropertiesWithNonce + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificatePropertiesWithNonce'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["CertificatePropertiesWithNonce"] = None, + **kwargs + ): + super(CertificateWithNonceDescription, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CloudToDeviceProperties(msrest.serialization.Model): + """The IoT hub cloud-to-device messaging properties. + + :param max_delivery_count: The max delivery count for cloud-to-device messages in the device + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type default_ttl_as_iso8601: ~datetime.timedelta + :param feedback: The properties of the feedback queue for cloud-to-device messages. + :type feedback: ~azure.mgmt.iothub.v2019_07_01_preview.models.FeedbackProperties + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + 'default_ttl_as_iso8601': {'key': 'defaultTtlAsIso8601', 'type': 'duration'}, + 'feedback': {'key': 'feedback', 'type': 'FeedbackProperties'}, + } + + def __init__( + self, + *, + max_delivery_count: Optional[int] = None, + default_ttl_as_iso8601: Optional[datetime.timedelta] = None, + feedback: Optional["FeedbackProperties"] = None, + **kwargs + ): + super(CloudToDeviceProperties, self).__init__(**kwargs) + self.max_delivery_count = max_delivery_count + self.default_ttl_as_iso8601 = default_ttl_as_iso8601 + self.feedback = feedback + + +class EndpointHealthData(msrest.serialization.Model): + """The health data for an endpoint. + + :param endpoint_id: Id of the endpoint. + :type endpoint_id: str + :param health_status: Health statuses have following meanings. The 'healthy' status shows that + the endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint + is not accepting messages as expected and IoT Hub is retrying to send data to this endpoint. + The status of an unhealthy endpoint will be updated to healthy when IoT Hub has established an + eventually consistent state of health. The 'dead' status shows that the endpoint is not + accepting messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub + metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + the IoT Hub has not established a connection with the endpoint. No messages have been delivered + to or rejected from this endpoint. Possible values include: "unknown", "healthy", "unhealthy", + "dead". + :type health_status: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.EndpointHealthStatus + """ + + _attribute_map = { + 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, + 'health_status': {'key': 'healthStatus', 'type': 'str'}, + } + + def __init__( + self, + *, + endpoint_id: Optional[str] = None, + health_status: Optional[Union[str, "EndpointHealthStatus"]] = None, + **kwargs + ): + super(EndpointHealthData, self).__init__(**kwargs) + self.endpoint_id = endpoint_id + self.health_status = health_status + + +class EndpointHealthDataListResult(msrest.serialization.Model): + """The JSON-serialized array of EndpointHealthData objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: JSON-serialized array of Endpoint health data. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EndpointHealthData] + :ivar next_link: Link to more results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EndpointHealthData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EndpointHealthData"]] = None, + **kwargs + ): + super(EndpointHealthDataListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class EnrichmentProperties(msrest.serialization.Model): + """The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key or name for the enrichment property. + :type key: str + :param value: Required. The value for the enrichment property. + :type value: str + :param endpoint_names: Required. The list of endpoints for which the enrichment is applied to + the message. + :type endpoint_names: list[str] + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'endpoint_names': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + key: str, + value: str, + endpoint_names: List[str], + **kwargs + ): + super(EnrichmentProperties, self).__init__(**kwargs) + self.key = key + self.value = value + self.endpoint_names = endpoint_names + + +class ErrorDetails(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class EventHubConsumerGroupInfo(msrest.serialization.Model): + """The properties of the EventHubConsumerGroupInfo object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The tags. + :type properties: dict[str, str] + :ivar id: The Event Hub-compatible consumer group identifier. + :vartype id: str + :ivar name: The Event Hub-compatible consumer group name. + :vartype name: str + :ivar type: the resource type. + :vartype type: str + :ivar etag: The etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(EventHubConsumerGroupInfo, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.type = None + self.etag = None + + +class EventHubConsumerGroupsListResult(msrest.serialization.Model): + """The JSON-serialized array of Event Hub-compatible consumer group names with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of consumer groups objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventHubConsumerGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EventHubConsumerGroupInfo"]] = None, + **kwargs + ): + super(EventHubConsumerGroupsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class EventHubProperties(msrest.serialization.Model): + """The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param retention_time_in_days: The retention time for device-to-cloud messages in days. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type retention_time_in_days: long + :param partition_count: The number of partitions for receiving device-to-cloud messages in the + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type partition_count: int + :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. + :vartype partition_ids: list[str] + :ivar path: The Event Hub-compatible name. + :vartype path: str + :ivar endpoint: The Event Hub-compatible endpoint. + :vartype endpoint: str + """ + + _validation = { + 'partition_ids': {'readonly': True}, + 'path': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'retention_time_in_days': {'key': 'retentionTimeInDays', 'type': 'long'}, + 'partition_count': {'key': 'partitionCount', 'type': 'int'}, + 'partition_ids': {'key': 'partitionIds', 'type': '[str]'}, + 'path': {'key': 'path', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + *, + retention_time_in_days: Optional[int] = None, + partition_count: Optional[int] = None, + **kwargs + ): + super(EventHubProperties, self).__init__(**kwargs) + self.retention_time_in_days = retention_time_in_days + self.partition_count = partition_count + self.partition_ids = None + self.path = None + self.endpoint = None + + +class ExportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an export of all devices in the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param export_blob_container_uri: Required. The export blob container URI. + :type export_blob_container_uri: str + :param exclude_keys: Required. The value indicating whether keys should be excluded during + export. + :type exclude_keys: bool + """ + + _validation = { + 'export_blob_container_uri': {'required': True}, + 'exclude_keys': {'required': True}, + } + + _attribute_map = { + 'export_blob_container_uri': {'key': 'exportBlobContainerUri', 'type': 'str'}, + 'exclude_keys': {'key': 'excludeKeys', 'type': 'bool'}, + } + + def __init__( + self, + *, + export_blob_container_uri: str, + exclude_keys: bool, + **kwargs + ): + super(ExportDevicesRequest, self).__init__(**kwargs) + self.export_blob_container_uri = export_blob_container_uri + self.exclude_keys = exclude_keys + + +class FailoverInput(msrest.serialization.Model): + """Use to provide failover region when requesting manual Failover for a hub. + + All required parameters must be populated in order to send to Azure. + + :param failover_region: Required. Region the hub will be failed over to. + :type failover_region: str + """ + + _validation = { + 'failover_region': {'required': True}, + } + + _attribute_map = { + 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, + } + + def __init__( + self, + *, + failover_region: str, + **kwargs + ): + super(FailoverInput, self).__init__(**kwargs) + self.failover_region = failover_region + + +class FallbackRouteProperties(msrest.serialization.Model): + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the route. The name can only include alphanumeric characters, periods, + underscores, hyphens, has a maximum length of 64 characters, and must be unique. + :type name: str + :param source: Required. The source to which the routing rule is to be applied to. For example, + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DigitalTwinChangeEvents". + :type source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource + :param condition: The condition which is evaluated in order to apply the fallback route. If the + condition is not provided it will evaluate to true by default. For grammar, See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which the messages that satisfy the + condition are routed to. Currently only 1 endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether the fallback route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + source: Union[str, "RoutingSource"], + endpoint_names: List[str], + is_enabled: bool, + name: Optional[str] = None, + condition: Optional[str] = None, + **kwargs + ): + super(FallbackRouteProperties, self).__init__(**kwargs) + self.name = name + self.source = source + self.condition = condition + self.endpoint_names = endpoint_names + self.is_enabled = is_enabled + + +class FeedbackProperties(msrest.serialization.Model): + """The properties of the feedback queue for cloud-to-device messages. + + :param lock_duration_as_iso8601: The lock duration for the feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + *, + lock_duration_as_iso8601: Optional[datetime.timedelta] = None, + ttl_as_iso8601: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + **kwargs + ): + super(FeedbackProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = lock_duration_as_iso8601 + self.ttl_as_iso8601 = ttl_as_iso8601 + self.max_delivery_count = max_delivery_count + + +class ImportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an import of all devices in the hub. + + All required parameters must be populated in order to send to Azure. + + :param input_blob_container_uri: Required. The input blob container URI. + :type input_blob_container_uri: str + :param output_blob_container_uri: Required. The output blob container URI. + :type output_blob_container_uri: str + """ + + _validation = { + 'input_blob_container_uri': {'required': True}, + 'output_blob_container_uri': {'required': True}, + } + + _attribute_map = { + 'input_blob_container_uri': {'key': 'inputBlobContainerUri', 'type': 'str'}, + 'output_blob_container_uri': {'key': 'outputBlobContainerUri', 'type': 'str'}, + } + + def __init__( + self, + *, + input_blob_container_uri: str, + output_blob_container_uri: str, + **kwargs + ): + super(ImportDevicesRequest, self).__init__(**kwargs) + self.input_blob_container_uri = input_blob_container_uri + self.output_blob_container_uri = output_blob_container_uri + + +class IotHubCapacity(msrest.serialization.Model): + """IoT Hub capacity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum number of units. + :vartype minimum: long + :ivar maximum: The maximum number of units. + :vartype maximum: long + :ivar default: The default number of units. + :vartype default: long + :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", + "Manual", "None". + :vartype scale_type: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubScaleType + """ + + _validation = { + 'minimum': {'readonly': True, 'maximum': 1, 'minimum': 1}, + 'maximum': {'readonly': True}, + 'default': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default': {'key': 'default', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default = None + self.scale_type = None + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class IotHubDescription(Resource): + """The description of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: IotHub properties. + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubProperties + :param sku: Required. IotHub SKU info. + :type sku: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotHubProperties'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + } + + def __init__( + self, + *, + location: str, + sku: "IotHubSkuInfo", + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + properties: Optional["IotHubProperties"] = None, + **kwargs + ): + super(IotHubDescription, self).__init__(location=location, tags=tags, **kwargs) + self.etag = etag + self.properties = properties + self.sku = sku + + +class IotHubDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubDescription objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubDescription"]] = None, + **kwargs + ): + super(IotHubDescriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubLocationDescription(msrest.serialization.Model): + """Public representation of one of the locations where a resource is provisioned. + + :param location: Azure Geo Regions. + :type location: str + :param role: Specific Role assigned to this location. Possible values include: "primary", + "secondary". + :type role: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubReplicaRoleType + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + role: Optional[Union[str, "IotHubReplicaRoleType"]] = None, + **kwargs + ): + super(IotHubLocationDescription, self).__init__(**kwargs) + self.location = location + self.role = role + + +class IotHubNameAvailabilityInfo(msrest.serialization.Model): + """The properties indicating whether a given IoT hub name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: The value which indicates whether the provided name is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or + ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + **kwargs + ): + super(IotHubNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = message + + +class IotHubProperties(msrest.serialization.Model): + """The properties of an IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param authorization_policies: The shared access policies you can use to secure a connection to + the IoT hub. + :type authorization_policies: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule] + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IpFilterRule] + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :ivar state: The hub state. + :vartype state: str + :ivar host_name: The name of the host. + :vartype host_name: str + :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible + keys to this dictionary is events. This key has to be present in the dictionary while making + create or update calls for the IoT hub. + :type event_hub_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubProperties] + :param routing: The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + :type routing: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingProperties + :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. + Currently you can configure only one Azure Storage account and that MUST have its key as + $default. Specifying more than one storage account causes an error to be thrown. Not specifying + a value for this property when the enableFileUploadNotifications property is set to True, + causes an error to be thrown. + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_07_01_preview.models.StorageEndpointProperties] + :param messaging_endpoints: The messaging endpoint properties for the file upload notification + queue. + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_07_01_preview.models.MessagingEndpointProperties] + :param enable_file_upload_notifications: If True, file upload notifications are enabled. + :type enable_file_upload_notifications: bool + :param cloud_to_device: The IoT hub cloud-to-device messaging properties. + :type cloud_to_device: ~azure.mgmt.iothub.v2019_07_01_preview.models.CloudToDeviceProperties + :param comments: IoT hub comments. + :type comments: str + :param device_streams: The device streams properties of iothub. + :type device_streams: + ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubPropertiesDeviceStreams + :param features: The capabilities and features enabled for the IoT hub. Possible values + include: "None", "DeviceManagement". + :type features: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.Capabilities + :ivar locations: Primary and secondary location for iot hub. + :vartype locations: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubLocationDescription] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'host_name': {'readonly': True}, + 'locations': {'readonly': True}, + } + + _attribute_map = { + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'event_hub_endpoints': {'key': 'eventHubEndpoints', 'type': '{EventHubProperties}'}, + 'routing': {'key': 'routing', 'type': 'RoutingProperties'}, + 'storage_endpoints': {'key': 'storageEndpoints', 'type': '{StorageEndpointProperties}'}, + 'messaging_endpoints': {'key': 'messagingEndpoints', 'type': '{MessagingEndpointProperties}'}, + 'enable_file_upload_notifications': {'key': 'enableFileUploadNotifications', 'type': 'bool'}, + 'cloud_to_device': {'key': 'cloudToDevice', 'type': 'CloudToDeviceProperties'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'device_streams': {'key': 'deviceStreams', 'type': 'IotHubPropertiesDeviceStreams'}, + 'features': {'key': 'features', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[IotHubLocationDescription]'}, + } + + def __init__( + self, + *, + authorization_policies: Optional[List["SharedAccessSignatureAuthorizationRule"]] = None, + ip_filter_rules: Optional[List["IpFilterRule"]] = None, + event_hub_endpoints: Optional[Dict[str, "EventHubProperties"]] = None, + routing: Optional["RoutingProperties"] = None, + storage_endpoints: Optional[Dict[str, "StorageEndpointProperties"]] = None, + messaging_endpoints: Optional[Dict[str, "MessagingEndpointProperties"]] = None, + enable_file_upload_notifications: Optional[bool] = None, + cloud_to_device: Optional["CloudToDeviceProperties"] = None, + comments: Optional[str] = None, + device_streams: Optional["IotHubPropertiesDeviceStreams"] = None, + features: Optional[Union[str, "Capabilities"]] = None, + **kwargs + ): + super(IotHubProperties, self).__init__(**kwargs) + self.authorization_policies = authorization_policies + self.ip_filter_rules = ip_filter_rules + self.provisioning_state = None + self.state = None + self.host_name = None + self.event_hub_endpoints = event_hub_endpoints + self.routing = routing + self.storage_endpoints = storage_endpoints + self.messaging_endpoints = messaging_endpoints + self.enable_file_upload_notifications = enable_file_upload_notifications + self.cloud_to_device = cloud_to_device + self.comments = comments + self.device_streams = device_streams + self.features = features + self.locations = None + + +class IotHubPropertiesDeviceStreams(msrest.serialization.Model): + """The device streams properties of iothub. + + :param streaming_endpoints: List of Device Streams Endpoints. + :type streaming_endpoints: list[str] + """ + + _attribute_map = { + 'streaming_endpoints': {'key': 'streamingEndpoints', 'type': '[str]'}, + } + + def __init__( + self, + *, + streaming_endpoints: Optional[List[str]] = None, + **kwargs + ): + super(IotHubPropertiesDeviceStreams, self).__init__(**kwargs) + self.streaming_endpoints = streaming_endpoints + + +class IotHubQuotaMetricInfo(msrest.serialization.Model): + """Quota metrics properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the quota metric. + :vartype name: str + :ivar current_value: The current value for the quota metric. + :vartype current_value: long + :ivar max_value: The maximum value of the quota metric. + :vartype max_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'current_value': {'readonly': True}, + 'max_value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'max_value': {'key': 'maxValue', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfo, self).__init__(**kwargs) + self.name = None + self.current_value = None + self.max_value = None + + +class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of quota metrics objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubQuotaMetricInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubQuotaMetricInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubQuotaMetricInfo"]] = None, + **kwargs + ): + super(IotHubQuotaMetricInfoListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubSkuDescription(msrest.serialization.Model): + """SKU properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :param sku: Required. The type of the resource. + :type sku: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuInfo + :param capacity: Required. IotHub capacity. + :type capacity: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'required': True}, + 'capacity': {'required': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'capacity': {'key': 'capacity', 'type': 'IotHubCapacity'}, + } + + def __init__( + self, + *, + sku: "IotHubSkuInfo", + capacity: "IotHubCapacity", + **kwargs + ): + super(IotHubSkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.sku = sku + self.capacity = capacity + + +class IotHubSkuDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubSkuDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubSkuDescription. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubSkuDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubSkuDescription"]] = None, + **kwargs + ): + super(IotHubSkuDescriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubSkuInfo(msrest.serialization.Model): + """Information about the SKU of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", + "B1", "B2", "B3". + :type name: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSku + :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", + "Basic". + :vartype tier: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuTier + :param capacity: The number of provisioned IoT Hub units. See: + https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + :type capacity: long + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + *, + name: Union[str, "IotHubSku"], + capacity: Optional[int] = None, + **kwargs + ): + super(IotHubSkuInfo, self).__init__(**kwargs) + self.name = name + self.tier = None + self.capacity = capacity + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + *, + filter_name: str, + action: Union[str, "IpFilterActionType"], + ip_mask: str, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = filter_name + self.action = action + self.ip_mask = ip_mask + + +class JobResponse(msrest.serialization.Model): + """The properties of the Job Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_id: The job identifier. + :vartype job_id: str + :ivar start_time_utc: The start time of the job. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: The time the job stopped processing. + :vartype end_time_utc: ~datetime.datetime + :ivar type: The type of the job. Possible values include: "unknown", "export", "import", + "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", + "rebootDevice", "factoryResetDevice", "firmwareUpdate". + :vartype type: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.JobType + :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", + "completed", "failed", "cancelled". + :vartype status: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.JobStatus + :ivar failure_reason: If status == failed, this string containing the reason for the failure. + :vartype failure_reason: str + :ivar status_message: The status message for the job. + :vartype status_message: str + :ivar parent_job_id: The job identifier of the parent job, if any. + :vartype parent_job_id: str + """ + + _validation = { + 'job_id': {'readonly': True}, + 'start_time_utc': {'readonly': True}, + 'end_time_utc': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'status_message': {'readonly': True}, + 'parent_job_id': {'readonly': True}, + } + + _attribute_map = { + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'rfc-1123'}, + 'end_time_utc': {'key': 'endTimeUtc', 'type': 'rfc-1123'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'parent_job_id': {'key': 'parentJobId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.job_id = None + self.start_time_utc = None + self.end_time_utc = None + self.type = None + self.status = None + self.failure_reason = None + self.status_message = None + self.parent_job_id = None + + +class JobResponseListResult(msrest.serialization.Model): + """The JSON-serialized array of JobResponse objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of JobResponse objects. + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JobResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["JobResponse"]] = None, + **kwargs + ): + super(JobResponseListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class MatchedRoute(msrest.serialization.Model): + """Routes that matched. + + :param properties: Properties of routes that matched. + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RouteProperties'}, + } + + def __init__( + self, + *, + properties: Optional["RouteProperties"] = None, + **kwargs + ): + super(MatchedRoute, self).__init__(**kwargs) + self.properties = properties + + +class MessagingEndpointProperties(msrest.serialization.Model): + """The properties of the messaging endpoints used by this IoT hub. + + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + *, + lock_duration_as_iso8601: Optional[datetime.timedelta] = None, + ttl_as_iso8601: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + **kwargs + ): + super(MessagingEndpointProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = lock_duration_as_iso8601 + self.ttl_as_iso8601 = ttl_as_iso8601 + self.max_delivery_count = max_delivery_count + + +class Name(msrest.serialization.Model): + """Name of Iot Hub type. + + :param value: IotHub type. + :type value: str + :param localized_value: Localized value of name. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): + super(Name, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class Operation(msrest.serialization.Model): + """IoT Hub REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothub.v2019_07_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: IotHubs. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationInputs(msrest.serialization.Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the IoT hub to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = name + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. + :vartype value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class RegistryStatistics(msrest.serialization.Model): + """Identity registry statistics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_device_count: The total count of devices in the identity registry. + :vartype total_device_count: long + :ivar enabled_device_count: The count of enabled devices in the identity registry. + :vartype enabled_device_count: long + :ivar disabled_device_count: The count of disabled devices in the identity registry. + :vartype disabled_device_count: long + """ + + _validation = { + 'total_device_count': {'readonly': True}, + 'enabled_device_count': {'readonly': True}, + 'disabled_device_count': {'readonly': True}, + } + + _attribute_map = { + 'total_device_count': {'key': 'totalDeviceCount', 'type': 'long'}, + 'enabled_device_count': {'key': 'enabledDeviceCount', 'type': 'long'}, + 'disabled_device_count': {'key': 'disabledDeviceCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryStatistics, self).__init__(**kwargs) + self.total_device_count = None + self.enabled_device_count = None + self.disabled_device_count = None + + +class RouteCompilationError(msrest.serialization.Model): + """Compilation error when evaluating route. + + :param message: Route error message. + :type message: str + :param severity: Severity of the route error. Possible values include: "error", "warning". + :type severity: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorSeverity + :param location: Location where the route error happened. + :type location: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorRange + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'RouteErrorRange'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + severity: Optional[Union[str, "RouteErrorSeverity"]] = None, + location: Optional["RouteErrorRange"] = None, + **kwargs + ): + super(RouteCompilationError, self).__init__(**kwargs) + self.message = message + self.severity = severity + self.location = location + + +class RouteErrorPosition(msrest.serialization.Model): + """Position where the route error happened. + + :param line: Line where the route error happened. + :type line: int + :param column: Column where the route error happened. + :type column: int + """ + + _attribute_map = { + 'line': {'key': 'line', 'type': 'int'}, + 'column': {'key': 'column', 'type': 'int'}, + } + + def __init__( + self, + *, + line: Optional[int] = None, + column: Optional[int] = None, + **kwargs + ): + super(RouteErrorPosition, self).__init__(**kwargs) + self.line = line + self.column = column + + +class RouteErrorRange(msrest.serialization.Model): + """Range of route errors. + + :param start: Start where the route error happened. + :type start: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorPosition + :param end: End where the route error happened. + :type end: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteErrorPosition + """ + + _attribute_map = { + 'start': {'key': 'start', 'type': 'RouteErrorPosition'}, + 'end': {'key': 'end', 'type': 'RouteErrorPosition'}, + } + + def __init__( + self, + *, + start: Optional["RouteErrorPosition"] = None, + end: Optional["RouteErrorPosition"] = None, + **kwargs + ): + super(RouteErrorRange, self).__init__(**kwargs) + self.start = start + self.end = end + + +class RouteProperties(msrest.serialization.Model): + """The properties of a routing rule that your IoT hub uses to route messages to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route. The name can only include alphanumeric + characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be + unique. + :type name: str + :param source: Required. The source that the routing rule is to be applied to, such as + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DigitalTwinChangeEvents". + :type source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource + :param condition: The condition that is evaluated to apply the routing rule. If no condition is + provided, it evaluates to true by default. For grammar, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which messages that satisfy the + condition are routed. Currently only one endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether a route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + source: Union[str, "RoutingSource"], + endpoint_names: List[str], + is_enabled: bool, + condition: Optional[str] = None, + **kwargs + ): + super(RouteProperties, self).__init__(**kwargs) + self.name = name + self.source = source + self.condition = condition + self.endpoint_names = endpoint_names + self.is_enabled = is_enabled + + +class RoutingEndpoints(msrest.serialization.Model): + """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + + :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the + messages to, based on the routing rules. + :type service_bus_queues: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingServiceBusQueueEndpointProperties] + :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the + messages to, based on the routing rules. + :type service_bus_topics: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingServiceBusTopicEndpointProperties] + :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on + the routing rules. This list does not include the built-in Event Hubs endpoint. + :type event_hubs: list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingEventHubProperties] + :param storage_containers: The list of storage container endpoints that IoT hub routes messages + to, based on the routing rules. + :type storage_containers: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingStorageContainerProperties] + """ + + _attribute_map = { + 'service_bus_queues': {'key': 'serviceBusQueues', 'type': '[RoutingServiceBusQueueEndpointProperties]'}, + 'service_bus_topics': {'key': 'serviceBusTopics', 'type': '[RoutingServiceBusTopicEndpointProperties]'}, + 'event_hubs': {'key': 'eventHubs', 'type': '[RoutingEventHubProperties]'}, + 'storage_containers': {'key': 'storageContainers', 'type': '[RoutingStorageContainerProperties]'}, + } + + def __init__( + self, + *, + service_bus_queues: Optional[List["RoutingServiceBusQueueEndpointProperties"]] = None, + service_bus_topics: Optional[List["RoutingServiceBusTopicEndpointProperties"]] = None, + event_hubs: Optional[List["RoutingEventHubProperties"]] = None, + storage_containers: Optional[List["RoutingStorageContainerProperties"]] = None, + **kwargs + ): + super(RoutingEndpoints, self).__init__(**kwargs) + self.service_bus_queues = service_bus_queues + self.service_bus_topics = service_bus_topics + self.event_hubs = event_hubs + self.storage_containers = storage_containers + + +class RoutingEventHubProperties(msrest.serialization.Model): + """The properties related to an event hub endpoint. + + All required parameters must be populated in order to send to Azure. + + :param connection_string: Required. The connection string of the event hub endpoint. + :type connection_string: str + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the event hub endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the event hub endpoint. + :type resource_group: str + """ + + _validation = { + 'connection_string': {'required': True}, + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + connection_string: str, + name: str, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingEventHubProperties, self).__init__(**kwargs) + self.connection_string = connection_string + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingMessage(msrest.serialization.Model): + """Routing message. + + :param body: Body of routing message. + :type body: str + :param app_properties: App properties. + :type app_properties: dict[str, str] + :param system_properties: System properties. + :type system_properties: dict[str, str] + """ + + _attribute_map = { + 'body': {'key': 'body', 'type': 'str'}, + 'app_properties': {'key': 'appProperties', 'type': '{str}'}, + 'system_properties': {'key': 'systemProperties', 'type': '{str}'}, + } + + def __init__( + self, + *, + body: Optional[str] = None, + app_properties: Optional[Dict[str, str]] = None, + system_properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(RoutingMessage, self).__init__(**kwargs) + self.body = body + self.app_properties = app_properties + self.system_properties = system_properties + + +class RoutingProperties(msrest.serialization.Model): + """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + + :param endpoints: The properties related to the custom endpoints to which your IoT hub routes + messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all + endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types + for free hubs. + :type endpoints: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingEndpoints + :param routes: The list of user-provided routing rules that the IoT hub uses to route messages + to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and + a maximum of 5 routing rules are allowed for free hubs. + :type routes: list[~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties] + :param fallback_route: The properties of the route that is used as a fall-back route when none + of the conditions specified in the 'routes' section are met. This is an optional parameter. + When this property is not set, the messages which do not meet any of the conditions specified + in the 'routes' section get routed to the built-in eventhub endpoint. + :type fallback_route: ~azure.mgmt.iothub.v2019_07_01_preview.models.FallbackRouteProperties + :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages + to be delivered to built-in and custom endpoints. See: https://aka.ms/iotmsgenrich. + :type enrichments: list[~azure.mgmt.iothub.v2019_07_01_preview.models.EnrichmentProperties] + """ + + _attribute_map = { + 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, + 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, + 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, + 'enrichments': {'key': 'enrichments', 'type': '[EnrichmentProperties]'}, + } + + def __init__( + self, + *, + endpoints: Optional["RoutingEndpoints"] = None, + routes: Optional[List["RouteProperties"]] = None, + fallback_route: Optional["FallbackRouteProperties"] = None, + enrichments: Optional[List["EnrichmentProperties"]] = None, + **kwargs + ): + super(RoutingProperties, self).__init__(**kwargs) + self.endpoints = endpoints + self.routes = routes + self.fallback_route = fallback_route + self.enrichments = enrichments + + +class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): + """The properties related to service bus queue endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param connection_string: Required. The connection string of the service bus queue endpoint. + :type connection_string: str + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual queue + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus queue endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus queue endpoint. + :type resource_group: str + """ + + _validation = { + 'connection_string': {'required': True}, + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + connection_string: str, + name: str, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingServiceBusQueueEndpointProperties, self).__init__(**kwargs) + self.connection_string = connection_string + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): + """The properties related to service bus topic endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param connection_string: Required. The connection string of the service bus topic endpoint. + :type connection_string: str + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual topic + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus topic endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus topic endpoint. + :type resource_group: str + """ + + _validation = { + 'connection_string': {'required': True}, + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + connection_string: str, + name: str, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingServiceBusTopicEndpointProperties, self).__init__(**kwargs) + self.connection_string = connection_string + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingStorageContainerProperties(msrest.serialization.Model): + """The properties related to a storage container endpoint. + + All required parameters must be populated in order to send to Azure. + + :param connection_string: Required. The connection string of the storage account. + :type connection_string: str + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the storage account. + :type subscription_id: str + :param resource_group: The name of the resource group of the storage account. + :type resource_group: str + :param container_name: Required. The name of storage container in the storage account. + :type container_name: str + :param file_name_format: File name format for the blob. Default format is + {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be + reordered. + :type file_name_format: str + :param batch_frequency_in_seconds: Time interval at which blobs are written to storage. Value + should be between 60 and 720 seconds. Default value is 300 seconds. + :type batch_frequency_in_seconds: int + :param max_chunk_size_in_bytes: Maximum number of bytes for each blob written to storage. Value + should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + :type max_chunk_size_in_bytes: int + :param encoding: Encoding that is used to serialize messages to blobs. Supported values are + 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", + "AvroDeflate", "JSON". + :type encoding: str or + ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingStorageContainerPropertiesEncoding + """ + + _validation = { + 'connection_string': {'required': True}, + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'container_name': {'required': True}, + 'batch_frequency_in_seconds': {'maximum': 720, 'minimum': 60}, + 'max_chunk_size_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'file_name_format': {'key': 'fileNameFormat', 'type': 'str'}, + 'batch_frequency_in_seconds': {'key': 'batchFrequencyInSeconds', 'type': 'int'}, + 'max_chunk_size_in_bytes': {'key': 'maxChunkSizeInBytes', 'type': 'int'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__( + self, + *, + connection_string: str, + name: str, + container_name: str, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + file_name_format: Optional[str] = None, + batch_frequency_in_seconds: Optional[int] = None, + max_chunk_size_in_bytes: Optional[int] = None, + encoding: Optional[Union[str, "RoutingStorageContainerPropertiesEncoding"]] = None, + **kwargs + ): + super(RoutingStorageContainerProperties, self).__init__(**kwargs) + self.connection_string = connection_string + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + self.container_name = container_name + self.file_name_format = file_name_format + self.batch_frequency_in_seconds = batch_frequency_in_seconds + self.max_chunk_size_in_bytes = max_chunk_size_in_bytes + self.encoding = encoding + + +class RoutingTwin(msrest.serialization.Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: A set of tags. Twin Tags. + :type tags: str + :param properties: + :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__( + self, + *, + tags: Optional[str] = None, + properties: Optional["RoutingTwinProperties"] = None, + **kwargs + ): + super(RoutingTwin, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class RoutingTwinProperties(msrest.serialization.Model): + """RoutingTwinProperties. + + :param desired: Twin desired properties. + :type desired: str + :param reported: Twin desired properties. + :type reported: str + """ + + _attribute_map = { + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, + } + + def __init__( + self, + *, + desired: Optional[str] = None, + reported: Optional[str] = None, + **kwargs + ): + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired = desired + self.reported = reported + + +class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): + """The properties of an IoT hub shared access policy. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the shared access policy. + :type key_name: str + :param primary_key: The primary key. + :type primary_key: str + :param secondary_key: The secondary key. + :type secondary_key: str + :param rights: Required. The permissions assigned to the shared access policy. Possible values + include: "RegistryRead", "RegistryWrite", "ServiceConnect", "DeviceConnect", "RegistryRead, + RegistryWrite", "RegistryRead, ServiceConnect", "RegistryRead, DeviceConnect", "RegistryWrite, + ServiceConnect", "RegistryWrite, DeviceConnect", "ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", + "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". + :type rights: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.AccessRights + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: str, + rights: Union[str, "AccessRights"], + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRule, self).__init__(**kwargs) + self.key_name = key_name + self.primary_key = primary_key + self.secondary_key = secondary_key + self.rights = rights + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """The list of shared access policies with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SharedAccessSignatureAuthorizationRule"]] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StorageEndpointProperties(msrest.serialization.Model): + """The properties of the Azure Storage endpoint for file upload. + + All required parameters must be populated in order to send to Azure. + + :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + :type sas_ttl_as_iso8601: ~datetime.timedelta + :param connection_string: Required. The connection string for the Azure Storage account to + which files are uploaded. + :type connection_string: str + :param container_name: Required. The name of the root container where you upload files. The + container need not exist but should be creatable using the connectionString specified. + :type container_name: str + """ + + _validation = { + 'connection_string': {'required': True}, + 'container_name': {'required': True}, + } + + _attribute_map = { + 'sas_ttl_as_iso8601': {'key': 'sasTtlAsIso8601', 'type': 'duration'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + } + + def __init__( + self, + *, + connection_string: str, + container_name: str, + sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, + **kwargs + ): + super(StorageEndpointProperties, self).__init__(**kwargs) + self.sas_ttl_as_iso8601 = sas_ttl_as_iso8601 + self.connection_string = connection_string + self.container_name = container_name + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.tags = tags + + +class TestAllRoutesInput(msrest.serialization.Model): + """Input for testing all routes. + + :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", + "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", + "DigitalTwinChangeEvents". + :type routing_source: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingSource + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingMessage + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwin + """ + + _attribute_map = { + 'routing_source': {'key': 'routingSource', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + *, + routing_source: Optional[Union[str, "RoutingSource"]] = None, + message: Optional["RoutingMessage"] = None, + twin: Optional["RoutingTwin"] = None, + **kwargs + ): + super(TestAllRoutesInput, self).__init__(**kwargs) + self.routing_source = routing_source + self.message = message + self.twin = twin + + +class TestAllRoutesResult(msrest.serialization.Model): + """Result of testing all routes. + + :param routes: JSON-serialized array of matched routes. + :type routes: list[~azure.mgmt.iothub.v2019_07_01_preview.models.MatchedRoute] + """ + + _attribute_map = { + 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, + } + + def __init__( + self, + *, + routes: Optional[List["MatchedRoute"]] = None, + **kwargs + ): + super(TestAllRoutesResult, self).__init__(**kwargs) + self.routes = routes + + +class TestRouteInput(msrest.serialization.Model): + """Input for testing route. + + All required parameters must be populated in order to send to Azure. + + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingMessage + :param route: Required. Route properties. + :type route: ~azure.mgmt.iothub.v2019_07_01_preview.models.RouteProperties + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwin + """ + + _validation = { + 'route': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + *, + route: "RouteProperties", + message: Optional["RoutingMessage"] = None, + twin: Optional["RoutingTwin"] = None, + **kwargs + ): + super(TestRouteInput, self).__init__(**kwargs) + self.message = message + self.route = route + self.twin = twin + + +class TestRouteResult(msrest.serialization.Model): + """Result of testing one route. + + :param result: Result of testing route. Possible values include: "undefined", "false", "true". + :type result: str or ~azure.mgmt.iothub.v2019_07_01_preview.models.TestResultStatus + :param details: Detailed result of testing route. + :type details: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteResultDetails + """ + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'TestRouteResultDetails'}, + } + + def __init__( + self, + *, + result: Optional[Union[str, "TestResultStatus"]] = None, + details: Optional["TestRouteResultDetails"] = None, + **kwargs + ): + super(TestRouteResult, self).__init__(**kwargs) + self.result = result + self.details = details + + +class TestRouteResultDetails(msrest.serialization.Model): + """Detailed result of testing a route. + + :param compilation_errors: JSON-serialized list of route compilation errors. + :type compilation_errors: + list[~azure.mgmt.iothub.v2019_07_01_preview.models.RouteCompilationError] + """ + + _attribute_map = { + 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, + } + + def __init__( + self, + *, + compilation_errors: Optional[List["RouteCompilationError"]] = None, + **kwargs + ): + super(TestRouteResultDetails, self).__init__(**kwargs) + self.compilation_errors = compilation_errors + + +class UserSubscriptionQuota(msrest.serialization.Model): + """User subscription quota response. + + :param id: IotHub type id. + :type id: str + :param type: Response type. + :type type: str + :param unit: Unit of IotHub type. + :type unit: str + :param current_value: Current number of IotHub type. + :type current_value: int + :param limit: Numerical limit on IotHub type. + :type limit: int + :param name: IotHub type. + :type name: ~azure.mgmt.iothub.v2019_07_01_preview.models.Name + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'Name'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + type: Optional[str] = None, + unit: Optional[str] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["Name"] = None, + **kwargs + ): + super(UserSubscriptionQuota, self).__init__(**kwargs) + self.id = id + self.type = type + self.unit = unit + self.current_value = current_value + self.limit = limit + self.name = name + + +class UserSubscriptionQuotaListResult(msrest.serialization.Model): + """Json-serialized array of User subscription quota response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: + :type value: list[~azure.mgmt.iothub.v2019_07_01_preview.models.UserSubscriptionQuota] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSubscriptionQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["UserSubscriptionQuota"]] = None, + **kwargs + ): + super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py new file mode 100644 index 000000000000..b95fca917d02 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._operations import Operations +from ._iot_hub_resource_operations import IotHubResourceOperations +from ._resource_provider_common_operations import ResourceProviderCommonOperations +from ._certificates_operations import CertificatesOperations +from ._iot_hub_operations import IotHubOperations + +__all__ = [ + 'Operations', + 'IotHubResourceOperations', + 'ResourceProviderCommonOperations', + 'CertificatesOperations', + 'IotHubOperations', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py new file mode 100644 index 000000000000..37d3949f3537 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_certificates_operations.py @@ -0,0 +1,474 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations(object): + """CertificatesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_iot_hub( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateListDescription" + """Get the certificate list. + + Returns the list of certificates. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_iot_hub.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_iot_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Get the certificate. + + Returns the certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + certificate_description, # type: "_models.CertificateBodyDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Upload the certificate to the IoT hub. + + Adds new or replaces existing certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateBodyDescription + :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. + Required to update an existing certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_description, 'CertificateBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete an X509 certificate. + + Deletes an existing X509 certificate or does nothing if it does not exist. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def generate_verification_code( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateWithNonceDescription" + """Generate verification code for proof of possession flow. + + Generates verification code for proof of possession flow. The verification code will be used to + generate a leaf certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateWithNonceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateWithNonceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + def verify( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + certificate_verification_body, # type: "_models.CertificateVerificationDescription" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :param certificate_verification_body: The name of the certificate. + :type certificate_verification_body: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateVerificationDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py new file mode 100644 index 000000000000..0019b5e7c9de --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IotHubOperations(object): + """IotHubOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _manual_failover_initial( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + failover_input, # type: "_models.FailoverInput" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._manual_failover_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(failover_input, 'FailoverInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + 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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _manual_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore + + def begin_manual_failover( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + failover_input, # type: "_models.FailoverInput" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Manual Failover Fail over. + + Perform manual fail over of given hub. + + :param iot_hub_name: IotHub to fail over. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param failover_input: Region to failover to. Must be a azure DR pair. + :type failover_input: ~azure.mgmt.iothub.v2019_07_01_preview.models.FailoverInput + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._manual_failover_initial( + iot_hub_name=iot_hub_name, + resource_group_name=resource_group_name, + failover_input=failover_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_manual_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py new file mode 100644 index 000000000000..a30b829b5a0f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py @@ -0,0 +1,1879 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IotHubResourceOperations(object): + """IotHubResourceOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + """Get the non-security related metadata of an IoT hub. + + Get the non-security related metadata of an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_description, # type: "_models.IotHubDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_description, 'IotHubDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_description, # type: "_models.IotHubDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IotHubDescription"] + """Create or update the metadata of an IoT hub. + + Create or update the metadata of an Iot hub. The usual pattern to modify a property is to + retrieve the IoT hub metadata and security metadata, and then combine them with the modified + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param iot_hub_description: The IoT hub metadata and security metadata. + :type iot_hub_description: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription + :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required + to update an existing IoT Hub. + :type if_match: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_description=iot_hub_description, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IotHubDescription"] + """Update an existing IoT Hubs tags. + + Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param resource_name: Name of iot hub to update. + :type resource_name: str + :param iot_hub_tags: Updated tag information to set into the iot hub instance. + :type iot_hub_tags: ~azure.mgmt.iothub.v2019_07_01_preview.models.TagsResource + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_tags=iot_hub_tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + """Delete an IoT hub. + + Delete an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + 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_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubDescriptionListResult"] + """Get all the IoT hubs in a subscription. + + Get all the IoT hubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubDescriptionListResult"] + """Get all the IoT hubs in a resource group. + + Get all the IoT hubs in a resource group. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + def get_stats( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RegistryStatistics" + """Get the statistics from an IoT hub. + + Get the statistics from an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryStatistics, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.RegistryStatistics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_stats.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryStatistics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + + def get_valid_skus( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubSkuDescriptionListResult"] + """Get the list of valid SKUs for an IoT hub. + + Get the list of valid SKUs for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubSkuDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_valid_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubSkuDescriptionListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + + def list_event_hub_consumer_groups( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EventHubConsumerGroupsListResult"] + """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + + Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an + IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint. + :type event_hub_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_event_hub_consumer_groups.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubConsumerGroupsListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_event_hub_consumer_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'} # type: ignore + + def get_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EventHubConsumerGroupInfo" + """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to retrieve. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def create_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EventHubConsumerGroupInfo" + """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to add. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.create_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def delete_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to delete. + :type name: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def list_jobs( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.JobResponseListResult"] + """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get a list of all the jobs in an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResponseListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('JobResponseListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + + def get_job( + self, + resource_group_name, # type: str + resource_name, # type: str + job_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get the details of a job from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param job_id: The job identifier. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_job.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + + def get_quota_metrics( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubQuotaMetricInfoListResult"] + """Get the quota metrics for an IoT hub. + + Get the quota metrics for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubQuotaMetricInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_quota_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubQuotaMetricInfoListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + + def get_endpoint_health( + self, + resource_group_name, # type: str + iot_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointHealthDataListResult"] + """Get the health for routing endpoints. + + Get the health for routing endpoints. + + :param resource_group_name: + :type resource_group_name: str + :param iot_hub_name: + :type iot_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.EndpointHealthDataListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_endpoint_health.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EndpointHealthDataListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_endpoint_health.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth'} # type: ignore + + def check_name_availability( + self, + operation_inputs, # type: "_models.OperationInputs" + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubNameAvailabilityInfo" + """Check if an IoT hub name is available. + + Check if an IoT hub name is available. + + :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of + the IoT hub to check. + :type operation_inputs: ~azure.mgmt.iothub.v2019_07_01_preview.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubNameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.IotHubNameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(operation_inputs, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + + def test_all_routes( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + input, # type: "_models.TestAllRoutesInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestAllRoutesResult" + """Test all routes. + + Test all routes configured in this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Input for testing all routes. + :type input: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestAllRoutesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestAllRoutesResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestAllRoutesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_all_routes.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestAllRoutesInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_all_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'} # type: ignore + + def test_route( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + input, # type: "_models.TestRouteInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestRouteResult" + """Test the new route. + + Test the new route for this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Route that needs to be tested. + :type input: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestRouteResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.TestRouteResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_route.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestRouteInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestRouteResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessSignatureAuthorizationRuleListResult"] + """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get the security metadata for an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + + def get_keys_for_key_name( + self, + resource_group_name, # type: str + resource_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessSignatureAuthorizationRule" + """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get a shared access policy by name from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param key_name: The name of the shared access policy. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.SharedAccessSignatureAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_keys_for_key_name.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + + def export_devices( + self, + resource_group_name, # type: str + resource_name, # type: str + export_devices_parameters, # type: "_models.ExportDevicesRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Exports all the device identities in the IoT hub identity registry to an Azure Storage blob + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param export_devices_parameters: The parameters that specify the export devices operation. + :type export_devices_parameters: ~azure.mgmt.iothub.v2019_07_01_preview.models.ExportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.export_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + + def import_devices( + self, + resource_group_name, # type: str + resource_name, # type: str + import_devices_parameters, # type: "_models.ImportDevicesRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Import, update, or delete device identities in the IoT hub identity registry from a blob. For + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param import_devices_parameters: The parameters that specify the import devices operation. + :type import_devices_parameters: ~azure.mgmt.iothub.v2019_07_01_preview.models.ImportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py new file mode 100644 index 000000000000..e04f0241ccec --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available IoT Hub REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_07_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py new file mode 100644 index 000000000000..5a7eb697e6da --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_resource_provider_common_operations.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourceProviderCommonOperations(object): + """ResourceProviderCommonOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2019_07_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_subscription_quota( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.UserSubscriptionQuotaListResult" + """Get the number of iot hubs in the subscription. + + Get the number of free and paid iot hubs in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSubscriptionQuotaListResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2019_07_01_preview.models.UserSubscriptionQuotaListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_subscription_quota.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_quota.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py index 03d5edfa9ec0..277fbb5ae9ee 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_iot_hub_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import IotHubClientConfiguration from .operations import Operations @@ -30,15 +31,15 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.operations.Operations + :vartype operations: azure.mgmt.iothub.v2019_11_04.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2019_11_04.operations.IotHubResourceOperations :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: azure.mgmt.iothub.operations.ResourceProviderCommonOperations + :vartype resource_provider_common: azure.mgmt.iothub.v2019_11_04.operations.ResourceProviderCommonOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2019_11_04.operations.CertificatesOperations :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.operations.IotHubOperations + :vartype iot_hub: azure.mgmt.iothub.v2019_11_04.operations.IotHubOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. @@ -76,6 +77,24 @@ def __init__( self.iot_hub = IotHubOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json index cbcee74ec2c7..538a9c833663 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription identifier.", "docstring_type": "str", "required": true @@ -42,14 +44,58 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", @@ -57,9 +103,5 @@ "resource_provider_common": "ResourceProviderCommonOperations", "certificates": "CertificatesOperations", "iot_hub": "IotHubOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py index e5754a47ce68..ba617b3fa777 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "0.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py index ae994eecb9e3..7c30c0557b47 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/_iot_hub_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -28,15 +29,15 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.aio.operations.Operations + :vartype operations: azure.mgmt.iothub.v2019_11_04.aio.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.aio.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2019_11_04.aio.operations.IotHubResourceOperations :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: azure.mgmt.iothub.aio.operations.ResourceProviderCommonOperations + :vartype resource_provider_common: azure.mgmt.iothub.v2019_11_04.aio.operations.ResourceProviderCommonOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2019_11_04.aio.operations.CertificatesOperations :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.aio.operations.IotHubOperations + :vartype iot_hub: azure.mgmt.iothub.v2019_11_04.aio.operations.IotHubOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. @@ -73,6 +74,23 @@ def __init__( self.iot_hub = IotHubOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py index be1248a63b86..d73a25442cf3 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py @@ -25,7 +25,7 @@ class CertificatesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -56,7 +56,7 @@ async def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -90,7 +90,7 @@ async def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -120,7 +120,7 @@ async def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -155,7 +155,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -186,13 +186,13 @@ async def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2019_11_04.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -234,7 +234,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -307,7 +307,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,7 +338,7 @@ async def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -374,7 +374,7 @@ async def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -408,10 +408,10 @@ async def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2019_11_04.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -452,7 +452,7 @@ async def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py index 15f63f062b71..85a3fb0f95e4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py @@ -27,7 +27,7 @@ class IotHubOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -85,7 +85,7 @@ async def _manual_failover_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -112,11 +112,11 @@ async def begin_manual_failover( :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see https://aka.ms/manualfailover/region. - :type failover_input: ~azure.mgmt.iothub.models.FailoverInput + :type failover_input: ~azure.mgmt.iothub.v2019_11_04.models.FailoverInput :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py index 517b3238e635..0bac613fabcf 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py @@ -28,7 +28,7 @@ class IotHubResourceOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ async def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -150,7 +150,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -177,25 +177,27 @@ async def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -314,15 +316,15 @@ async def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2019_11_04.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -376,12 +378,10 @@ async def _delete_initial( resource_group_name: str, resource_name: str, **kwargs - ) -> Optional["_models.IotHubDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-04" @@ -408,9 +408,9 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -420,6 +420,9 @@ async def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -431,7 +434,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, **kwargs - ) -> AsyncLROPoller["_models.IotHubDescription"]: + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. Delete an IoT hub. @@ -442,16 +445,16 @@ async def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -505,7 +508,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -553,7 +556,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -577,7 +580,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -626,7 +629,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -653,7 +656,7 @@ async def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -687,7 +690,7 @@ async def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -714,7 +717,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -764,7 +767,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -795,7 +798,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -846,7 +849,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -879,7 +882,7 @@ async def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -915,7 +918,7 @@ async def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -948,7 +951,7 @@ async def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -984,7 +987,7 @@ async def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1053,7 +1056,7 @@ async def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1078,7 +1081,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_11_04.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1128,7 +1131,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1159,7 +1162,7 @@ async def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1194,7 +1197,7 @@ async def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1221,7 +1224,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_11_04.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1271,7 +1274,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1298,7 +1301,7 @@ def get_endpoint_health( :type iot_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EndpointHealthDataListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_11_04.models.EndpointHealthDataListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] @@ -1348,7 +1351,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1370,10 +1373,10 @@ async def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2019_11_04.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1410,7 +1413,7 @@ async def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1437,10 +1440,10 @@ async def test_all_routes( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Input for testing all routes. - :type input: ~azure.mgmt.iothub.models.TestAllRoutesInput + :type input: ~azure.mgmt.iothub.v2019_11_04.models.TestAllRoutesInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestAllRoutesResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestAllRoutesResult + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.TestAllRoutesResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] @@ -1479,7 +1482,7 @@ async def test_all_routes( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) @@ -1506,10 +1509,10 @@ async def test_route( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Route that needs to be tested. - :type input: ~azure.mgmt.iothub.models.TestRouteInput + :type input: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestRouteResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestRouteResult + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] @@ -1548,7 +1551,7 @@ async def test_route( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestRouteResult', pipeline_response) @@ -1576,7 +1579,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1626,7 +1629,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1657,7 +1660,7 @@ async def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1692,7 +1695,7 @@ async def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1713,18 +1716,18 @@ async def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2019_11_04.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1763,7 +1766,7 @@ async def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1784,18 +1787,18 @@ async def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2019_11_04.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1834,7 +1837,7 @@ async def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py index 979ebacfa3be..f9b29316cb08 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py @@ -26,7 +26,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,7 +49,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2019_11_04.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -93,7 +93,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py index 9c5b8746c889..971d90f6376d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py @@ -25,7 +25,7 @@ class ResourceProviderCommonOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -50,7 +50,7 @@ async def get_subscription_quota( :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSubscriptionQuotaListResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.UserSubscriptionQuotaListResult + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.UserSubscriptionQuotaListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] @@ -82,7 +82,7 @@ async def get_subscription_quota( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models.py index b486f7c7ac8e..10fcf5965e1d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models.py @@ -36,7 +36,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -78,7 +78,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription] """ _attribute_map = { @@ -235,7 +235,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -277,15 +277,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2019_11_04.models.FeedbackProperties """ _validation = { @@ -323,7 +323,7 @@ class EndpointHealthData(msrest.serialization.Model): the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected from this endpoint. Possible values include: "unknown", "healthy", "unhealthy", "dead". - :type health_status: str or ~azure.mgmt.iothub.models.EndpointHealthStatus + :type health_status: str or ~azure.mgmt.iothub.v2019_11_04.models.EndpointHealthStatus """ _attribute_map = { @@ -346,7 +346,7 @@ class EndpointHealthDataListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: JSON-serialized array of Endpoint health data. - :type value: list[~azure.mgmt.iothub.models.EndpointHealthData] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.EndpointHealthData] :ivar next_link: Link to more results. :vartype next_link: str """ @@ -495,7 +495,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -527,8 +527,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -631,7 +631,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -676,12 +676,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -748,7 +748,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubScaleType """ _validation = { @@ -843,9 +843,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: IotHub properties. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.IotHubProperties :param sku: Required. IotHub SKU info. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuInfo """ _validation = { @@ -883,7 +883,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -915,7 +915,7 @@ class IotHubLocationDescription(msrest.serialization.Model): where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. Possible values include: "primary", "secondary". - :type role: str or ~azure.mgmt.iothub.models.IotHubReplicaRoleType + :type role: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubReplicaRoleType """ _attribute_map = { @@ -941,7 +941,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -975,9 +975,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2019_11_04.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -987,30 +987,32 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible keys to this dictionary is events. This key has to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2019_11_04.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2019_11_04.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_11_04.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_11_04.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2019_11_04.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2019_11_04.models.Capabilities :ivar locations: Primary and secondary location for iot hub. - :vartype locations: list[~azure.mgmt.iothub.models.IotHubLocationDescription] + :vartype locations: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubLocationDescription] """ _validation = { @@ -1099,7 +1101,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1132,9 +1134,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuInfo :param capacity: Required. IotHub capacity. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2019_11_04.models.IotHubCapacity """ _validation = { @@ -1165,7 +1167,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1197,10 +1199,10 @@ class IotHubSkuInfo(msrest.serialization.Model): :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", "B1", "B2", "B3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", "Basic". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1236,7 +1238,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2019_11_04.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1278,10 +1280,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2019_11_04.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2019_11_04.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1333,7 +1335,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1360,7 +1362,7 @@ class MatchedRoute(msrest.serialization.Model): """Routes that matched. :param properties: Properties of routes that matched. - :type properties: ~azure.mgmt.iothub.models.RouteProperties + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.RouteProperties """ _attribute_map = { @@ -1378,12 +1380,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1441,7 +1443,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2019_11_04.models.OperationDisplay """ _validation = { @@ -1533,7 +1535,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2019_11_04.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1598,9 +1600,9 @@ class RouteCompilationError(msrest.serialization.Model): :param message: Route error message. :type message: str :param severity: Severity of the route error. Possible values include: "error", "warning". - :type severity: str or ~azure.mgmt.iothub.models.RouteErrorSeverity + :type severity: str or ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorSeverity :param location: Location where the route error happened. - :type location: ~azure.mgmt.iothub.models.RouteErrorRange + :type location: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorRange """ _attribute_map = { @@ -1646,9 +1648,9 @@ class RouteErrorRange(msrest.serialization.Model): """Range of route errors. :param start: Start where the route error happened. - :type start: ~azure.mgmt.iothub.models.RouteErrorPosition + :type start: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorPosition :param end: End where the route error happened. - :type end: ~azure.mgmt.iothub.models.RouteErrorPosition + :type end: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorPosition """ _attribute_map = { @@ -1677,7 +1679,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1722,17 +1724,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2019_11_04.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2019_11_04.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2019_11_04.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2019_11_04.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1828,19 +1831,19 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2019_11_04.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2019_11_04.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2019_11_04.models.FallbackRouteProperties :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. - :type enrichments: list[~azure.mgmt.iothub.models.EnrichmentProperties] + :type enrichments: list[~azure.mgmt.iothub.v2019_11_04.models.EnrichmentProperties] """ _attribute_map = { @@ -1976,7 +1979,8 @@ class RoutingStorageContainerProperties(msrest.serialization.Model): :param encoding: Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", "AvroDeflate", "JSON". - :type encoding: str or ~azure.mgmt.iothub.models.RoutingStorageContainerPropertiesEncoding + :type encoding: str or + ~azure.mgmt.iothub.v2019_11_04.models.RoutingStorageContainerPropertiesEncoding """ _validation = { @@ -2019,13 +2023,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: object + :type tags: str :param properties: - :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -2042,14 +2046,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: object + :type desired: str :param reported: Twin desired properties. - :type reported: object + :type reported: str """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, } def __init__( @@ -2079,7 +2083,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2019_11_04.models.AccessRights """ _validation = { @@ -2111,7 +2115,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -2140,8 +2144,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. @@ -2196,11 +2200,11 @@ class TestAllRoutesInput(msrest.serialization.Model): :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource + :type routing_source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2019_11_04.models.RoutingMessage :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwin """ _attribute_map = { @@ -2223,7 +2227,7 @@ class TestAllRoutesResult(msrest.serialization.Model): """Result of testing all routes. :param routes: JSON-serialized array of matched routes. - :type routes: list[~azure.mgmt.iothub.models.MatchedRoute] + :type routes: list[~azure.mgmt.iothub.v2019_11_04.models.MatchedRoute] """ _attribute_map = { @@ -2244,11 +2248,11 @@ class TestRouteInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2019_11_04.models.RoutingMessage :param route: Required. Route properties. - :type route: ~azure.mgmt.iothub.models.RouteProperties + :type route: ~azure.mgmt.iothub.v2019_11_04.models.RouteProperties :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwin """ _validation = { @@ -2275,9 +2279,9 @@ class TestRouteResult(msrest.serialization.Model): """Result of testing one route. :param result: Result of testing route. Possible values include: "undefined", "false", "true". - :type result: str or ~azure.mgmt.iothub.models.TestResultStatus + :type result: str or ~azure.mgmt.iothub.v2019_11_04.models.TestResultStatus :param details: Detailed result of testing route. - :type details: ~azure.mgmt.iothub.models.TestRouteResultDetails + :type details: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteResultDetails """ _attribute_map = { @@ -2298,7 +2302,7 @@ class TestRouteResultDetails(msrest.serialization.Model): """Detailed result of testing a route. :param compilation_errors: JSON-serialized list of route compilation errors. - :type compilation_errors: list[~azure.mgmt.iothub.models.RouteCompilationError] + :type compilation_errors: list[~azure.mgmt.iothub.v2019_11_04.models.RouteCompilationError] """ _attribute_map = { @@ -2327,7 +2331,7 @@ class UserSubscriptionQuota(msrest.serialization.Model): :param limit: Numerical limit on IotHub type. :type limit: int :param name: IotHub type. - :type name: ~azure.mgmt.iothub.models.Name + :type name: ~azure.mgmt.iothub.v2019_11_04.models.Name """ _attribute_map = { @@ -2358,7 +2362,7 @@ class UserSubscriptionQuotaListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: - :type value: list[~azure.mgmt.iothub.models.UserSubscriptionQuota] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.UserSubscriptionQuota] :ivar next_link: :vartype next_link: str """ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py index 43eca8e10737..17df9b4cea40 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py @@ -43,7 +43,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -87,7 +87,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription] """ _attribute_map = { @@ -250,7 +250,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -294,15 +294,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2019_11_04.models.FeedbackProperties """ _validation = { @@ -344,7 +344,7 @@ class EndpointHealthData(msrest.serialization.Model): the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected from this endpoint. Possible values include: "unknown", "healthy", "unhealthy", "dead". - :type health_status: str or ~azure.mgmt.iothub.models.EndpointHealthStatus + :type health_status: str or ~azure.mgmt.iothub.v2019_11_04.models.EndpointHealthStatus """ _attribute_map = { @@ -370,7 +370,7 @@ class EndpointHealthDataListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: JSON-serialized array of Endpoint health data. - :type value: list[~azure.mgmt.iothub.models.EndpointHealthData] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.EndpointHealthData] :ivar next_link: Link to more results. :vartype next_link: str """ @@ -527,7 +527,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -561,8 +561,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -673,7 +673,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -724,12 +724,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -803,7 +803,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubScaleType """ _validation = { @@ -901,9 +901,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: IotHub properties. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.IotHubProperties :param sku: Required. IotHub SKU info. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuInfo """ _validation = { @@ -947,7 +947,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -981,7 +981,7 @@ class IotHubLocationDescription(msrest.serialization.Model): where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. Possible values include: "primary", "secondary". - :type role: str or ~azure.mgmt.iothub.models.IotHubReplicaRoleType + :type role: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubReplicaRoleType """ _attribute_map = { @@ -1010,7 +1010,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -1046,9 +1046,9 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule] :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2019_11_04.models.IpFilterRule] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -1058,30 +1058,32 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible keys to this dictionary is events. This key has to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2019_11_04.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2019_11_04.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_11_04.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2019_11_04.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2019_11_04.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2019_11_04.models.Capabilities :ivar locations: Primary and secondary location for iot hub. - :vartype locations: list[~azure.mgmt.iothub.models.IotHubLocationDescription] + :vartype locations: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubLocationDescription] """ _validation = { @@ -1181,7 +1183,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1216,9 +1218,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuInfo :param capacity: Required. IotHub capacity. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2019_11_04.models.IotHubCapacity """ _validation = { @@ -1252,7 +1254,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1286,10 +1288,10 @@ class IotHubSkuInfo(msrest.serialization.Model): :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", "B1", "B2", "B3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", "Basic". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1328,7 +1330,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2019_11_04.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1374,10 +1376,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2019_11_04.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2019_11_04.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1429,7 +1431,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1458,7 +1460,7 @@ class MatchedRoute(msrest.serialization.Model): """Routes that matched. :param properties: Properties of routes that matched. - :type properties: ~azure.mgmt.iothub.models.RouteProperties + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.RouteProperties """ _attribute_map = { @@ -1478,12 +1480,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1548,7 +1550,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2019_11_04.models.OperationDisplay """ _validation = { @@ -1644,7 +1646,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2019_11_04.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1709,9 +1711,9 @@ class RouteCompilationError(msrest.serialization.Model): :param message: Route error message. :type message: str :param severity: Severity of the route error. Possible values include: "error", "warning". - :type severity: str or ~azure.mgmt.iothub.models.RouteErrorSeverity + :type severity: str or ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorSeverity :param location: Location where the route error happened. - :type location: ~azure.mgmt.iothub.models.RouteErrorRange + :type location: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorRange """ _attribute_map = { @@ -1764,9 +1766,9 @@ class RouteErrorRange(msrest.serialization.Model): """Range of route errors. :param start: Start where the route error happened. - :type start: ~azure.mgmt.iothub.models.RouteErrorPosition + :type start: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorPosition :param end: End where the route error happened. - :type end: ~azure.mgmt.iothub.models.RouteErrorPosition + :type end: ~azure.mgmt.iothub.v2019_11_04.models.RouteErrorPosition """ _attribute_map = { @@ -1798,7 +1800,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1849,17 +1851,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2019_11_04.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2019_11_04.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2019_11_04.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2019_11_04.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -1969,19 +1972,19 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2019_11_04.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2019_11_04.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2019_11_04.models.FallbackRouteProperties :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. - :type enrichments: list[~azure.mgmt.iothub.models.EnrichmentProperties] + :type enrichments: list[~azure.mgmt.iothub.v2019_11_04.models.EnrichmentProperties] """ _attribute_map = { @@ -2132,7 +2135,8 @@ class RoutingStorageContainerProperties(msrest.serialization.Model): :param encoding: Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", "AvroDeflate", "JSON". - :type encoding: str or ~azure.mgmt.iothub.models.RoutingStorageContainerPropertiesEncoding + :type encoding: str or + ~azure.mgmt.iothub.v2019_11_04.models.RoutingStorageContainerPropertiesEncoding """ _validation = { @@ -2185,20 +2189,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: object + :type tags: str :param properties: - :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + :type properties: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[object] = None, + tags: Optional[str] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2211,21 +2215,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: object + :type desired: str :param reported: Twin desired properties. - :type reported: object + :type reported: str """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, } def __init__( self, *, - desired: Optional[object] = None, - reported: Optional[object] = None, + desired: Optional[str] = None, + reported: Optional[str] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) @@ -2251,7 +2255,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2019_11_04.models.AccessRights """ _validation = { @@ -2288,7 +2292,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -2319,8 +2323,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. @@ -2381,11 +2385,11 @@ class TestAllRoutesInput(msrest.serialization.Model): :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource + :type routing_source: str or ~azure.mgmt.iothub.v2019_11_04.models.RoutingSource :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2019_11_04.models.RoutingMessage :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwin """ _attribute_map = { @@ -2412,7 +2416,7 @@ class TestAllRoutesResult(msrest.serialization.Model): """Result of testing all routes. :param routes: JSON-serialized array of matched routes. - :type routes: list[~azure.mgmt.iothub.models.MatchedRoute] + :type routes: list[~azure.mgmt.iothub.v2019_11_04.models.MatchedRoute] """ _attribute_map = { @@ -2435,11 +2439,11 @@ class TestRouteInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2019_11_04.models.RoutingMessage :param route: Required. Route properties. - :type route: ~azure.mgmt.iothub.models.RouteProperties + :type route: ~azure.mgmt.iothub.v2019_11_04.models.RouteProperties :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwin """ _validation = { @@ -2470,9 +2474,9 @@ class TestRouteResult(msrest.serialization.Model): """Result of testing one route. :param result: Result of testing route. Possible values include: "undefined", "false", "true". - :type result: str or ~azure.mgmt.iothub.models.TestResultStatus + :type result: str or ~azure.mgmt.iothub.v2019_11_04.models.TestResultStatus :param details: Detailed result of testing route. - :type details: ~azure.mgmt.iothub.models.TestRouteResultDetails + :type details: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteResultDetails """ _attribute_map = { @@ -2496,7 +2500,7 @@ class TestRouteResultDetails(msrest.serialization.Model): """Detailed result of testing a route. :param compilation_errors: JSON-serialized list of route compilation errors. - :type compilation_errors: list[~azure.mgmt.iothub.models.RouteCompilationError] + :type compilation_errors: list[~azure.mgmt.iothub.v2019_11_04.models.RouteCompilationError] """ _attribute_map = { @@ -2527,7 +2531,7 @@ class UserSubscriptionQuota(msrest.serialization.Model): :param limit: Numerical limit on IotHub type. :type limit: int :param name: IotHub type. - :type name: ~azure.mgmt.iothub.models.Name + :type name: ~azure.mgmt.iothub.v2019_11_04.models.Name """ _attribute_map = { @@ -2565,7 +2569,7 @@ class UserSubscriptionQuotaListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: - :type value: list[~azure.mgmt.iothub.models.UserSubscriptionQuota] + :type value: list[~azure.mgmt.iothub.v2019_11_04.models.UserSubscriptionQuota] :ivar next_link: :vartype next_link: str """ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py index ab2cf86e096f..eab4242d29dd 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_certificates_operations.py @@ -29,7 +29,7 @@ class CertificatesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -61,7 +61,7 @@ def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -95,7 +95,7 @@ def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -126,7 +126,7 @@ def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -161,7 +161,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -193,13 +193,13 @@ def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2019_11_04.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -241,7 +241,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -315,7 +315,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -347,7 +347,7 @@ def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -383,7 +383,7 @@ def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -418,10 +418,10 @@ def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2019_11_04.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -462,7 +462,7 @@ def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py index ecaf2d91355d..ff32b7e36f4d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py @@ -31,7 +31,7 @@ class IotHubOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -90,7 +90,7 @@ def _manual_failover_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -118,11 +118,11 @@ def begin_manual_failover( :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see https://aka.ms/manualfailover/region. - :type failover_input: ~azure.mgmt.iothub.models.FailoverInput + :type failover_input: ~azure.mgmt.iothub.v2019_11_04.models.FailoverInput :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py index 26ad626a2782..cdd0a11789c1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py @@ -32,7 +32,7 @@ class IotHubResourceOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,7 +64,7 @@ def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -156,7 +156,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -184,25 +184,27 @@ def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -323,15 +325,15 @@ def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2019_11_04.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -386,12 +388,10 @@ def _delete_initial( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["_models.IotHubDescription"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-04" @@ -418,9 +418,9 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -430,6 +430,9 @@ def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -442,7 +445,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.IotHubDescription"] + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] """Delete an IoT hub. Delete an IoT hub. @@ -453,16 +456,16 @@ def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -517,7 +520,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -565,7 +568,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -590,7 +593,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_11_04.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -639,7 +642,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -667,7 +670,7 @@ def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -701,7 +704,7 @@ def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -729,7 +732,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_11_04.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -779,7 +782,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -811,7 +814,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -862,7 +865,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -896,7 +899,7 @@ def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -932,7 +935,7 @@ def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -966,7 +969,7 @@ def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -1002,7 +1005,7 @@ def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1072,7 +1075,7 @@ def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1098,7 +1101,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_11_04.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1148,7 +1151,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1180,7 +1183,7 @@ def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1215,7 +1218,7 @@ def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1243,7 +1246,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_11_04.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1293,7 +1296,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1321,7 +1324,7 @@ def get_endpoint_health( :type iot_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EndpointHealthDataListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_11_04.models.EndpointHealthDataListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] @@ -1371,7 +1374,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1394,10 +1397,10 @@ def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2019_11_04.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1434,7 +1437,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1462,10 +1465,10 @@ def test_all_routes( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Input for testing all routes. - :type input: ~azure.mgmt.iothub.models.TestAllRoutesInput + :type input: ~azure.mgmt.iothub.v2019_11_04.models.TestAllRoutesInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestAllRoutesResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestAllRoutesResult + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.TestAllRoutesResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] @@ -1504,7 +1507,7 @@ def test_all_routes( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) @@ -1532,10 +1535,10 @@ def test_route( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Route that needs to be tested. - :type input: ~azure.mgmt.iothub.models.TestRouteInput + :type input: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestRouteResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestRouteResult + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.TestRouteResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] @@ -1574,7 +1577,7 @@ def test_route( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestRouteResult', pipeline_response) @@ -1603,7 +1606,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1653,7 +1656,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1685,7 +1688,7 @@ def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1720,7 +1723,7 @@ def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1742,18 +1745,18 @@ def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2019_11_04.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1792,7 +1795,7 @@ def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1814,18 +1817,18 @@ def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2019_11_04.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1864,7 +1867,7 @@ def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py index e4ad7d7a801a..4c3e7b8e5e61 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_operations.py @@ -30,7 +30,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2019_11_04.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py index b14ba2b8f042..bc1af5678f51 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_resource_provider_common_operations.py @@ -29,7 +29,7 @@ class ResourceProviderCommonOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2019_11_04.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -55,7 +55,7 @@ def get_subscription_quota( :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSubscriptionQuotaListResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.UserSubscriptionQuotaListResult + :rtype: ~azure.mgmt.iothub.v2019_11_04.models.UserSubscriptionQuotaListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] @@ -87,7 +87,7 @@ def get_subscription_quota( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py index 1654f2c1ad7e..9e90abda68f1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_iot_hub_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import IotHubClientConfiguration from .operations import Operations @@ -32,19 +33,19 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.operations.Operations + :vartype operations: azure.mgmt.iothub.v2020_03_01.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2020_03_01.operations.IotHubResourceOperations :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: azure.mgmt.iothub.operations.ResourceProviderCommonOperations + :vartype resource_provider_common: azure.mgmt.iothub.v2020_03_01.operations.ResourceProviderCommonOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2020_03_01.operations.CertificatesOperations :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.operations.IotHubOperations + :vartype iot_hub: azure.mgmt.iothub.v2020_03_01.operations.IotHubOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.iothub.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: azure.mgmt.iothub.v2020_03_01.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.iothub.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: azure.mgmt.iothub.v2020_03_01.operations.PrivateEndpointConnectionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. @@ -86,6 +87,24 @@ def __init__( self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json index 58ed29ed7069..2f9d36ad7464 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription identifier.", "docstring_type": "str", "required": true @@ -42,14 +44,58 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", @@ -59,9 +105,5 @@ "iot_hub": "IotHubOperations", "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py index e5754a47ce68..ba617b3fa777 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "0.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py index d38cc89f1e54..a39b4f027ee4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/_iot_hub_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -30,19 +31,19 @@ class IotHubClient(object): """Use this API to manage the IoT hubs in your Azure subscription. :ivar operations: Operations operations - :vartype operations: azure.mgmt.iothub.aio.operations.Operations + :vartype operations: azure.mgmt.iothub.v2020_03_01.aio.operations.Operations :ivar iot_hub_resource: IotHubResourceOperations operations - :vartype iot_hub_resource: azure.mgmt.iothub.aio.operations.IotHubResourceOperations + :vartype iot_hub_resource: azure.mgmt.iothub.v2020_03_01.aio.operations.IotHubResourceOperations :ivar resource_provider_common: ResourceProviderCommonOperations operations - :vartype resource_provider_common: azure.mgmt.iothub.aio.operations.ResourceProviderCommonOperations + :vartype resource_provider_common: azure.mgmt.iothub.v2020_03_01.aio.operations.ResourceProviderCommonOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.iothub.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.iothub.v2020_03_01.aio.operations.CertificatesOperations :ivar iot_hub: IotHubOperations operations - :vartype iot_hub: azure.mgmt.iothub.aio.operations.IotHubOperations + :vartype iot_hub: azure.mgmt.iothub.v2020_03_01.aio.operations.IotHubOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.iothub.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: azure.mgmt.iothub.v2020_03_01.aio.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.iothub.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: azure.mgmt.iothub.v2020_03_01.aio.operations.PrivateEndpointConnectionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. @@ -83,6 +84,23 @@ def __init__( self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py index 25c9affa2def..955e866bfcb8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py @@ -25,7 +25,7 @@ class CertificatesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -56,7 +56,7 @@ async def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -90,7 +90,7 @@ async def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -120,7 +120,7 @@ async def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -155,7 +155,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -186,13 +186,13 @@ async def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2020_03_01.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -234,7 +234,7 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -307,7 +307,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,7 +338,7 @@ async def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -374,7 +374,7 @@ async def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -408,10 +408,10 @@ async def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2020_03_01.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -452,7 +452,7 @@ async def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py index 2a06f155315d..6ccccbceeacb 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py @@ -27,7 +27,7 @@ class IotHubOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -85,7 +85,7 @@ async def _manual_failover_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -112,11 +112,11 @@ async def begin_manual_failover( :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see https://aka.ms/manualfailover/region. - :type failover_input: ~azure.mgmt.iothub.models.FailoverInput + :type failover_input: ~azure.mgmt.iothub.v2020_03_01.models.FailoverInput :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py index 0e95700d3b7d..795b7eadc29b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py @@ -28,7 +28,7 @@ class IotHubResourceOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ async def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -93,7 +93,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -150,7 +150,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -177,25 +177,27 @@ async def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -314,15 +316,15 @@ async def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2020_03_01.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -376,12 +378,10 @@ async def _delete_initial( resource_group_name: str, resource_name: str, **kwargs - ) -> Optional["_models.IotHubDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-03-01" @@ -408,9 +408,9 @@ async def _delete_initial( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -420,6 +420,9 @@ async def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -431,7 +434,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, **kwargs - ) -> AsyncLROPoller["_models.IotHubDescription"]: + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. Delete an IoT hub. @@ -442,16 +445,16 @@ async def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -505,7 +508,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -553,7 +556,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -577,7 +580,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -626,7 +629,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -653,7 +656,7 @@ async def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -687,7 +690,7 @@ async def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -714,7 +717,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -764,7 +767,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -795,7 +798,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -846,7 +849,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -879,7 +882,7 @@ async def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -915,7 +918,7 @@ async def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -948,7 +951,7 @@ async def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -984,7 +987,7 @@ async def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1053,7 +1056,7 @@ async def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1078,7 +1081,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2020_03_01.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1128,7 +1131,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1159,7 +1162,7 @@ async def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1194,7 +1197,7 @@ async def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1221,7 +1224,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2020_03_01.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1271,7 +1274,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1298,7 +1301,7 @@ def get_endpoint_health( :type iot_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.EndpointHealthDataListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2020_03_01.models.EndpointHealthDataListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] @@ -1348,7 +1351,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1370,10 +1373,10 @@ async def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2020_03_01.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1410,7 +1413,7 @@ async def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1437,10 +1440,10 @@ async def test_all_routes( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Input for testing all routes. - :type input: ~azure.mgmt.iothub.models.TestAllRoutesInput + :type input: ~azure.mgmt.iothub.v2020_03_01.models.TestAllRoutesInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestAllRoutesResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestAllRoutesResult + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.TestAllRoutesResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] @@ -1479,7 +1482,7 @@ async def test_all_routes( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) @@ -1506,10 +1509,10 @@ async def test_route( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Route that needs to be tested. - :type input: ~azure.mgmt.iothub.models.TestRouteInput + :type input: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestRouteResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestRouteResult + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] @@ -1548,7 +1551,7 @@ async def test_route( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestRouteResult', pipeline_response) @@ -1576,7 +1579,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1626,7 +1629,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1657,7 +1660,7 @@ async def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1692,7 +1695,7 @@ async def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1713,18 +1716,18 @@ async def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2020_03_01.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1763,7 +1766,7 @@ async def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1784,18 +1787,18 @@ async def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2020_03_01.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1834,7 +1837,7 @@ async def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py index 144eac6e3207..84bdf1d834f6 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py @@ -26,7 +26,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -49,7 +49,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2020_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -93,7 +93,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py index 76731069c12b..12bdfa137783 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py @@ -27,7 +27,7 @@ class PrivateEndpointConnectionsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -58,7 +58,7 @@ async def list( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of PrivateEndpointConnection, or the result of cls(response) - :rtype: list[~azure.mgmt.iothub.models.PrivateEndpointConnection] + :rtype: list[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] @@ -92,7 +92,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[PrivateEndpointConnection]', pipeline_response) @@ -122,7 +122,7 @@ async def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -157,7 +157,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -213,7 +213,7 @@ async def _update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -247,15 +247,15 @@ async def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. - :type private_endpoint_connection: ~azure.mgmt.iothub.models.PrivateEndpointConnection + :type private_endpoint_connection: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.PrivateEndpointConnection] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -345,7 +345,7 @@ async def _delete_initial( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -380,12 +380,12 @@ async def begin_delete( :type private_endpoint_connection_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.models.PrivateEndpointConnection] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py index 8ddc1dc3f4fb..c59c99ccec7a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py @@ -25,7 +25,7 @@ class PrivateLinkResourcesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -56,7 +56,7 @@ async def list( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResources, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.PrivateLinkResources + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkResources :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] @@ -90,7 +90,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResources', pipeline_response) @@ -120,7 +120,7 @@ async def get( :type group_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupIdInformation, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.GroupIdInformation + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformation :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] @@ -155,7 +155,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GroupIdInformation', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py index f3ef5edbc315..c8d34f0a0c44 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py @@ -25,7 +25,7 @@ class ResourceProviderCommonOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -50,7 +50,7 @@ async def get_subscription_quota( :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSubscriptionQuotaListResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.UserSubscriptionQuotaListResult + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.UserSubscriptionQuotaListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] @@ -82,7 +82,7 @@ async def get_subscription_quota( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models.py index 22b704b6f280..7211387af228 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models.py @@ -36,7 +36,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -78,7 +78,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription] """ _attribute_map = { @@ -235,7 +235,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -277,15 +277,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2020_03_01.models.FeedbackProperties """ _validation = { @@ -323,7 +323,7 @@ class EndpointHealthData(msrest.serialization.Model): the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected from this endpoint. Possible values include: "unknown", "healthy", "unhealthy", "dead". - :type health_status: str or ~azure.mgmt.iothub.models.EndpointHealthStatus + :type health_status: str or ~azure.mgmt.iothub.v2020_03_01.models.EndpointHealthStatus """ _attribute_map = { @@ -346,7 +346,7 @@ class EndpointHealthDataListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: JSON-serialized array of Endpoint health data. - :type value: list[~azure.mgmt.iothub.models.EndpointHealthData] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.EndpointHealthData] :ivar next_link: Link to more results. :vartype next_link: str """ @@ -495,7 +495,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -527,8 +527,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -579,7 +579,7 @@ class ExportDevicesRequest(msrest.serialization.Model): :type export_blob_name: str :param authentication_type: Specifies authentication type being used for connecting to the storage account. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType """ _validation = { @@ -641,7 +641,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -686,12 +686,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -729,12 +729,12 @@ class GroupIdInformation(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :param properties: Required. The properties for a group information object. - :type properties: ~azure.mgmt.iothub.models.GroupIdInformationProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformationProperties """ _validation = { 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'name': {'readonly': True}, 'type': {'readonly': True}, 'properties': {'required': True}, } @@ -800,7 +800,7 @@ class ImportDevicesRequest(msrest.serialization.Model): :type output_blob_name: str :param authentication_type: Specifies authentication type being used for connecting to the storage account. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType """ _validation = { @@ -841,7 +841,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubScaleType """ _validation = { @@ -936,9 +936,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: IotHub properties. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.IotHubProperties :param sku: Required. IotHub SKU info. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuInfo """ _validation = { @@ -976,7 +976,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1008,7 +1008,7 @@ class IotHubLocationDescription(msrest.serialization.Model): where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. Possible values include: "primary", "secondary". - :type role: str or ~azure.mgmt.iothub.models.IotHubReplicaRoleType + :type role: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubReplicaRoleType """ _attribute_map = { @@ -1034,7 +1034,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -1068,17 +1068,18 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule] :param public_network_access: Whether requests from Public Network are allowed. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.iothub.models.PublicNetworkAccess + :type public_network_access: str or ~azure.mgmt.iothub.v2020_03_01.models.PublicNetworkAccess :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2020_03_01.models.IpFilterRule] :param min_tls_version: Specifies the minimum TLS version to support for this hub. Can be set to "1.2" to have clients that use a TLS version below 1.2 to be rejected. :type min_tls_version: str :param private_endpoint_connections: Private endpoint connections created on this IotHub. - :type private_endpoint_connections: list[~azure.mgmt.iothub.models.PrivateEndpointConnection] + :type private_endpoint_connections: + list[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -1088,30 +1089,32 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible keys to this dictionary is events. This key has to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2020_03_01.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2020_03_01.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2020_03_01.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2020_03_01.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2020_03_01.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2020_03_01.models.Capabilities :ivar locations: Primary and secondary location for iot hub. - :vartype locations: list[~azure.mgmt.iothub.models.IotHubLocationDescription] + :vartype locations: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubLocationDescription] """ _validation = { @@ -1206,7 +1209,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1239,9 +1242,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuInfo :param capacity: Required. IotHub capacity. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2020_03_01.models.IotHubCapacity """ _validation = { @@ -1272,7 +1275,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1304,10 +1307,10 @@ class IotHubSkuInfo(msrest.serialization.Model): :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", "B1", "B2", "B3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", "Basic". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1343,7 +1346,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2020_03_01.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1385,10 +1388,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2020_03_01.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2020_03_01.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1440,7 +1443,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1467,7 +1470,7 @@ class MatchedRoute(msrest.serialization.Model): """Routes that matched. :param properties: Properties of routes that matched. - :type properties: ~azure.mgmt.iothub.models.RouteProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.RouteProperties """ _attribute_map = { @@ -1485,12 +1488,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1548,7 +1551,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2020_03_01.models.OperationDisplay """ _validation = { @@ -1640,7 +1643,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2020_03_01.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1703,12 +1706,12 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :param properties: Required. The properties of a private endpoint connection. - :type properties: ~azure.mgmt.iothub.models.PrivateEndpointConnectionProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnectionProperties """ _validation = { 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'name': {'readonly': True}, 'type': {'readonly': True}, 'properties': {'required': True}, } @@ -1737,11 +1740,11 @@ class PrivateEndpointConnectionProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param private_endpoint: The private endpoint property of a private endpoint connection. - :type private_endpoint: ~azure.mgmt.iothub.models.PrivateEndpoint + :type private_endpoint: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpoint :param private_link_service_connection_state: Required. The current state of a private endpoint connection. :type private_link_service_connection_state: - ~azure.mgmt.iothub.models.PrivateLinkServiceConnectionState + ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkServiceConnectionState """ _validation = { @@ -1766,7 +1769,7 @@ class PrivateLinkResources(msrest.serialization.Model): """The available private link resources for an IotHub. :param value: The list of available private link resources for an IotHub. - :type value: list[~azure.mgmt.iothub.models.GroupIdInformation] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformation] """ _attribute_map = { @@ -1788,7 +1791,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): :param status: Required. The status of a private endpoint connection. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.iothub.models.PrivateLinkServiceConnectionStatus + :type status: str or ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkServiceConnectionStatus :param description: Required. The description for the current state of a private endpoint connection. :type description: str @@ -1858,9 +1861,9 @@ class RouteCompilationError(msrest.serialization.Model): :param message: Route error message. :type message: str :param severity: Severity of the route error. Possible values include: "error", "warning". - :type severity: str or ~azure.mgmt.iothub.models.RouteErrorSeverity + :type severity: str or ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorSeverity :param location: Location where the route error happened. - :type location: ~azure.mgmt.iothub.models.RouteErrorRange + :type location: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorRange """ _attribute_map = { @@ -1906,9 +1909,9 @@ class RouteErrorRange(msrest.serialization.Model): """Range of route errors. :param start: Start where the route error happened. - :type start: ~azure.mgmt.iothub.models.RouteErrorPosition + :type start: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorPosition :param end: End where the route error happened. - :type end: ~azure.mgmt.iothub.models.RouteErrorPosition + :type end: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorPosition """ _attribute_map = { @@ -1937,7 +1940,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -1982,17 +1985,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2020_03_01.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2020_03_01.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2020_03_01.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2020_03_01.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -2028,7 +2032,7 @@ class RoutingEventHubProperties(msrest.serialization.Model): :type entity_path: str :param authentication_type: Method used to authenticate against the event hub endpoint. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType :param name: Required. The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, fileNotifications, $default. Endpoint @@ -2104,19 +2108,19 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2020_03_01.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2020_03_01.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2020_03_01.models.FallbackRouteProperties :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. - :type enrichments: list[~azure.mgmt.iothub.models.EnrichmentProperties] + :type enrichments: list[~azure.mgmt.iothub.v2020_03_01.models.EnrichmentProperties] """ _attribute_map = { @@ -2153,7 +2157,7 @@ class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): :type entity_path: str :param authentication_type: Method used to authenticate against the service bus queue endpoint. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType :param name: Required. The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, fileNotifications, $default. Endpoint @@ -2212,7 +2216,7 @@ class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): :type entity_path: str :param authentication_type: Method used to authenticate against the service bus topic endpoint. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType :param name: Required. The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, fileNotifications, $default. Endpoint @@ -2268,7 +2272,7 @@ class RoutingStorageContainerProperties(msrest.serialization.Model): :type endpoint_uri: str :param authentication_type: Method used to authenticate against the storage endpoint. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType :param name: Required. The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, fileNotifications, $default. Endpoint @@ -2293,7 +2297,8 @@ class RoutingStorageContainerProperties(msrest.serialization.Model): :param encoding: Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", "AvroDeflate", "JSON". - :type encoding: str or ~azure.mgmt.iothub.models.RoutingStorageContainerPropertiesEncoding + :type encoding: str or + ~azure.mgmt.iothub.v2020_03_01.models.RoutingStorageContainerPropertiesEncoding """ _validation = { @@ -2341,13 +2346,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: object + :type tags: str :param properties: - :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -2364,14 +2369,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: object + :type desired: str :param reported: Twin desired properties. - :type reported: object + :type reported: str """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, } def __init__( @@ -2401,7 +2406,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2020_03_01.models.AccessRights """ _validation = { @@ -2433,7 +2438,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -2462,8 +2467,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. @@ -2473,7 +2478,7 @@ class StorageEndpointProperties(msrest.serialization.Model): :type container_name: str :param authentication_type: Specifies authentication type being used for connecting to the storage account. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType """ _validation = { @@ -2523,11 +2528,11 @@ class TestAllRoutesInput(msrest.serialization.Model): :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource + :type routing_source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2020_03_01.models.RoutingMessage :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwin """ _attribute_map = { @@ -2550,7 +2555,7 @@ class TestAllRoutesResult(msrest.serialization.Model): """Result of testing all routes. :param routes: JSON-serialized array of matched routes. - :type routes: list[~azure.mgmt.iothub.models.MatchedRoute] + :type routes: list[~azure.mgmt.iothub.v2020_03_01.models.MatchedRoute] """ _attribute_map = { @@ -2571,11 +2576,11 @@ class TestRouteInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2020_03_01.models.RoutingMessage :param route: Required. Route properties. - :type route: ~azure.mgmt.iothub.models.RouteProperties + :type route: ~azure.mgmt.iothub.v2020_03_01.models.RouteProperties :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwin """ _validation = { @@ -2602,9 +2607,9 @@ class TestRouteResult(msrest.serialization.Model): """Result of testing one route. :param result: Result of testing route. Possible values include: "undefined", "false", "true". - :type result: str or ~azure.mgmt.iothub.models.TestResultStatus + :type result: str or ~azure.mgmt.iothub.v2020_03_01.models.TestResultStatus :param details: Detailed result of testing route. - :type details: ~azure.mgmt.iothub.models.TestRouteResultDetails + :type details: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteResultDetails """ _attribute_map = { @@ -2625,7 +2630,7 @@ class TestRouteResultDetails(msrest.serialization.Model): """Detailed result of testing a route. :param compilation_errors: JSON-serialized list of route compilation errors. - :type compilation_errors: list[~azure.mgmt.iothub.models.RouteCompilationError] + :type compilation_errors: list[~azure.mgmt.iothub.v2020_03_01.models.RouteCompilationError] """ _attribute_map = { @@ -2654,7 +2659,7 @@ class UserSubscriptionQuota(msrest.serialization.Model): :param limit: Numerical limit on IotHub type. :type limit: int :param name: IotHub type. - :type name: ~azure.mgmt.iothub.models.Name + :type name: ~azure.mgmt.iothub.v2020_03_01.models.Name """ _attribute_map = { @@ -2685,7 +2690,7 @@ class UserSubscriptionQuotaListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: - :type value: list[~azure.mgmt.iothub.models.UserSubscriptionQuota] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.UserSubscriptionQuota] :ivar next_link: :vartype next_link: str """ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py index 86b7fdc10e7f..9d3043420cce 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py @@ -43,7 +43,7 @@ class CertificateDescription(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The description of an X509 CA Certificate. - :type properties: ~azure.mgmt.iothub.models.CertificateProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.CertificateProperties :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -87,7 +87,7 @@ class CertificateListDescription(msrest.serialization.Model): """The JSON-serialized array of Certificate objects. :param value: The array of Certificate objects. - :type value: list[~azure.mgmt.iothub.models.CertificateDescription] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription] """ _attribute_map = { @@ -250,7 +250,7 @@ class CertificateWithNonceDescription(msrest.serialization.Model): :param properties: The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. - :type properties: ~azure.mgmt.iothub.models.CertificatePropertiesWithNonce + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.CertificatePropertiesWithNonce :ivar id: The resource identifier. :vartype id: str :ivar name: The name of the certificate. @@ -294,15 +294,15 @@ class CloudToDeviceProperties(msrest.serialization.Model): """The IoT hub cloud-to-device messaging properties. :param max_delivery_count: The max delivery count for cloud-to-device messages in the device - queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to- - device-messages. + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the - device queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type default_ttl_as_iso8601: ~datetime.timedelta :param feedback: The properties of the feedback queue for cloud-to-device messages. - :type feedback: ~azure.mgmt.iothub.models.FeedbackProperties + :type feedback: ~azure.mgmt.iothub.v2020_03_01.models.FeedbackProperties """ _validation = { @@ -344,7 +344,7 @@ class EndpointHealthData(msrest.serialization.Model): the IoT Hub has not established a connection with the endpoint. No messages have been delivered to or rejected from this endpoint. Possible values include: "unknown", "healthy", "unhealthy", "dead". - :type health_status: str or ~azure.mgmt.iothub.models.EndpointHealthStatus + :type health_status: str or ~azure.mgmt.iothub.v2020_03_01.models.EndpointHealthStatus """ _attribute_map = { @@ -370,7 +370,7 @@ class EndpointHealthDataListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: JSON-serialized array of Endpoint health data. - :type value: list[~azure.mgmt.iothub.models.EndpointHealthData] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.EndpointHealthData] :ivar next_link: Link to more results. :vartype next_link: str """ @@ -527,7 +527,7 @@ class EventHubConsumerGroupsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of consumer groups objects. - :type value: list[~azure.mgmt.iothub.models.EventHubConsumerGroupInfo] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -561,8 +561,8 @@ class EventHubProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type retention_time_in_days: long :param partition_count: The number of partitions for receiving device-to-cloud messages in the - Event Hub-compatible endpoint. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#device-to-cloud-messages. + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. :type partition_count: int :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. :vartype partition_ids: list[str] @@ -616,7 +616,7 @@ class ExportDevicesRequest(msrest.serialization.Model): :type export_blob_name: str :param authentication_type: Specifies authentication type being used for connecting to the storage account. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType """ _validation = { @@ -685,7 +685,7 @@ class FallbackRouteProperties(msrest.serialization.Model): :param source: Required. The source to which the routing rule is to be applied to. For example, DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource :param condition: The condition which is evaluated in order to apply the fallback route. If the condition is not provided it will evaluate to true by default. For grammar, See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -736,12 +736,12 @@ class FeedbackProperties(msrest.serialization.Model): https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide- - messaging#cloud-to-device-messages. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the - feedback queue. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud- - to-device-messages. + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. :type max_delivery_count: int """ @@ -783,12 +783,12 @@ class GroupIdInformation(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :param properties: Required. The properties for a group information object. - :type properties: ~azure.mgmt.iothub.models.GroupIdInformationProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformationProperties """ _validation = { 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'name': {'readonly': True}, 'type': {'readonly': True}, 'properties': {'required': True}, } @@ -860,7 +860,7 @@ class ImportDevicesRequest(msrest.serialization.Model): :type output_blob_name: str :param authentication_type: Specifies authentication type being used for connecting to the storage account. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType """ _validation = { @@ -907,7 +907,7 @@ class IotHubCapacity(msrest.serialization.Model): :vartype default: long :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", "Manual", "None". - :vartype scale_type: str or ~azure.mgmt.iothub.models.IotHubScaleType + :vartype scale_type: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubScaleType """ _validation = { @@ -1005,9 +1005,9 @@ class IotHubDescription(Resource): also be provided as a header per the normal ETag convention. :type etag: str :param properties: IotHub properties. - :type properties: ~azure.mgmt.iothub.models.IotHubProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.IotHubProperties :param sku: Required. IotHub SKU info. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuInfo """ _validation = { @@ -1051,7 +1051,7 @@ class IotHubDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubDescription objects. - :type value: list[~azure.mgmt.iothub.models.IotHubDescription] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1085,7 +1085,7 @@ class IotHubLocationDescription(msrest.serialization.Model): where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired region and also the region where the IoT hub can failover to. Possible values include: "primary", "secondary". - :type role: str or ~azure.mgmt.iothub.models.IotHubReplicaRoleType + :type role: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubReplicaRoleType """ _attribute_map = { @@ -1114,7 +1114,7 @@ class IotHubNameAvailabilityInfo(msrest.serialization.Model): :vartype name_available: bool :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". - :vartype reason: str or ~azure.mgmt.iothub.models.IotHubNameUnavailabilityReason + :vartype reason: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubNameUnavailabilityReason :param message: The detailed reason message. :type message: str """ @@ -1150,17 +1150,18 @@ class IotHubProperties(msrest.serialization.Model): :param authorization_policies: The shared access policies you can use to secure a connection to the IoT hub. :type authorization_policies: - list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + list[~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule] :param public_network_access: Whether requests from Public Network are allowed. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.iothub.models.PublicNetworkAccess + :type public_network_access: str or ~azure.mgmt.iothub.v2020_03_01.models.PublicNetworkAccess :param ip_filter_rules: The IP filter rules. - :type ip_filter_rules: list[~azure.mgmt.iothub.models.IpFilterRule] + :type ip_filter_rules: list[~azure.mgmt.iothub.v2020_03_01.models.IpFilterRule] :param min_tls_version: Specifies the minimum TLS version to support for this hub. Can be set to "1.2" to have clients that use a TLS version below 1.2 to be rejected. :type min_tls_version: str :param private_endpoint_connections: Private endpoint connections created on this IotHub. - :type private_endpoint_connections: list[~azure.mgmt.iothub.models.PrivateEndpointConnection] + :type private_endpoint_connections: + list[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str :ivar state: The hub state. @@ -1170,30 +1171,32 @@ class IotHubProperties(msrest.serialization.Model): :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible keys to this dictionary is events. This key has to be present in the dictionary while making create or update calls for the IoT hub. - :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.models.EventHubProperties] + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2020_03_01.models.EventHubProperties] :param routing: The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. - :type routing: ~azure.mgmt.iothub.models.RoutingProperties + :type routing: ~azure.mgmt.iothub.v2020_03_01.models.RoutingProperties :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. Currently you can configure only one Azure Storage account and that MUST have its key as $default. Specifying more than one storage account causes an error to be thrown. Not specifying a value for this property when the enableFileUploadNotifications property is set to True, causes an error to be thrown. - :type storage_endpoints: dict[str, ~azure.mgmt.iothub.models.StorageEndpointProperties] + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2020_03_01.models.StorageEndpointProperties] :param messaging_endpoints: The messaging endpoint properties for the file upload notification queue. - :type messaging_endpoints: dict[str, ~azure.mgmt.iothub.models.MessagingEndpointProperties] + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2020_03_01.models.MessagingEndpointProperties] :param enable_file_upload_notifications: If True, file upload notifications are enabled. :type enable_file_upload_notifications: bool :param cloud_to_device: The IoT hub cloud-to-device messaging properties. - :type cloud_to_device: ~azure.mgmt.iothub.models.CloudToDeviceProperties + :type cloud_to_device: ~azure.mgmt.iothub.v2020_03_01.models.CloudToDeviceProperties :param comments: IoT hub comments. :type comments: str :param features: The capabilities and features enabled for the IoT hub. Possible values include: "None", "DeviceManagement". - :type features: str or ~azure.mgmt.iothub.models.Capabilities + :type features: str or ~azure.mgmt.iothub.v2020_03_01.models.Capabilities :ivar locations: Primary and secondary location for iot hub. - :vartype locations: list[~azure.mgmt.iothub.models.IotHubLocationDescription] + :vartype locations: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubLocationDescription] """ _validation = { @@ -1302,7 +1305,7 @@ class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of quota metrics objects. - :type value: list[~azure.mgmt.iothub.models.IotHubQuotaMetricInfo] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubQuotaMetricInfo] :ivar next_link: The next link. :vartype next_link: str """ @@ -1337,9 +1340,9 @@ class IotHubSkuDescription(msrest.serialization.Model): :ivar resource_type: The type of the resource. :vartype resource_type: str :param sku: Required. The type of the resource. - :type sku: ~azure.mgmt.iothub.models.IotHubSkuInfo + :type sku: ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuInfo :param capacity: Required. IotHub capacity. - :type capacity: ~azure.mgmt.iothub.models.IotHubCapacity + :type capacity: ~azure.mgmt.iothub.v2020_03_01.models.IotHubCapacity """ _validation = { @@ -1373,7 +1376,7 @@ class IotHubSkuDescriptionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of IotHubSkuDescription. - :type value: list[~azure.mgmt.iothub.models.IotHubSkuDescription] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuDescription] :ivar next_link: The next link. :vartype next_link: str """ @@ -1407,10 +1410,10 @@ class IotHubSkuInfo(msrest.serialization.Model): :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", "B1", "B2", "B3". - :type name: str or ~azure.mgmt.iothub.models.IotHubSku + :type name: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubSku :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", "Basic". - :vartype tier: str or ~azure.mgmt.iothub.models.IotHubSkuTier + :vartype tier: str or ~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuTier :param capacity: The number of provisioned IoT Hub units. See: https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. :type capacity: long @@ -1449,7 +1452,7 @@ class IpFilterRule(msrest.serialization.Model): :type filter_name: str :param action: Required. The desired action for requests captured by this rule. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.iothub.models.IpFilterActionType + :type action: str or ~azure.mgmt.iothub.v2020_03_01.models.IpFilterActionType :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the rule. :type ip_mask: str @@ -1495,10 +1498,10 @@ class JobResponse(msrest.serialization.Model): :ivar type: The type of the job. Possible values include: "unknown", "export", "import", "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", "rebootDevice", "factoryResetDevice", "firmwareUpdate". - :vartype type: str or ~azure.mgmt.iothub.models.JobType + :vartype type: str or ~azure.mgmt.iothub.v2020_03_01.models.JobType :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", "completed", "failed", "cancelled". - :vartype status: str or ~azure.mgmt.iothub.models.JobStatus + :vartype status: str or ~azure.mgmt.iothub.v2020_03_01.models.JobStatus :ivar failure_reason: If status == failed, this string containing the reason for the failure. :vartype failure_reason: str :ivar status_message: The status message for the job. @@ -1550,7 +1553,7 @@ class JobResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: The array of JobResponse objects. - :type value: list[~azure.mgmt.iothub.models.JobResponse] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.JobResponse] :ivar next_link: The next link. :vartype next_link: str """ @@ -1579,7 +1582,7 @@ class MatchedRoute(msrest.serialization.Model): """Routes that matched. :param properties: Properties of routes that matched. - :type properties: ~azure.mgmt.iothub.models.RouteProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.RouteProperties """ _attribute_map = { @@ -1599,12 +1602,12 @@ def __init__( class MessagingEndpointProperties(msrest.serialization.Model): """The properties of the messaging endpoints used by this IoT hub. - :param lock_duration_as_iso8601: The lock duration. See: https://docs.microsoft.com/azure/iot- - hub/iot-hub-devguide-file-upload. + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type lock_duration_as_iso8601: ~datetime.timedelta :param ttl_as_iso8601: The period of time for which a message is available to consume before it - is expired by the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload. + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. :type ttl_as_iso8601: ~datetime.timedelta :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. @@ -1669,7 +1672,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.iothub.models.OperationDisplay + :type display: ~azure.mgmt.iothub.v2020_03_01.models.OperationDisplay """ _validation = { @@ -1765,7 +1768,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. - :vartype value: list[~azure.mgmt.iothub.models.Operation] + :vartype value: list[~azure.mgmt.iothub.v2020_03_01.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1828,12 +1831,12 @@ class PrivateEndpointConnection(msrest.serialization.Model): :ivar type: The resource type. :vartype type: str :param properties: Required. The properties of a private endpoint connection. - :type properties: ~azure.mgmt.iothub.models.PrivateEndpointConnectionProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnectionProperties """ _validation = { 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'name': {'readonly': True}, 'type': {'readonly': True}, 'properties': {'required': True}, } @@ -1864,11 +1867,11 @@ class PrivateEndpointConnectionProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param private_endpoint: The private endpoint property of a private endpoint connection. - :type private_endpoint: ~azure.mgmt.iothub.models.PrivateEndpoint + :type private_endpoint: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpoint :param private_link_service_connection_state: Required. The current state of a private endpoint connection. :type private_link_service_connection_state: - ~azure.mgmt.iothub.models.PrivateLinkServiceConnectionState + ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkServiceConnectionState """ _validation = { @@ -1896,7 +1899,7 @@ class PrivateLinkResources(msrest.serialization.Model): """The available private link resources for an IotHub. :param value: The list of available private link resources for an IotHub. - :type value: list[~azure.mgmt.iothub.models.GroupIdInformation] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformation] """ _attribute_map = { @@ -1920,7 +1923,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): :param status: Required. The status of a private endpoint connection. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.iothub.models.PrivateLinkServiceConnectionStatus + :type status: str or ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkServiceConnectionStatus :param description: Required. The description for the current state of a private endpoint connection. :type description: str @@ -1994,9 +1997,9 @@ class RouteCompilationError(msrest.serialization.Model): :param message: Route error message. :type message: str :param severity: Severity of the route error. Possible values include: "error", "warning". - :type severity: str or ~azure.mgmt.iothub.models.RouteErrorSeverity + :type severity: str or ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorSeverity :param location: Location where the route error happened. - :type location: ~azure.mgmt.iothub.models.RouteErrorRange + :type location: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorRange """ _attribute_map = { @@ -2049,9 +2052,9 @@ class RouteErrorRange(msrest.serialization.Model): """Range of route errors. :param start: Start where the route error happened. - :type start: ~azure.mgmt.iothub.models.RouteErrorPosition + :type start: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorPosition :param end: End where the route error happened. - :type end: ~azure.mgmt.iothub.models.RouteErrorPosition + :type end: ~azure.mgmt.iothub.v2020_03_01.models.RouteErrorPosition """ _attribute_map = { @@ -2083,7 +2086,7 @@ class RouteProperties(msrest.serialization.Model): :param source: Required. The source that the routing rule is to be applied to, such as DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type source: str or ~azure.mgmt.iothub.models.RoutingSource + :type source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource :param condition: The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. @@ -2134,17 +2137,18 @@ class RoutingEndpoints(msrest.serialization.Model): :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the messages to, based on the routing rules. :type service_bus_queues: - list[~azure.mgmt.iothub.models.RoutingServiceBusQueueEndpointProperties] + list[~azure.mgmt.iothub.v2020_03_01.models.RoutingServiceBusQueueEndpointProperties] :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the messages to, based on the routing rules. :type service_bus_topics: - list[~azure.mgmt.iothub.models.RoutingServiceBusTopicEndpointProperties] + list[~azure.mgmt.iothub.v2020_03_01.models.RoutingServiceBusTopicEndpointProperties] :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include the built-in Event Hubs endpoint. - :type event_hubs: list[~azure.mgmt.iothub.models.RoutingEventHubProperties] + :type event_hubs: list[~azure.mgmt.iothub.v2020_03_01.models.RoutingEventHubProperties] :param storage_containers: The list of storage container endpoints that IoT hub routes messages to, based on the routing rules. - :type storage_containers: list[~azure.mgmt.iothub.models.RoutingStorageContainerProperties] + :type storage_containers: + list[~azure.mgmt.iothub.v2020_03_01.models.RoutingStorageContainerProperties] """ _attribute_map = { @@ -2185,7 +2189,7 @@ class RoutingEventHubProperties(msrest.serialization.Model): :type entity_path: str :param authentication_type: Method used to authenticate against the event hub endpoint. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType :param name: Required. The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, fileNotifications, $default. Endpoint @@ -2274,19 +2278,19 @@ class RoutingProperties(msrest.serialization.Model): messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. - :type endpoints: ~azure.mgmt.iothub.models.RoutingEndpoints + :type endpoints: ~azure.mgmt.iothub.v2020_03_01.models.RoutingEndpoints :param routes: The list of user-provided routing rules that the IoT hub uses to route messages to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and a maximum of 5 routing rules are allowed for free hubs. - :type routes: list[~azure.mgmt.iothub.models.RouteProperties] + :type routes: list[~azure.mgmt.iothub.v2020_03_01.models.RouteProperties] :param fallback_route: The properties of the route that is used as a fall-back route when none of the conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. - :type fallback_route: ~azure.mgmt.iothub.models.FallbackRouteProperties + :type fallback_route: ~azure.mgmt.iothub.v2020_03_01.models.FallbackRouteProperties :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. - :type enrichments: list[~azure.mgmt.iothub.models.EnrichmentProperties] + :type enrichments: list[~azure.mgmt.iothub.v2020_03_01.models.EnrichmentProperties] """ _attribute_map = { @@ -2328,7 +2332,7 @@ class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): :type entity_path: str :param authentication_type: Method used to authenticate against the service bus queue endpoint. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType :param name: Required. The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, fileNotifications, $default. Endpoint @@ -2396,7 +2400,7 @@ class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): :type entity_path: str :param authentication_type: Method used to authenticate against the service bus topic endpoint. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType :param name: Required. The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, fileNotifications, $default. Endpoint @@ -2461,7 +2465,7 @@ class RoutingStorageContainerProperties(msrest.serialization.Model): :type endpoint_uri: str :param authentication_type: Method used to authenticate against the storage endpoint. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType :param name: Required. The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, fileNotifications, $default. Endpoint @@ -2486,7 +2490,8 @@ class RoutingStorageContainerProperties(msrest.serialization.Model): :param encoding: Encoding that is used to serialize messages to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", "AvroDeflate", "JSON". - :type encoding: str or ~azure.mgmt.iothub.models.RoutingStorageContainerPropertiesEncoding + :type encoding: str or + ~azure.mgmt.iothub.v2020_03_01.models.RoutingStorageContainerPropertiesEncoding """ _validation = { @@ -2547,20 +2552,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: object + :type tags: str :param properties: - :type properties: ~azure.mgmt.iothub.models.RoutingTwinProperties + :type properties: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[object] = None, + tags: Optional[str] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2573,21 +2578,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: object + :type desired: str :param reported: Twin desired properties. - :type reported: object + :type reported: str """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'object'}, - 'reported': {'key': 'reported', 'type': 'object'}, + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, } def __init__( self, *, - desired: Optional[object] = None, - reported: Optional[object] = None, + desired: Optional[str] = None, + reported: Optional[str] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) @@ -2613,7 +2618,7 @@ class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". - :type rights: str or ~azure.mgmt.iothub.models.AccessRights + :type rights: str or ~azure.mgmt.iothub.v2020_03_01.models.AccessRights """ _validation = { @@ -2650,7 +2655,7 @@ class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Mode Variables are only populated by the server, and will be ignored when sending a request. :param value: The list of shared access policies. - :type value: list[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule] :ivar next_link: The next link. :vartype next_link: str """ @@ -2681,8 +2686,8 @@ class StorageEndpointProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for - file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file- - upload#file-upload-notification-configuration-options. + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. :type sas_ttl_as_iso8601: ~datetime.timedelta :param connection_string: Required. The connection string for the Azure Storage account to which files are uploaded. @@ -2692,7 +2697,7 @@ class StorageEndpointProperties(msrest.serialization.Model): :type container_name: str :param authentication_type: Specifies authentication type being used for connecting to the storage account. Possible values include: "keyBased", "identityBased". - :type authentication_type: str or ~azure.mgmt.iothub.models.AuthenticationType + :type authentication_type: str or ~azure.mgmt.iothub.v2020_03_01.models.AuthenticationType """ _validation = { @@ -2749,11 +2754,11 @@ class TestAllRoutesInput(msrest.serialization.Model): :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents". - :type routing_source: str or ~azure.mgmt.iothub.models.RoutingSource + :type routing_source: str or ~azure.mgmt.iothub.v2020_03_01.models.RoutingSource :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2020_03_01.models.RoutingMessage :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwin """ _attribute_map = { @@ -2780,7 +2785,7 @@ class TestAllRoutesResult(msrest.serialization.Model): """Result of testing all routes. :param routes: JSON-serialized array of matched routes. - :type routes: list[~azure.mgmt.iothub.models.MatchedRoute] + :type routes: list[~azure.mgmt.iothub.v2020_03_01.models.MatchedRoute] """ _attribute_map = { @@ -2803,11 +2808,11 @@ class TestRouteInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param message: Routing message. - :type message: ~azure.mgmt.iothub.models.RoutingMessage + :type message: ~azure.mgmt.iothub.v2020_03_01.models.RoutingMessage :param route: Required. Route properties. - :type route: ~azure.mgmt.iothub.models.RouteProperties + :type route: ~azure.mgmt.iothub.v2020_03_01.models.RouteProperties :param twin: Routing Twin Reference. - :type twin: ~azure.mgmt.iothub.models.RoutingTwin + :type twin: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwin """ _validation = { @@ -2838,9 +2843,9 @@ class TestRouteResult(msrest.serialization.Model): """Result of testing one route. :param result: Result of testing route. Possible values include: "undefined", "false", "true". - :type result: str or ~azure.mgmt.iothub.models.TestResultStatus + :type result: str or ~azure.mgmt.iothub.v2020_03_01.models.TestResultStatus :param details: Detailed result of testing route. - :type details: ~azure.mgmt.iothub.models.TestRouteResultDetails + :type details: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteResultDetails """ _attribute_map = { @@ -2864,7 +2869,7 @@ class TestRouteResultDetails(msrest.serialization.Model): """Detailed result of testing a route. :param compilation_errors: JSON-serialized list of route compilation errors. - :type compilation_errors: list[~azure.mgmt.iothub.models.RouteCompilationError] + :type compilation_errors: list[~azure.mgmt.iothub.v2020_03_01.models.RouteCompilationError] """ _attribute_map = { @@ -2895,7 +2900,7 @@ class UserSubscriptionQuota(msrest.serialization.Model): :param limit: Numerical limit on IotHub type. :type limit: int :param name: IotHub type. - :type name: ~azure.mgmt.iothub.models.Name + :type name: ~azure.mgmt.iothub.v2020_03_01.models.Name """ _attribute_map = { @@ -2933,7 +2938,7 @@ class UserSubscriptionQuotaListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: - :type value: list[~azure.mgmt.iothub.models.UserSubscriptionQuota] + :type value: list[~azure.mgmt.iothub.v2020_03_01.models.UserSubscriptionQuota] :ivar next_link: :vartype next_link: str """ diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py index f5f7b73f1480..314a9d61de07 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_certificates_operations.py @@ -29,7 +29,7 @@ class CertificatesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -61,7 +61,7 @@ def list_by_iot_hub( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateListDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateListDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateListDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] @@ -95,7 +95,7 @@ def list_by_iot_hub( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateListDescription', pipeline_response) @@ -126,7 +126,7 @@ def get( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -161,7 +161,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) @@ -193,13 +193,13 @@ def create_or_update( :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_description: The certificate body. - :type certificate_description: ~azure.mgmt.iothub.models.CertificateBodyDescription + :type certificate_description: ~azure.mgmt.iothub.v2020_03_01.models.CertificateBodyDescription :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate. :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -241,7 +241,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -315,7 +315,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -347,7 +347,7 @@ def generate_verification_code( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateWithNonceDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateWithNonceDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateWithNonceDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] @@ -383,7 +383,7 @@ def generate_verification_code( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) @@ -418,10 +418,10 @@ def verify( :param if_match: ETag of the Certificate. :type if_match: str :param certificate_verification_body: The name of the certificate. - :type certificate_verification_body: ~azure.mgmt.iothub.models.CertificateVerificationDescription + :type certificate_verification_body: ~azure.mgmt.iothub.v2020_03_01.models.CertificateVerificationDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.CertificateDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.CertificateDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] @@ -462,7 +462,7 @@ def verify( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CertificateDescription', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py index eafbb747fc77..98c9e41d9e39 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py @@ -31,7 +31,7 @@ class IotHubOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -90,7 +90,7 @@ def _manual_failover_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -118,11 +118,11 @@ def begin_manual_failover( :param failover_input: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see https://aka.ms/manualfailover/region. - :type failover_input: ~azure.mgmt.iothub.models.FailoverInput + :type failover_input: ~azure.mgmt.iothub.v2020_03_01.models.FailoverInput :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py index c7c1090edfb5..1a45f7c7a039 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py @@ -32,7 +32,7 @@ class IotHubResourceOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -64,7 +64,7 @@ def get( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubDescription, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubDescription + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] @@ -98,7 +98,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubDescription', pipeline_response) @@ -156,7 +156,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -184,25 +184,27 @@ def begin_create_or_update( Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified - values in a new body to update the IoT hub. + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param iot_hub_description: The IoT hub metadata and security metadata. - :type iot_hub_description: ~azure.mgmt.iothub.models.IotHubDescription + :type iot_hub_description: ~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub. :type if_match: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -323,15 +325,15 @@ def begin_update( :param resource_name: Name of iot hub to update. :type resource_name: str :param iot_hub_tags: Updated tag information to set into the iot hub instance. - :type iot_hub_tags: ~azure.mgmt.iothub.models.TagsResource + :type iot_hub_tags: ~azure.mgmt.iothub.v2020_03_01.models.TagsResource :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -386,12 +388,10 @@ def _delete_initial( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["_models.IotHubDescription"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IotHubDescription"]] + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorDetails, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-03-01" @@ -418,9 +418,9 @@ def _delete_initial( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202, 204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -430,6 +430,9 @@ def _delete_initial( if response.status_code == 202: deserialized = self._deserialize('IotHubDescription', pipeline_response) + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) @@ -442,7 +445,7 @@ def begin_delete( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.IotHubDescription"] + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] """Delete an IoT hub. Delete an IoT hub. @@ -453,16 +456,16 @@ def begin_delete( :type resource_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.IotHubDescription] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescription] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -517,7 +520,7 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -565,7 +568,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -590,7 +593,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2020_03_01.models.IotHubDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] @@ -639,7 +642,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -667,7 +670,7 @@ def get_stats( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistryStatistics, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.RegistryStatistics + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.RegistryStatistics :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] @@ -701,7 +704,7 @@ def get_stats( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RegistryStatistics', pipeline_response) @@ -729,7 +732,7 @@ def get_valid_skus( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubSkuDescriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2020_03_01.models.IotHubSkuDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] @@ -779,7 +782,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -811,7 +814,7 @@ def list_event_hub_consumer_groups( :type event_hub_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EventHubConsumerGroupsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] @@ -862,7 +865,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -896,7 +899,7 @@ def get_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -932,7 +935,7 @@ def get_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -966,7 +969,7 @@ def create_event_hub_consumer_group( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EventHubConsumerGroupInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.EventHubConsumerGroupInfo + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.EventHubConsumerGroupInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] @@ -1002,7 +1005,7 @@ def create_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) @@ -1072,7 +1075,7 @@ def delete_event_hub_consumer_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1098,7 +1101,7 @@ def list_jobs( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResponseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.JobResponseListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2020_03_01.models.JobResponseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] @@ -1148,7 +1151,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1180,7 +1183,7 @@ def get_job( :type job_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1215,7 +1218,7 @@ def get_job( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1243,7 +1246,7 @@ def get_quota_metrics( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.IotHubQuotaMetricInfoListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2020_03_01.models.IotHubQuotaMetricInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] @@ -1293,7 +1296,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1321,7 +1324,7 @@ def get_endpoint_health( :type iot_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.EndpointHealthDataListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2020_03_01.models.EndpointHealthDataListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] @@ -1371,7 +1374,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1394,10 +1397,10 @@ def check_name_availability( :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - :type operation_inputs: ~azure.mgmt.iothub.models.OperationInputs + :type operation_inputs: ~azure.mgmt.iothub.v2020_03_01.models.OperationInputs :keyword callable cls: A custom type or function that will be passed the direct response :return: IotHubNameAvailabilityInfo, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.IotHubNameAvailabilityInfo + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.IotHubNameAvailabilityInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] @@ -1434,7 +1437,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) @@ -1462,10 +1465,10 @@ def test_all_routes( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Input for testing all routes. - :type input: ~azure.mgmt.iothub.models.TestAllRoutesInput + :type input: ~azure.mgmt.iothub.v2020_03_01.models.TestAllRoutesInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestAllRoutesResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestAllRoutesResult + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.TestAllRoutesResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] @@ -1504,7 +1507,7 @@ def test_all_routes( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) @@ -1532,10 +1535,10 @@ def test_route( :param resource_group_name: resource group which Iot Hub belongs to. :type resource_group_name: str :param input: Route that needs to be tested. - :type input: ~azure.mgmt.iothub.models.TestRouteInput + :type input: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteInput :keyword callable cls: A custom type or function that will be passed the direct response :return: TestRouteResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.TestRouteResult + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.TestRouteResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] @@ -1574,7 +1577,7 @@ def test_route( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TestRouteResult', pipeline_response) @@ -1603,7 +1606,7 @@ def list_keys( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] @@ -1653,7 +1656,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1685,7 +1688,7 @@ def get_keys_for_key_name( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.SharedAccessSignatureAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] @@ -1720,7 +1723,7 @@ def get_keys_for_key_name( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) @@ -1742,18 +1745,18 @@ def export_devices( """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob - container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub- - devguide-identity-registry#import-and-export-device-identities. + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param export_devices_parameters: The parameters that specify the export devices operation. - :type export_devices_parameters: ~azure.mgmt.iothub.models.ExportDevicesRequest + :type export_devices_parameters: ~azure.mgmt.iothub.v2020_03_01.models.ExportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1792,7 +1795,7 @@ def export_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) @@ -1814,18 +1817,18 @@ def import_devices( """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Import, update, or delete device identities in the IoT hub identity registry from a blob. For - more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity- - registry#import-and-export-device-identities. + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. :param resource_group_name: The name of the resource group that contains the IoT hub. :type resource_group_name: str :param resource_name: The name of the IoT hub. :type resource_name: str :param import_devices_parameters: The parameters that specify the import devices operation. - :type import_devices_parameters: ~azure.mgmt.iothub.models.ImportDevicesRequest + :type import_devices_parameters: ~azure.mgmt.iothub.v2020_03_01.models.ImportDevicesRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: JobResponse, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.JobResponse + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.JobResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] @@ -1864,7 +1867,7 @@ def import_devices( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('JobResponse', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py index e2f230295b53..e56dd3fcb3d8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_operations.py @@ -30,7 +30,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2020_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py index 79149628b3f9..abf05f575b4b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py @@ -31,7 +31,7 @@ class PrivateEndpointConnectionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -63,7 +63,7 @@ def list( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of PrivateEndpointConnection, or the result of cls(response) - :rtype: list[~azure.mgmt.iothub.models.PrivateEndpointConnection] + :rtype: list[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] @@ -97,7 +97,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[PrivateEndpointConnection]', pipeline_response) @@ -128,7 +128,7 @@ def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -163,7 +163,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -220,7 +220,7 @@ def _update_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -255,15 +255,15 @@ def begin_update( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. - :type private_endpoint_connection: ~azure.mgmt.iothub.models.PrivateEndpointConnection + :type private_endpoint_connection: ~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.PrivateEndpointConnection] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -354,7 +354,7 @@ def _delete_initial( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -390,12 +390,12 @@ def begin_delete( :type private_endpoint_connection_name: 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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.models.PrivateEndpointConnection] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2020_03_01.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py index 1d0dc8af7d21..dbbc36575771 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_link_resources_operations.py @@ -29,7 +29,7 @@ class PrivateLinkResourcesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -61,7 +61,7 @@ def list( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResources, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.PrivateLinkResources + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.PrivateLinkResources :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] @@ -95,7 +95,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResources', pipeline_response) @@ -126,7 +126,7 @@ def get( :type group_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GroupIdInformation, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.GroupIdInformation + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.GroupIdInformation :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] @@ -161,7 +161,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GroupIdInformation', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py index 6344e4c2d6d2..6787f3c8acc1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_resource_provider_common_operations.py @@ -29,7 +29,7 @@ class ResourceProviderCommonOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.iothub.models + :type models: ~azure.mgmt.iothub.v2020_03_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -55,7 +55,7 @@ def get_subscription_quota( :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSubscriptionQuotaListResult, or the result of cls(response) - :rtype: ~azure.mgmt.iothub.models.UserSubscriptionQuotaListResult + :rtype: ~azure.mgmt.iothub.v2020_03_01.models.UserSubscriptionQuotaListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] @@ -87,7 +87,7 @@ def get_subscription_quota( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py new file mode 100644 index 000000000000..8883d8041fab --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._iot_hub_client import IotHubClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['IotHubClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py new file mode 100644 index 000000000000..dd94e0ecba2a --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class IotHubClientConfiguration(Configuration): + """Configuration for IotHubClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotHubClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-03-03-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py new file mode 100644 index 000000000000..7eff43e2772a --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_iot_hub_client.py @@ -0,0 +1,119 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import IotHubClientConfiguration +from .operations import Operations +from .operations import IotHubResourceOperations +from .operations import ResourceProviderCommonOperations +from .operations import CertificatesOperations +from .operations import IotHubOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from . import models + + +class IotHubClient(object): + """Use this API to manage the IoT hubs in your Azure subscription. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothub.v2021_03_03_preview.operations.Operations + :ivar iot_hub_resource: IotHubResourceOperations operations + :vartype iot_hub_resource: azure.mgmt.iothub.v2021_03_03_preview.operations.IotHubResourceOperations + :ivar resource_provider_common: ResourceProviderCommonOperations operations + :vartype resource_provider_common: azure.mgmt.iothub.v2021_03_03_preview.operations.ResourceProviderCommonOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.iothub.v2021_03_03_preview.operations.CertificatesOperations + :ivar iot_hub: IotHubOperations operations + :vartype iot_hub: azure.mgmt.iothub.v2021_03_03_preview.operations.IotHubOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.iothub.v2021_03_03_preview.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.iothub.v2021_03_03_preview.operations.PrivateEndpointConnectionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, 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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub_resource = IotHubResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_provider_common = ResourceProviderCommonOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub = IotHubOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> IotHubClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json new file mode 100644 index 000000000000..24c6a0568ce2 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_metadata.json @@ -0,0 +1,109 @@ +{ + "chosen_version": "2021-03-03-preview", + "total_api_version_list": ["2021-03-03-preview"], + "client": { + "name": "IotHubClient", + "filename": "_iot_hub_client", + "description": "Use this API to manage the IoT hubs in your Azure subscription.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "iot_hub_resource": "IotHubResourceOperations", + "resource_provider_common": "ResourceProviderCommonOperations", + "certificates": "CertificatesOperations", + "iot_hub": "IotHubOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations" + } +} \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py new file mode 100644 index 000000000000..ba617b3fa777 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py new file mode 100644 index 000000000000..a84cf700a930 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._iot_hub_client import IotHubClient +__all__ = ['IotHubClient'] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py new file mode 100644 index 000000000000..0b69f2acf43a --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class IotHubClientConfiguration(Configuration): + """Configuration for IotHubClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotHubClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-03-03-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py new file mode 100644 index 000000000000..669fc65c8c7b --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/_iot_hub_client.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import IotHubClientConfiguration +from .operations import Operations +from .operations import IotHubResourceOperations +from .operations import ResourceProviderCommonOperations +from .operations import CertificatesOperations +from .operations import IotHubOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from .. import models + + +class IotHubClient(object): + """Use this API to manage the IoT hubs in your Azure subscription. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothub.v2021_03_03_preview.aio.operations.Operations + :ivar iot_hub_resource: IotHubResourceOperations operations + :vartype iot_hub_resource: azure.mgmt.iothub.v2021_03_03_preview.aio.operations.IotHubResourceOperations + :ivar resource_provider_common: ResourceProviderCommonOperations operations + :vartype resource_provider_common: azure.mgmt.iothub.v2021_03_03_preview.aio.operations.ResourceProviderCommonOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.iothub.v2021_03_03_preview.aio.operations.CertificatesOperations + :ivar iot_hub: IotHubOperations operations + :vartype iot_hub: azure.mgmt.iothub.v2021_03_03_preview.aio.operations.IotHubOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.iothub.v2021_03_03_preview.aio.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.iothub.v2021_03_03_preview.aio.operations.PrivateEndpointConnectionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, 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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub_resource = IotHubResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_provider_common = ResourceProviderCommonOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub = IotHubOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "IotHubClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..3930a2f261c8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._operations import Operations +from ._iot_hub_resource_operations import IotHubResourceOperations +from ._resource_provider_common_operations import ResourceProviderCommonOperations +from ._certificates_operations import CertificatesOperations +from ._iot_hub_operations import IotHubOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations + +__all__ = [ + 'Operations', + 'IotHubResourceOperations', + 'ResourceProviderCommonOperations', + 'CertificatesOperations', + 'IotHubOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py new file mode 100644 index 000000000000..e017ea2b7397 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py @@ -0,0 +1,464 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_by_iot_hub( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.CertificateListDescription": + """Get the certificate list. + + Returns the list of certificates. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_iot_hub.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_iot_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + **kwargs + ) -> "_models.CertificateDescription": + """Get the certificate. + + Returns the certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + certificate_description: "_models.CertificateDescription", + if_match: Optional[str] = None, + **kwargs + ) -> "_models.CertificateDescription": + """Upload the certificate to the IoT hub. + + Adds new or replaces existing certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription + :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. + Required to update an existing certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_description, 'CertificateDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + **kwargs + ) -> None: + """Delete an X509 certificate. + + Deletes an existing X509 certificate or does nothing if it does not exist. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def generate_verification_code( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + **kwargs + ) -> "_models.CertificateWithNonceDescription": + """Generate verification code for proof of possession flow. + + Generates verification code for proof of possession flow. The verification code will be used to + generate a leaf certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateWithNonceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateWithNonceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + async def verify( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + certificate_verification_body: "_models.CertificateVerificationDescription", + **kwargs + ) -> "_models.CertificateDescription": + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :param certificate_verification_body: The name of the certificate. + :type certificate_verification_body: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateVerificationDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py new file mode 100644 index 000000000000..2804a1d024b4 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IotHubOperations: + """IotHubOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _manual_failover_initial( + self, + iot_hub_name: str, + resource_group_name: str, + failover_input: "_models.FailoverInput", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._manual_failover_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(failover_input, 'FailoverInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + 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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _manual_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore + + async def begin_manual_failover( + self, + iot_hub_name: str, + resource_group_name: str, + failover_input: "_models.FailoverInput", + **kwargs + ) -> AsyncLROPoller[None]: + """Manually initiate a failover for the IoT Hub to its secondary region. + + Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + https://aka.ms/manualfailover. + + :param iot_hub_name: Name of the IoT hub to failover. + :type iot_hub_name: str + :param resource_group_name: Name of the resource group containing the IoT hub resource. + :type resource_group_name: str + :param failover_input: Region to failover to. Must be the Azure paired region. Get the value + from the secondary location in the locations property. To learn more, see + https://aka.ms/manualfailover/region. + :type failover_input: ~azure.mgmt.iothub.v2021_03_03_preview.models.FailoverInput + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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 = await self._manual_failover_initial( + iot_hub_name=iot_hub_name, + resource_group_name=resource_group_name, + failover_input=failover_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_manual_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py new file mode 100644 index 000000000000..07be5cbce6f3 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py @@ -0,0 +1,1855 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IotHubResourceOperations: + """IotHubResourceOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.IotHubDescription": + """Get the non-security related metadata of an IoT hub. + + Get the non-security related metadata of an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + iot_hub_description: "_models.IotHubDescription", + if_match: Optional[str] = None, + **kwargs + ) -> "_models.IotHubDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_description, 'IotHubDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + iot_hub_description: "_models.IotHubDescription", + if_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["_models.IotHubDescription"]: + """Create or update the metadata of an IoT hub. + + Create or update the metadata of an Iot hub. The usual pattern to modify a property is to + retrieve the IoT hub metadata and security metadata, and then combine them with the modified + values in a new body to update the IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param iot_hub_description: The IoT hub metadata and security metadata. + :type iot_hub_description: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription + :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required + to update an existing IoT Hub. + :type if_match: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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 = await self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_description=iot_hub_description, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + iot_hub_tags: "_models.TagsResource", + **kwargs + ) -> "_models.IotHubDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + iot_hub_tags: "_models.TagsResource", + **kwargs + ) -> AsyncLROPoller["_models.IotHubDescription"]: + """Update an existing IoT Hubs tags. + + Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param resource_name: Name of iot hub to update. + :type resource_name: str + :param iot_hub_tags: Updated tag information to set into the iot hub instance. + :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_03_preview.models.TagsResource + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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 = await self._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_tags=iot_hub_tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + """Delete an IoT hub. + + Delete an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + 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 = await self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: + """Get all the IoT hubs in a subscription. + + Get all the IoT hubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: + """Get all the IoT hubs in a resource group. + + Get all the IoT hubs in a resource group. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + async def get_stats( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.RegistryStatistics": + """Get the statistics from an IoT hub. + + Get the statistics from an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryStatistics, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.RegistryStatistics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_stats.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryStatistics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + + def get_valid_skus( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: + """Get the list of valid SKUs for an IoT hub. + + Get the list of valid SKUs for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_valid_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubSkuDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + + def list_event_hub_consumer_groups( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + **kwargs + ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: + """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + + Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an + IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint. + :type event_hub_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_event_hub_consumer_groups.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubConsumerGroupsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_event_hub_consumer_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'} # type: ignore + + async def get_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + **kwargs + ) -> "_models.EventHubConsumerGroupInfo": + """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to retrieve. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + async def create_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + consumer_group_body: "_models.EventHubConsumerGroupBodyDescription", + **kwargs + ) -> "_models.EventHubConsumerGroupInfo": + """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to add. + :type name: str + :param consumer_group_body: The consumer group to add. + :type consumer_group_body: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupBodyDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + async def delete_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + **kwargs + ) -> None: + """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to delete. + :type name: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def list_jobs( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.JobResponseListResult"]: + """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get a list of all the jobs in an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResponseListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('JobResponseListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + + async def get_job( + self, + resource_group_name: str, + resource_name: str, + job_id: str, + **kwargs + ) -> "_models.JobResponse": + """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get the details of a job from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param job_id: The job identifier. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_job.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + + def get_quota_metrics( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: + """Get the quota metrics for an IoT hub. + + Get the quota metrics for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubQuotaMetricInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_quota_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubQuotaMetricInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + + def get_endpoint_health( + self, + resource_group_name: str, + iot_hub_name: str, + **kwargs + ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: + """Get the health for routing endpoints. + + Get the health for routing endpoints. + + :param resource_group_name: + :type resource_group_name: str + :param iot_hub_name: + :type iot_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthDataListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_endpoint_health.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EndpointHealthDataListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_endpoint_health.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth'} # type: ignore + + async def check_name_availability( + self, + operation_inputs: "_models.OperationInputs", + **kwargs + ) -> "_models.IotHubNameAvailabilityInfo": + """Check if an IoT hub name is available. + + Check if an IoT hub name is available. + + :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of + the IoT hub to check. + :type operation_inputs: ~azure.mgmt.iothub.v2021_03_03_preview.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubNameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubNameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(operation_inputs, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + + async def test_all_routes( + self, + iot_hub_name: str, + resource_group_name: str, + input: "_models.TestAllRoutesInput", + **kwargs + ) -> "_models.TestAllRoutesResult": + """Test all routes. + + Test all routes configured in this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Input for testing all routes. + :type input: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestAllRoutesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestAllRoutesResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestAllRoutesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_all_routes.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestAllRoutesInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_all_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'} # type: ignore + + async def test_route( + self, + iot_hub_name: str, + resource_group_name: str, + input: "_models.TestRouteInput", + **kwargs + ) -> "_models.TestRouteResult": + """Test the new route. + + Test the new route for this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Route that needs to be tested. + :type input: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestRouteResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_route.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestRouteInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestRouteResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'} # type: ignore + + def list_keys( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: + """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get the security metadata for an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + + async def get_keys_for_key_name( + self, + resource_group_name: str, + resource_name: str, + key_name: str, + **kwargs + ) -> "_models.SharedAccessSignatureAuthorizationRule": + """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get a shared access policy by name from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param key_name: The name of the shared access policy. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_keys_for_key_name.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + + async def export_devices( + self, + resource_group_name: str, + resource_name: str, + export_devices_parameters: "_models.ExportDevicesRequest", + **kwargs + ) -> "_models.JobResponse": + """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Exports all the device identities in the IoT hub identity registry to an Azure Storage blob + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param export_devices_parameters: The parameters that specify the export devices operation. + :type export_devices_parameters: ~azure.mgmt.iothub.v2021_03_03_preview.models.ExportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.export_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + + async def import_devices( + self, + resource_group_name: str, + resource_name: str, + import_devices_parameters: "_models.ImportDevicesRequest", + **kwargs + ) -> "_models.JobResponse": + """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Import, update, or delete device identities in the IoT hub identity registry from a blob. For + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param import_devices_parameters: The parameters that specify the import devices operation. + :type import_devices_parameters: ~azure.mgmt.iothub.v2021_03_03_preview.models.ImportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..ddbda76dfe15 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available IoT Hub REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..cd26826afcc3 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,436 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> List["_models.PrivateEndpointConnection"]: + """List private endpoint connections. + + List private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of PrivateEndpointConnection, or the result of cls(response) + :rtype: list[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[PrivateEndpointConnection]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "_models.PrivateEndpointConnection": + """Get private endpoint connection. + + Get private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs + ) -> "_models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Update private endpoint connection. + + Update the status of a private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection with updated properties. + :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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 = await self._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Delete private endpoint connection. + + Delete private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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 = await self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..abad86d7ff4a --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.PrivateLinkResources": + """List private link resources. + + List private link resources for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResources, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkResources + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResources', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + group_id: str, + **kwargs + ) -> "_models.GroupIdInformation": + """Get the specified private link resource. + + Get the specified private link resource for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param group_id: The name of the private link resource. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupIdInformation, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GroupIdInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py new file mode 100644 index 000000000000..91ddb2fc0c3f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceProviderCommonOperations: + """ResourceProviderCommonOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_subscription_quota( + self, + **kwargs + ) -> "_models.UserSubscriptionQuotaListResult": + """Get the number of iot hubs in the subscription. + + Get the number of free and paid iot hubs in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSubscriptionQuotaListResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.UserSubscriptionQuotaListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_subscription_quota.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_quota.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py new file mode 100644 index 000000000000..a74f297bc163 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/__init__.py @@ -0,0 +1,310 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ArmIdentity + from ._models_py3 import ArmUserIdentity + from ._models_py3 import CertificateBodyDescription + from ._models_py3 import CertificateDescription + from ._models_py3 import CertificateListDescription + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificatePropertiesWithNonce + from ._models_py3 import CertificateVerificationDescription + from ._models_py3 import CertificateWithNonceDescription + from ._models_py3 import CloudToDeviceProperties + from ._models_py3 import EncryptionPropertiesDescription + from ._models_py3 import EndpointHealthData + from ._models_py3 import EndpointHealthDataListResult + from ._models_py3 import EnrichmentProperties + from ._models_py3 import ErrorDetails + from ._models_py3 import EventHubConsumerGroupBodyDescription + from ._models_py3 import EventHubConsumerGroupInfo + from ._models_py3 import EventHubConsumerGroupName + from ._models_py3 import EventHubConsumerGroupsListResult + from ._models_py3 import EventHubProperties + from ._models_py3 import ExportDevicesRequest + from ._models_py3 import FailoverInput + from ._models_py3 import FallbackRouteProperties + from ._models_py3 import FeedbackProperties + from ._models_py3 import GroupIdInformation + from ._models_py3 import GroupIdInformationProperties + from ._models_py3 import ImportDevicesRequest + from ._models_py3 import IotHubCapacity + from ._models_py3 import IotHubDescription + from ._models_py3 import IotHubDescriptionListResult + from ._models_py3 import IotHubLocationDescription + from ._models_py3 import IotHubNameAvailabilityInfo + from ._models_py3 import IotHubProperties + from ._models_py3 import IotHubPropertiesDeviceStreams + from ._models_py3 import IotHubQuotaMetricInfo + from ._models_py3 import IotHubQuotaMetricInfoListResult + from ._models_py3 import IotHubSkuDescription + from ._models_py3 import IotHubSkuDescriptionListResult + from ._models_py3 import IotHubSkuInfo + from ._models_py3 import IpFilterRule + from ._models_py3 import JobResponse + from ._models_py3 import JobResponseListResult + from ._models_py3 import KeyVaultKeyProperties + from ._models_py3 import ManagedIdentity + from ._models_py3 import MatchedRoute + from ._models_py3 import MessagingEndpointProperties + from ._models_py3 import Name + from ._models_py3 import NetworkRuleSetIpRule + from ._models_py3 import NetworkRuleSetProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationInputs + from ._models_py3 import OperationListResult + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionProperties + from ._models_py3 import PrivateLinkResources + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import RegistryStatistics + from ._models_py3 import Resource + from ._models_py3 import RouteCompilationError + from ._models_py3 import RouteErrorPosition + from ._models_py3 import RouteErrorRange + from ._models_py3 import RouteProperties + from ._models_py3 import RoutingEndpoints + from ._models_py3 import RoutingEventHubProperties + from ._models_py3 import RoutingMessage + from ._models_py3 import RoutingProperties + from ._models_py3 import RoutingServiceBusQueueEndpointProperties + from ._models_py3 import RoutingServiceBusTopicEndpointProperties + from ._models_py3 import RoutingStorageContainerProperties + from ._models_py3 import RoutingTwin + from ._models_py3 import RoutingTwinProperties + from ._models_py3 import SharedAccessSignatureAuthorizationRule + from ._models_py3 import SharedAccessSignatureAuthorizationRuleListResult + from ._models_py3 import StorageEndpointProperties + from ._models_py3 import TagsResource + from ._models_py3 import TestAllRoutesInput + from ._models_py3 import TestAllRoutesResult + from ._models_py3 import TestRouteInput + from ._models_py3 import TestRouteResult + from ._models_py3 import TestRouteResultDetails + from ._models_py3 import UserSubscriptionQuota + from ._models_py3 import UserSubscriptionQuotaListResult +except (SyntaxError, ImportError): + from ._models import ArmIdentity # type: ignore + from ._models import ArmUserIdentity # type: ignore + from ._models import CertificateBodyDescription # type: ignore + from ._models import CertificateDescription # type: ignore + from ._models import CertificateListDescription # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificatePropertiesWithNonce # type: ignore + from ._models import CertificateVerificationDescription # type: ignore + from ._models import CertificateWithNonceDescription # type: ignore + from ._models import CloudToDeviceProperties # type: ignore + from ._models import EncryptionPropertiesDescription # type: ignore + from ._models import EndpointHealthData # type: ignore + from ._models import EndpointHealthDataListResult # type: ignore + from ._models import EnrichmentProperties # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import EventHubConsumerGroupBodyDescription # type: ignore + from ._models import EventHubConsumerGroupInfo # type: ignore + from ._models import EventHubConsumerGroupName # type: ignore + from ._models import EventHubConsumerGroupsListResult # type: ignore + from ._models import EventHubProperties # type: ignore + from ._models import ExportDevicesRequest # type: ignore + from ._models import FailoverInput # type: ignore + from ._models import FallbackRouteProperties # type: ignore + from ._models import FeedbackProperties # type: ignore + from ._models import GroupIdInformation # type: ignore + from ._models import GroupIdInformationProperties # type: ignore + from ._models import ImportDevicesRequest # type: ignore + from ._models import IotHubCapacity # type: ignore + from ._models import IotHubDescription # type: ignore + from ._models import IotHubDescriptionListResult # type: ignore + from ._models import IotHubLocationDescription # type: ignore + from ._models import IotHubNameAvailabilityInfo # type: ignore + from ._models import IotHubProperties # type: ignore + from ._models import IotHubPropertiesDeviceStreams # type: ignore + from ._models import IotHubQuotaMetricInfo # type: ignore + from ._models import IotHubQuotaMetricInfoListResult # type: ignore + from ._models import IotHubSkuDescription # type: ignore + from ._models import IotHubSkuDescriptionListResult # type: ignore + from ._models import IotHubSkuInfo # type: ignore + from ._models import IpFilterRule # type: ignore + from ._models import JobResponse # type: ignore + from ._models import JobResponseListResult # type: ignore + from ._models import KeyVaultKeyProperties # type: ignore + from ._models import ManagedIdentity # type: ignore + from ._models import MatchedRoute # type: ignore + from ._models import MessagingEndpointProperties # type: ignore + from ._models import Name # type: ignore + from ._models import NetworkRuleSetIpRule # type: ignore + from ._models import NetworkRuleSetProperties # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationInputs # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionProperties # type: ignore + from ._models import PrivateLinkResources # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import RegistryStatistics # type: ignore + from ._models import Resource # type: ignore + from ._models import RouteCompilationError # type: ignore + from ._models import RouteErrorPosition # type: ignore + from ._models import RouteErrorRange # type: ignore + from ._models import RouteProperties # type: ignore + from ._models import RoutingEndpoints # type: ignore + from ._models import RoutingEventHubProperties # type: ignore + from ._models import RoutingMessage # type: ignore + from ._models import RoutingProperties # type: ignore + from ._models import RoutingServiceBusQueueEndpointProperties # type: ignore + from ._models import RoutingServiceBusTopicEndpointProperties # type: ignore + from ._models import RoutingStorageContainerProperties # type: ignore + from ._models import RoutingTwin # type: ignore + from ._models import RoutingTwinProperties # type: ignore + from ._models import SharedAccessSignatureAuthorizationRule # type: ignore + from ._models import SharedAccessSignatureAuthorizationRuleListResult # type: ignore + from ._models import StorageEndpointProperties # type: ignore + from ._models import TagsResource # type: ignore + from ._models import TestAllRoutesInput # type: ignore + from ._models import TestAllRoutesResult # type: ignore + from ._models import TestRouteInput # type: ignore + from ._models import TestRouteResult # type: ignore + from ._models import TestRouteResultDetails # type: ignore + from ._models import UserSubscriptionQuota # type: ignore + from ._models import UserSubscriptionQuotaListResult # type: ignore + +from ._iot_hub_client_enums import ( + AccessRights, + AuthenticationType, + Capabilities, + DefaultAction, + EndpointHealthStatus, + IotHubNameUnavailabilityReason, + IotHubReplicaRoleType, + IotHubScaleType, + IotHubSku, + IotHubSkuTier, + IpFilterActionType, + JobStatus, + JobType, + NetworkRuleIPAction, + PrivateLinkServiceConnectionStatus, + PublicNetworkAccess, + ResourceIdentityType, + RouteErrorSeverity, + RoutingSource, + RoutingStorageContainerPropertiesEncoding, + TestResultStatus, +) + +__all__ = [ + 'ArmIdentity', + 'ArmUserIdentity', + 'CertificateBodyDescription', + 'CertificateDescription', + 'CertificateListDescription', + 'CertificateProperties', + 'CertificatePropertiesWithNonce', + 'CertificateVerificationDescription', + 'CertificateWithNonceDescription', + 'CloudToDeviceProperties', + 'EncryptionPropertiesDescription', + 'EndpointHealthData', + 'EndpointHealthDataListResult', + 'EnrichmentProperties', + 'ErrorDetails', + 'EventHubConsumerGroupBodyDescription', + 'EventHubConsumerGroupInfo', + 'EventHubConsumerGroupName', + 'EventHubConsumerGroupsListResult', + 'EventHubProperties', + 'ExportDevicesRequest', + 'FailoverInput', + 'FallbackRouteProperties', + 'FeedbackProperties', + 'GroupIdInformation', + 'GroupIdInformationProperties', + 'ImportDevicesRequest', + 'IotHubCapacity', + 'IotHubDescription', + 'IotHubDescriptionListResult', + 'IotHubLocationDescription', + 'IotHubNameAvailabilityInfo', + 'IotHubProperties', + 'IotHubPropertiesDeviceStreams', + 'IotHubQuotaMetricInfo', + 'IotHubQuotaMetricInfoListResult', + 'IotHubSkuDescription', + 'IotHubSkuDescriptionListResult', + 'IotHubSkuInfo', + 'IpFilterRule', + 'JobResponse', + 'JobResponseListResult', + 'KeyVaultKeyProperties', + 'ManagedIdentity', + 'MatchedRoute', + 'MessagingEndpointProperties', + 'Name', + 'NetworkRuleSetIpRule', + 'NetworkRuleSetProperties', + 'Operation', + 'OperationDisplay', + 'OperationInputs', + 'OperationListResult', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionProperties', + 'PrivateLinkResources', + 'PrivateLinkServiceConnectionState', + 'RegistryStatistics', + 'Resource', + 'RouteCompilationError', + 'RouteErrorPosition', + 'RouteErrorRange', + 'RouteProperties', + 'RoutingEndpoints', + 'RoutingEventHubProperties', + 'RoutingMessage', + 'RoutingProperties', + 'RoutingServiceBusQueueEndpointProperties', + 'RoutingServiceBusTopicEndpointProperties', + 'RoutingStorageContainerProperties', + 'RoutingTwin', + 'RoutingTwinProperties', + 'SharedAccessSignatureAuthorizationRule', + 'SharedAccessSignatureAuthorizationRuleListResult', + 'StorageEndpointProperties', + 'TagsResource', + 'TestAllRoutesInput', + 'TestAllRoutesResult', + 'TestRouteInput', + 'TestRouteResult', + 'TestRouteResultDetails', + 'UserSubscriptionQuota', + 'UserSubscriptionQuotaListResult', + 'AccessRights', + 'AuthenticationType', + 'Capabilities', + 'DefaultAction', + 'EndpointHealthStatus', + 'IotHubNameUnavailabilityReason', + 'IotHubReplicaRoleType', + 'IotHubScaleType', + 'IotHubSku', + 'IotHubSkuTier', + 'IpFilterActionType', + 'JobStatus', + 'JobType', + 'NetworkRuleIPAction', + 'PrivateLinkServiceConnectionStatus', + 'PublicNetworkAccess', + 'ResourceIdentityType', + 'RouteErrorSeverity', + 'RoutingSource', + 'RoutingStorageContainerPropertiesEncoding', + 'TestResultStatus', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_iot_hub_client_enums.py new file mode 100644 index 000000000000..c2f6b6a50e3e --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_iot_hub_client_enums.py @@ -0,0 +1,232 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The permissions assigned to the shared access policy. + """ + + REGISTRY_READ = "RegistryRead" + REGISTRY_WRITE = "RegistryWrite" + SERVICE_CONNECT = "ServiceConnect" + DEVICE_CONNECT = "DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE = "RegistryRead, RegistryWrite" + REGISTRY_READ_SERVICE_CONNECT = "RegistryRead, ServiceConnect" + REGISTRY_READ_DEVICE_CONNECT = "RegistryRead, DeviceConnect" + REGISTRY_WRITE_SERVICE_CONNECT = "RegistryWrite, ServiceConnect" + REGISTRY_WRITE_DEVICE_CONNECT = "RegistryWrite, DeviceConnect" + SERVICE_CONNECT_DEVICE_CONNECT = "ServiceConnect, DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT = "RegistryRead, RegistryWrite, ServiceConnect" + REGISTRY_READ_REGISTRY_WRITE_DEVICE_CONNECT = "RegistryRead, RegistryWrite, DeviceConnect" + REGISTRY_READ_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryRead, ServiceConnect, DeviceConnect" + REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryWrite, ServiceConnect, DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" + +class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies authentication type being used for connecting to the storage account. + """ + + KEY_BASED = "keyBased" + IDENTITY_BASED = "identityBased" + +class Capabilities(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The capabilities and features enabled for the IoT hub. + """ + + NONE = "None" + DEVICE_MANAGEMENT = "DeviceManagement" + +class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Default Action for Network Rule Set + """ + + DENY = "Deny" + ALLOW = "Allow" + +class EndpointHealthStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Health statuses have following meanings. The 'healthy' status shows that the endpoint is + accepting messages as expected. The 'unhealthy' status shows that the endpoint is not accepting + messages as expected and IoT Hub is retrying to send data to this endpoint. The status of an + unhealthy endpoint will be updated to healthy when IoT Hub has established an eventually + consistent state of health. The 'dead' status shows that the endpoint is not accepting + messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub metrics to + identify errors and monitor issues with endpoints. The 'unknown' status shows that the IoT Hub + has not established a connection with the endpoint. No messages have been delivered to or + rejected from this endpoint + """ + + UNKNOWN = "unknown" + HEALTHY = "healthy" + DEGRADED = "degraded" + UNHEALTHY = "unhealthy" + DEAD = "dead" + +class IotHubNameUnavailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The reason for unavailability. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class IotHubReplicaRoleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The role of the region, can be either primary or secondary. The primary region is where the IoT + hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired + region and also the region where the IoT hub can failover to. + """ + + PRIMARY = "primary" + SECONDARY = "secondary" + +class IotHubScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the scaling enabled. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + NONE = "None" + +class IotHubSku(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the SKU. + """ + + F1 = "F1" + S1 = "S1" + S2 = "S2" + S3 = "S3" + B1 = "B1" + B2 = "B2" + B3 = "B3" + +class IotHubSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier for the IoT hub. + """ + + FREE = "Free" + STANDARD = "Standard" + BASIC = "Basic" + +class IpFilterActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The desired action for requests captured by this rule. + """ + + ACCEPT = "Accept" + REJECT = "Reject" + +class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the job. + """ + + UNKNOWN = "unknown" + ENQUEUED = "enqueued" + RUNNING = "running" + COMPLETED = "completed" + FAILED = "failed" + CANCELLED = "cancelled" + +class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the job. + """ + + UNKNOWN = "unknown" + EXPORT = "export" + IMPORT_ENUM = "import" + BACKUP = "backup" + READ_DEVICE_PROPERTIES = "readDeviceProperties" + WRITE_DEVICE_PROPERTIES = "writeDeviceProperties" + UPDATE_DEVICE_CONFIGURATION = "updateDeviceConfiguration" + REBOOT_DEVICE = "rebootDevice" + FACTORY_RESET_DEVICE = "factoryResetDevice" + FIRMWARE_UPDATE = "firmwareUpdate" + +class NetworkRuleIPAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """IP Filter Action + """ + + ALLOW = "Allow" + +class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of a private endpoint connection + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether requests from Public Network are allowed + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes + both an implicitly created identity and a set of user assigned identities. The type 'None' will + remove any identities from the service. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class RouteErrorSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Severity of the route error + """ + + ERROR = "error" + WARNING = "warning" + +class RoutingSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The source that the routing rule is to be applied to, such as DeviceMessages. + """ + + INVALID = "Invalid" + DEVICE_MESSAGES = "DeviceMessages" + TWIN_CHANGE_EVENTS = "TwinChangeEvents" + DEVICE_LIFECYCLE_EVENTS = "DeviceLifecycleEvents" + DEVICE_JOB_LIFECYCLE_EVENTS = "DeviceJobLifecycleEvents" + DIGITAL_TWIN_CHANGE_EVENTS = "DigitalTwinChangeEvents" + DEVICE_CONNECTION_STATE_EVENTS = "DeviceConnectionStateEvents" + +class RoutingStorageContainerPropertiesEncoding(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Encoding that is used to serialize messages to blobs. Supported values are 'avro', + 'avrodeflate', and 'JSON'. Default value is 'avro'. + """ + + AVRO = "Avro" + AVRO_DEFLATE = "AvroDeflate" + JSON = "JSON" + +class TestResultStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Result of testing route + """ + + UNDEFINED = "undefined" + FALSE = "false" + TRUE = "true" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models.py new file mode 100644 index 000000000000..aa366765aa72 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models.py @@ -0,0 +1,3059 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ArmIdentity(msrest.serialization.Model): + """ArmIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. The type + 'None' will remove any identities from the service. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.ResourceIdentityType + :param user_assigned_identities: Dictionary of :code:``. + :type user_assigned_identities: dict[str, + ~azure.mgmt.iothub.v2021_03_03_preview.models.ArmUserIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ArmUserIdentity}'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ArmUserIdentity(msrest.serialization.Model): + """ArmUserIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: + :vartype principal_id: str + :ivar client_id: + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmUserIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + + +class CertificateDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateDescription, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :param certificate: The certificate content. + :type certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.certificate = kwargs.get('certificate', None) + + +class CertificatePropertiesWithNonce(msrest.serialization.Model): + """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :ivar verification_code: The certificate's verification code that will be used for proof of + possession. + :vartype verification_code: str + :ivar certificate: The certificate content. + :vartype certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'verification_code': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificatePropertiesWithNonce, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.verification_code = None + self.certificate = None + + +class CertificateVerificationDescription(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateVerificationDescription, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + + +class CertificateWithNonceDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate including the challenge nonce + issued for the Proof-Of-Possession flow. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificatePropertiesWithNonce + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificatePropertiesWithNonce'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateWithNonceDescription, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CloudToDeviceProperties(msrest.serialization.Model): + """The IoT hub cloud-to-device messaging properties. + + :param max_delivery_count: The max delivery count for cloud-to-device messages in the device + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type default_ttl_as_iso8601: ~datetime.timedelta + :param feedback: The properties of the feedback queue for cloud-to-device messages. + :type feedback: ~azure.mgmt.iothub.v2021_03_03_preview.models.FeedbackProperties + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + 'default_ttl_as_iso8601': {'key': 'defaultTtlAsIso8601', 'type': 'duration'}, + 'feedback': {'key': 'feedback', 'type': 'FeedbackProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudToDeviceProperties, self).__init__(**kwargs) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.default_ttl_as_iso8601 = kwargs.get('default_ttl_as_iso8601', None) + self.feedback = kwargs.get('feedback', None) + + +class EncryptionPropertiesDescription(msrest.serialization.Model): + """The encryption properties for the IoT hub. + + :param key_source: The source of the key. + :type key_source: str + :param key_vault_properties: The properties of the KeyVault key. + :type key_vault_properties: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.KeyVaultKeyProperties] + """ + + _attribute_map = { + 'key_source': {'key': 'keySource', 'type': 'str'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultKeyProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(EncryptionPropertiesDescription, self).__init__(**kwargs) + self.key_source = kwargs.get('key_source', None) + self.key_vault_properties = kwargs.get('key_vault_properties', None) + + +class EndpointHealthData(msrest.serialization.Model): + """The health data for an endpoint. + + :param endpoint_id: Id of the endpoint. + :type endpoint_id: str + :param health_status: Health statuses have following meanings. The 'healthy' status shows that + the endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint + is not accepting messages as expected and IoT Hub is retrying to send data to this endpoint. + The status of an unhealthy endpoint will be updated to healthy when IoT Hub has established an + eventually consistent state of health. The 'dead' status shows that the endpoint is not + accepting messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub + metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + the IoT Hub has not established a connection with the endpoint. No messages have been delivered + to or rejected from this endpoint. Possible values include: "unknown", "healthy", "degraded", + "unhealthy", "dead". + :type health_status: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthStatus + :param last_known_error: Last error obtained when a message failed to be delivered to iot hub. + :type last_known_error: str + :param last_known_error_time: Time at which the last known error occurred. + :type last_known_error_time: ~datetime.datetime + :param last_successful_send_attempt_time: Last time iot hub successfully sent a message to the + endpoint. + :type last_successful_send_attempt_time: ~datetime.datetime + :param last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. + :type last_send_attempt_time: ~datetime.datetime + """ + + _attribute_map = { + 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, + 'health_status': {'key': 'healthStatus', 'type': 'str'}, + 'last_known_error': {'key': 'lastKnownError', 'type': 'str'}, + 'last_known_error_time': {'key': 'lastKnownErrorTime', 'type': 'rfc-1123'}, + 'last_successful_send_attempt_time': {'key': 'lastSuccessfulSendAttemptTime', 'type': 'rfc-1123'}, + 'last_send_attempt_time': {'key': 'lastSendAttemptTime', 'type': 'rfc-1123'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointHealthData, self).__init__(**kwargs) + self.endpoint_id = kwargs.get('endpoint_id', None) + self.health_status = kwargs.get('health_status', None) + self.last_known_error = kwargs.get('last_known_error', None) + self.last_known_error_time = kwargs.get('last_known_error_time', None) + self.last_successful_send_attempt_time = kwargs.get('last_successful_send_attempt_time', None) + self.last_send_attempt_time = kwargs.get('last_send_attempt_time', None) + + +class EndpointHealthDataListResult(msrest.serialization.Model): + """The JSON-serialized array of EndpointHealthData objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: JSON-serialized array of Endpoint health data. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthData] + :ivar next_link: Link to more results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EndpointHealthData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointHealthDataListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class EnrichmentProperties(msrest.serialization.Model): + """The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key or name for the enrichment property. + :type key: str + :param value: Required. The value for the enrichment property. + :type value: str + :param endpoint_names: Required. The list of endpoints for which the enrichment is applied to + the message. + :type endpoint_names: list[str] + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'endpoint_names': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(EnrichmentProperties, self).__init__(**kwargs) + self.key = kwargs['key'] + self.value = kwargs['value'] + self.endpoint_names = kwargs['endpoint_names'] + + +class ErrorDetails(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class EventHubConsumerGroupBodyDescription(msrest.serialization.Model): + """The EventHub consumer group. + + :param properties: The EventHub consumer group name. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupName + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'EventHubConsumerGroupName'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupBodyDescription, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class EventHubConsumerGroupInfo(msrest.serialization.Model): + """The properties of the EventHubConsumerGroupInfo object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The tags. + :type properties: dict[str, str] + :ivar id: The Event Hub-compatible consumer group identifier. + :vartype id: str + :ivar name: The Event Hub-compatible consumer group name. + :vartype name: str + :ivar type: the resource type. + :vartype type: str + :ivar etag: The etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupInfo, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.type = None + self.etag = None + + +class EventHubConsumerGroupName(msrest.serialization.Model): + """The EventHub consumer group name. + + :param name: EventHub consumer group name. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupName, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class EventHubConsumerGroupsListResult(msrest.serialization.Model): + """The JSON-serialized array of Event Hub-compatible consumer group names with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of consumer groups objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventHubConsumerGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class EventHubProperties(msrest.serialization.Model): + """The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param retention_time_in_days: The retention time for device-to-cloud messages in days. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type retention_time_in_days: long + :param partition_count: The number of partitions for receiving device-to-cloud messages in the + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type partition_count: int + :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. + :vartype partition_ids: list[str] + :ivar path: The Event Hub-compatible name. + :vartype path: str + :ivar endpoint: The Event Hub-compatible endpoint. + :vartype endpoint: str + """ + + _validation = { + 'partition_ids': {'readonly': True}, + 'path': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'retention_time_in_days': {'key': 'retentionTimeInDays', 'type': 'long'}, + 'partition_count': {'key': 'partitionCount', 'type': 'int'}, + 'partition_ids': {'key': 'partitionIds', 'type': '[str]'}, + 'path': {'key': 'path', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubProperties, self).__init__(**kwargs) + self.retention_time_in_days = kwargs.get('retention_time_in_days', None) + self.partition_count = kwargs.get('partition_count', None) + self.partition_ids = None + self.path = None + self.endpoint = None + + +class ExportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an export of all devices in the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param export_blob_container_uri: Required. The export blob container URI. + :type export_blob_container_uri: str + :param exclude_keys: Required. The value indicating whether keys should be excluded during + export. + :type exclude_keys: bool + :param export_blob_name: The name of the blob that will be created in the provided output blob + container. This blob will contain the exported device registry information for the IoT Hub. + :type export_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for export devices. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + """ + + _validation = { + 'export_blob_container_uri': {'required': True}, + 'exclude_keys': {'required': True}, + } + + _attribute_map = { + 'export_blob_container_uri': {'key': 'exportBlobContainerUri', 'type': 'str'}, + 'exclude_keys': {'key': 'excludeKeys', 'type': 'bool'}, + 'export_blob_name': {'key': 'exportBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportDevicesRequest, self).__init__(**kwargs) + self.export_blob_container_uri = kwargs['export_blob_container_uri'] + self.exclude_keys = kwargs['exclude_keys'] + self.export_blob_name = kwargs.get('export_blob_name', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + + +class FailoverInput(msrest.serialization.Model): + """Use to provide failover region when requesting manual Failover for a hub. + + All required parameters must be populated in order to send to Azure. + + :param failover_region: Required. Region the hub will be failed over to. + :type failover_region: str + """ + + _validation = { + 'failover_region': {'required': True}, + } + + _attribute_map = { + 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FailoverInput, self).__init__(**kwargs) + self.failover_region = kwargs['failover_region'] + + +class FallbackRouteProperties(msrest.serialization.Model): + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the route. The name can only include alphanumeric characters, periods, + underscores, hyphens, has a maximum length of 64 characters, and must be unique. + :type name: str + :param source: Required. The source to which the routing rule is to be applied to. For example, + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DigitalTwinChangeEvents", + "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource + :param condition: The condition which is evaluated in order to apply the fallback route. If the + condition is not provided it will evaluate to true by default. For grammar, See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which the messages that satisfy the + condition are routed to. Currently only 1 endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether the fallback route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(FallbackRouteProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.source = kwargs['source'] + self.condition = kwargs.get('condition', None) + self.endpoint_names = kwargs['endpoint_names'] + self.is_enabled = kwargs['is_enabled'] + + +class FeedbackProperties(msrest.serialization.Model): + """The properties of the feedback queue for cloud-to-device messages. + + :param lock_duration_as_iso8601: The lock duration for the feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(FeedbackProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = kwargs.get('lock_duration_as_iso8601', None) + self.ttl_as_iso8601 = kwargs.get('ttl_as_iso8601', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + + +class GroupIdInformation(msrest.serialization.Model): + """The group information for creating a private endpoint on an IotHub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties for a group information object. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'GroupIdInformationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupIdInformation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class GroupIdInformationProperties(msrest.serialization.Model): + """The properties for a group information object. + + :param group_id: The group id. + :type group_id: str + :param required_members: The required members for a specific group id. + :type required_members: list[str] + :param required_zone_names: The required DNS zones for a specific group id. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupIdInformationProperties, self).__init__(**kwargs) + self.group_id = kwargs.get('group_id', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class ImportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an import of all devices in the hub. + + All required parameters must be populated in order to send to Azure. + + :param input_blob_container_uri: Required. The input blob container URI. + :type input_blob_container_uri: str + :param output_blob_container_uri: Required. The output blob container URI. + :type output_blob_container_uri: str + :param input_blob_name: The blob name to be used when importing from the provided input blob + container. + :type input_blob_name: str + :param output_blob_name: The blob name to use for storing the status of the import job. + :type output_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for import devices. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + """ + + _validation = { + 'input_blob_container_uri': {'required': True}, + 'output_blob_container_uri': {'required': True}, + } + + _attribute_map = { + 'input_blob_container_uri': {'key': 'inputBlobContainerUri', 'type': 'str'}, + 'output_blob_container_uri': {'key': 'outputBlobContainerUri', 'type': 'str'}, + 'input_blob_name': {'key': 'inputBlobName', 'type': 'str'}, + 'output_blob_name': {'key': 'outputBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportDevicesRequest, self).__init__(**kwargs) + self.input_blob_container_uri = kwargs['input_blob_container_uri'] + self.output_blob_container_uri = kwargs['output_blob_container_uri'] + self.input_blob_name = kwargs.get('input_blob_name', None) + self.output_blob_name = kwargs.get('output_blob_name', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + + +class IotHubCapacity(msrest.serialization.Model): + """IoT Hub capacity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum number of units. + :vartype minimum: long + :ivar maximum: The maximum number of units. + :vartype maximum: long + :ivar default: The default number of units. + :vartype default: long + :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", + "Manual", "None". + :vartype scale_type: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubScaleType + """ + + _validation = { + 'minimum': {'readonly': True, 'maximum': 1, 'minimum': 1}, + 'maximum': {'readonly': True}, + 'default': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default': {'key': 'default', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default = None + self.scale_type = None + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class IotHubDescription(Resource): + """The description of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: IotHub properties. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubProperties + :param sku: Required. IotHub SKU info. + :type sku: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuInfo + :param identity: The managed identities for the IotHub. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ArmIdentity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotHubProperties'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'identity': {'key': 'identity', 'type': 'ArmIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDescription, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.properties = kwargs.get('properties', None) + self.sku = kwargs['sku'] + self.identity = kwargs.get('identity', None) + + +class IotHubDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubDescription objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDescriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubLocationDescription(msrest.serialization.Model): + """Public representation of one of the locations where a resource is provisioned. + + :param location: The name of the Azure region. + :type location: str + :param role: The role of the region, can be either primary or secondary. The primary region is + where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery + (DR) paired region and also the region where the IoT hub can failover to. Possible values + include: "primary", "secondary". + :type role: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubReplicaRoleType + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubLocationDescription, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.role = kwargs.get('role', None) + + +class IotHubNameAvailabilityInfo(msrest.serialization.Model): + """The properties indicating whether a given IoT hub name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: The value which indicates whether the provided name is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = kwargs.get('message', None) + + +class IotHubProperties(msrest.serialization.Model): + """The properties of an IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param authorization_policies: The shared access policies you can use to secure a connection to + the IoT hub. + :type authorization_policies: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule] + :param public_network_access: Whether requests from Public Network are allowed. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.PublicNetworkAccess + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IpFilterRule] + :param network_rule_sets: Network Rule Set Properties of IotHub. + :type network_rule_sets: ~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleSetProperties + :param min_tls_version: Specifies the minimum TLS version to support for this hub. Can be set + to "1.2" to have clients that use a TLS version below 1.2 to be rejected. + :type min_tls_version: str + :param private_endpoint_connections: Private endpoint connections created on this IotHub. + :type private_endpoint_connections: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :ivar state: The hub state. + :vartype state: str + :ivar host_name: The name of the host. + :vartype host_name: str + :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible + keys to this dictionary is events. This key has to be present in the dictionary while making + create or update calls for the IoT hub. + :type event_hub_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubProperties] + :param routing: The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + :type routing: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingProperties + :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. + Currently you can configure only one Azure Storage account and that MUST have its key as + $default. Specifying more than one storage account causes an error to be thrown. Not specifying + a value for this property when the enableFileUploadNotifications property is set to True, + causes an error to be thrown. + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_03_preview.models.StorageEndpointProperties] + :param messaging_endpoints: The messaging endpoint properties for the file upload notification + queue. + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_03_preview.models.MessagingEndpointProperties] + :param enable_file_upload_notifications: If True, file upload notifications are enabled. + :type enable_file_upload_notifications: bool + :param cloud_to_device: The IoT hub cloud-to-device messaging properties. + :type cloud_to_device: ~azure.mgmt.iothub.v2021_03_03_preview.models.CloudToDeviceProperties + :param comments: IoT hub comments. + :type comments: str + :param device_streams: The device streams properties of iothub. + :type device_streams: + ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubPropertiesDeviceStreams + :param features: The capabilities and features enabled for the IoT hub. Possible values + include: "None", "DeviceManagement". + :type features: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.Capabilities + :param encryption: The encryption properties for the IoT hub. + :type encryption: ~azure.mgmt.iothub.v2021_03_03_preview.models.EncryptionPropertiesDescription + :ivar locations: Primary and secondary location for iot hub. + :vartype locations: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubLocationDescription] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'host_name': {'readonly': True}, + 'locations': {'readonly': True}, + } + + _attribute_map = { + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'network_rule_sets': {'key': 'networkRuleSets', 'type': 'NetworkRuleSetProperties'}, + 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'event_hub_endpoints': {'key': 'eventHubEndpoints', 'type': '{EventHubProperties}'}, + 'routing': {'key': 'routing', 'type': 'RoutingProperties'}, + 'storage_endpoints': {'key': 'storageEndpoints', 'type': '{StorageEndpointProperties}'}, + 'messaging_endpoints': {'key': 'messagingEndpoints', 'type': '{MessagingEndpointProperties}'}, + 'enable_file_upload_notifications': {'key': 'enableFileUploadNotifications', 'type': 'bool'}, + 'cloud_to_device': {'key': 'cloudToDevice', 'type': 'CloudToDeviceProperties'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'device_streams': {'key': 'deviceStreams', 'type': 'IotHubPropertiesDeviceStreams'}, + 'features': {'key': 'features', 'type': 'str'}, + 'encryption': {'key': 'encryption', 'type': 'EncryptionPropertiesDescription'}, + 'locations': {'key': 'locations', 'type': '[IotHubLocationDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubProperties, self).__init__(**kwargs) + self.authorization_policies = kwargs.get('authorization_policies', None) + self.public_network_access = kwargs.get('public_network_access', None) + self.ip_filter_rules = kwargs.get('ip_filter_rules', None) + self.network_rule_sets = kwargs.get('network_rule_sets', None) + self.min_tls_version = kwargs.get('min_tls_version', None) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + self.provisioning_state = None + self.state = None + self.host_name = None + self.event_hub_endpoints = kwargs.get('event_hub_endpoints', None) + self.routing = kwargs.get('routing', None) + self.storage_endpoints = kwargs.get('storage_endpoints', None) + self.messaging_endpoints = kwargs.get('messaging_endpoints', None) + self.enable_file_upload_notifications = kwargs.get('enable_file_upload_notifications', None) + self.cloud_to_device = kwargs.get('cloud_to_device', None) + self.comments = kwargs.get('comments', None) + self.device_streams = kwargs.get('device_streams', None) + self.features = kwargs.get('features', None) + self.encryption = kwargs.get('encryption', None) + self.locations = None + + +class IotHubPropertiesDeviceStreams(msrest.serialization.Model): + """The device streams properties of iothub. + + :param streaming_endpoints: List of Device Streams Endpoints. + :type streaming_endpoints: list[str] + """ + + _attribute_map = { + 'streaming_endpoints': {'key': 'streamingEndpoints', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubPropertiesDeviceStreams, self).__init__(**kwargs) + self.streaming_endpoints = kwargs.get('streaming_endpoints', None) + + +class IotHubQuotaMetricInfo(msrest.serialization.Model): + """Quota metrics properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the quota metric. + :vartype name: str + :ivar current_value: The current value for the quota metric. + :vartype current_value: long + :ivar max_value: The maximum value of the quota metric. + :vartype max_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'current_value': {'readonly': True}, + 'max_value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'max_value': {'key': 'maxValue', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfo, self).__init__(**kwargs) + self.name = None + self.current_value = None + self.max_value = None + + +class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of quota metrics objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubQuotaMetricInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubQuotaMetricInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfoListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubSkuDescription(msrest.serialization.Model): + """SKU properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :param sku: Required. The type of the resource. + :type sku: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuInfo + :param capacity: Required. IotHub capacity. + :type capacity: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'required': True}, + 'capacity': {'required': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'capacity': {'key': 'capacity', 'type': 'IotHubCapacity'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.sku = kwargs['sku'] + self.capacity = kwargs['capacity'] + + +class IotHubSkuDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubSkuDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubSkuDescription. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubSkuDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuDescriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubSkuInfo(msrest.serialization.Model): + """Information about the SKU of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", + "B1", "B2", "B3". + :type name: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSku + :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", + "Basic". + :vartype tier: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuTier + :param capacity: The number of provisioned IoT Hub units. See: + https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + :type capacity: long + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuInfo, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = None + self.capacity = kwargs.get('capacity', None) + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = kwargs['filter_name'] + self.action = kwargs['action'] + self.ip_mask = kwargs['ip_mask'] + + +class JobResponse(msrest.serialization.Model): + """The properties of the Job Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_id: The job identifier. + :vartype job_id: str + :ivar start_time_utc: The start time of the job. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: The time the job stopped processing. + :vartype end_time_utc: ~datetime.datetime + :ivar type: The type of the job. Possible values include: "unknown", "export", "import", + "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", + "rebootDevice", "factoryResetDevice", "firmwareUpdate". + :vartype type: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.JobType + :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", + "completed", "failed", "cancelled". + :vartype status: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.JobStatus + :ivar failure_reason: If status == failed, this string containing the reason for the failure. + :vartype failure_reason: str + :ivar status_message: The status message for the job. + :vartype status_message: str + :ivar parent_job_id: The job identifier of the parent job, if any. + :vartype parent_job_id: str + """ + + _validation = { + 'job_id': {'readonly': True}, + 'start_time_utc': {'readonly': True}, + 'end_time_utc': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'status_message': {'readonly': True}, + 'parent_job_id': {'readonly': True}, + } + + _attribute_map = { + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'rfc-1123'}, + 'end_time_utc': {'key': 'endTimeUtc', 'type': 'rfc-1123'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'parent_job_id': {'key': 'parentJobId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.job_id = None + self.start_time_utc = None + self.end_time_utc = None + self.type = None + self.status = None + self.failure_reason = None + self.status_message = None + self.parent_job_id = None + + +class JobResponseListResult(msrest.serialization.Model): + """The JSON-serialized array of JobResponse objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of JobResponse objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JobResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponseListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class KeyVaultKeyProperties(msrest.serialization.Model): + """The properties of the KeyVault key. + + :param key_identifier: The identifier of the key. + :type key_identifier: str + :param identity: Managed identity properties of KeyVault Key. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + """ + + _attribute_map = { + 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultKeyProperties, self).__init__(**kwargs) + self.key_identifier = kwargs.get('key_identifier', None) + self.identity = kwargs.get('identity', None) + + +class ManagedIdentity(msrest.serialization.Model): + """The properties of the Managed identity. + + :param user_assigned_identity: The user assigned identity. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedIdentity, self).__init__(**kwargs) + self.user_assigned_identity = kwargs.get('user_assigned_identity', None) + + +class MatchedRoute(msrest.serialization.Model): + """Routes that matched. + + :param properties: Properties of routes that matched. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RouteProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(MatchedRoute, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class MessagingEndpointProperties(msrest.serialization.Model): + """The properties of the messaging endpoints used by this IoT hub. + + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(MessagingEndpointProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = kwargs.get('lock_duration_as_iso8601', None) + self.ttl_as_iso8601 = kwargs.get('ttl_as_iso8601', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + + +class Name(msrest.serialization.Model): + """Name of Iot Hub type. + + :param value: IotHub type. + :type value: str + :param localized_value: Localized value of name. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Name, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class NetworkRuleSetIpRule(msrest.serialization.Model): + """IP Rule to be applied as part of Network Rule Set. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. Name of the IP filter rule. + :type filter_name: str + :param action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleIPAction + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetIpRule, self).__init__(**kwargs) + self.filter_name = kwargs['filter_name'] + self.action = kwargs.get('action', "Allow") + self.ip_mask = kwargs['ip_mask'] + + +class NetworkRuleSetProperties(msrest.serialization.Model): + """Network Rule Set Properties of IotHub. + + All required parameters must be populated in order to send to Azure. + + :param default_action: Default Action for Network Rule Set. Possible values include: "Deny", + "Allow". Default value: "Deny". + :type default_action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.DefaultAction + :param apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also + applied to BuiltIn EventHub EndPoint of IotHub. + :type apply_to_built_in_event_hub_endpoint: bool + :param ip_rules: Required. List of IP Rules. + :type ip_rules: list[~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleSetIpRule] + """ + + _validation = { + 'apply_to_built_in_event_hub_endpoint': {'required': True}, + 'ip_rules': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'apply_to_built_in_event_hub_endpoint': {'key': 'applyToBuiltInEventHubEndpoint', 'type': 'bool'}, + 'ip_rules': {'key': 'ipRules', 'type': '[NetworkRuleSetIpRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetProperties, self).__init__(**kwargs) + self.default_action = kwargs.get('default_action', "Deny") + self.apply_to_built_in_event_hub_endpoint = kwargs['apply_to_built_in_event_hub_endpoint'] + self.ip_rules = kwargs['ip_rules'] + + +class Operation(msrest.serialization.Model): + """IoT Hub REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothub.v2021_03_03_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: IotHubs. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationInputs(msrest.serialization.Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the IoT hub to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. + :vartype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """The private endpoint property of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(msrest.serialization.Model): + """The private endpoint connection of an IotHub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties of a private endpoint connection. + :type properties: + ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """The properties of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param private_endpoint: The private endpoint property of a private endpoint connection. + :type private_endpoint: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Required. The current state of a private endpoint + connection. + :type private_link_service_connection_state: + ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'private_link_service_connection_state': {'required': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs['private_link_service_connection_state'] + + +class PrivateLinkResources(msrest.serialization.Model): + """The available private link resources for an IotHub. + + :param value: The list of available private link resources for an IotHub. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResources, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The current state of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of a private endpoint connection. Possible values include: + "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkServiceConnectionStatus + :param description: Required. The description for the current state of a private endpoint + connection. + :type description: str + :param actions_required: Actions required for a private endpoint connection. + :type actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs['status'] + self.description = kwargs['description'] + self.actions_required = kwargs.get('actions_required', None) + + +class RegistryStatistics(msrest.serialization.Model): + """Identity registry statistics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_device_count: The total count of devices in the identity registry. + :vartype total_device_count: long + :ivar enabled_device_count: The count of enabled devices in the identity registry. + :vartype enabled_device_count: long + :ivar disabled_device_count: The count of disabled devices in the identity registry. + :vartype disabled_device_count: long + """ + + _validation = { + 'total_device_count': {'readonly': True}, + 'enabled_device_count': {'readonly': True}, + 'disabled_device_count': {'readonly': True}, + } + + _attribute_map = { + 'total_device_count': {'key': 'totalDeviceCount', 'type': 'long'}, + 'enabled_device_count': {'key': 'enabledDeviceCount', 'type': 'long'}, + 'disabled_device_count': {'key': 'disabledDeviceCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryStatistics, self).__init__(**kwargs) + self.total_device_count = None + self.enabled_device_count = None + self.disabled_device_count = None + + +class RouteCompilationError(msrest.serialization.Model): + """Compilation error when evaluating route. + + :param message: Route error message. + :type message: str + :param severity: Severity of the route error. Possible values include: "error", "warning". + :type severity: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorSeverity + :param location: Location where the route error happened. + :type location: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorRange + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'RouteErrorRange'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteCompilationError, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.severity = kwargs.get('severity', None) + self.location = kwargs.get('location', None) + + +class RouteErrorPosition(msrest.serialization.Model): + """Position where the route error happened. + + :param line: Line where the route error happened. + :type line: int + :param column: Column where the route error happened. + :type column: int + """ + + _attribute_map = { + 'line': {'key': 'line', 'type': 'int'}, + 'column': {'key': 'column', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteErrorPosition, self).__init__(**kwargs) + self.line = kwargs.get('line', None) + self.column = kwargs.get('column', None) + + +class RouteErrorRange(msrest.serialization.Model): + """Range of route errors. + + :param start: Start where the route error happened. + :type start: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorPosition + :param end: End where the route error happened. + :type end: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorPosition + """ + + _attribute_map = { + 'start': {'key': 'start', 'type': 'RouteErrorPosition'}, + 'end': {'key': 'end', 'type': 'RouteErrorPosition'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteErrorRange, self).__init__(**kwargs) + self.start = kwargs.get('start', None) + self.end = kwargs.get('end', None) + + +class RouteProperties(msrest.serialization.Model): + """The properties of a routing rule that your IoT hub uses to route messages to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route. The name can only include alphanumeric + characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be + unique. + :type name: str + :param source: Required. The source that the routing rule is to be applied to, such as + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DigitalTwinChangeEvents", + "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource + :param condition: The condition that is evaluated to apply the routing rule. If no condition is + provided, it evaluates to true by default. For grammar, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which messages that satisfy the + condition are routed. Currently only one endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether a route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteProperties, self).__init__(**kwargs) + self.name = kwargs['name'] + self.source = kwargs['source'] + self.condition = kwargs.get('condition', None) + self.endpoint_names = kwargs['endpoint_names'] + self.is_enabled = kwargs['is_enabled'] + + +class RoutingEndpoints(msrest.serialization.Model): + """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + + :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the + messages to, based on the routing rules. + :type service_bus_queues: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingServiceBusQueueEndpointProperties] + :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the + messages to, based on the routing rules. + :type service_bus_topics: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingServiceBusTopicEndpointProperties] + :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on + the routing rules. This list does not include the built-in Event Hubs endpoint. + :type event_hubs: list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingEventHubProperties] + :param storage_containers: The list of storage container endpoints that IoT hub routes messages + to, based on the routing rules. + :type storage_containers: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingStorageContainerProperties] + """ + + _attribute_map = { + 'service_bus_queues': {'key': 'serviceBusQueues', 'type': '[RoutingServiceBusQueueEndpointProperties]'}, + 'service_bus_topics': {'key': 'serviceBusTopics', 'type': '[RoutingServiceBusTopicEndpointProperties]'}, + 'event_hubs': {'key': 'eventHubs', 'type': '[RoutingEventHubProperties]'}, + 'storage_containers': {'key': 'storageContainers', 'type': '[RoutingStorageContainerProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingEndpoints, self).__init__(**kwargs) + self.service_bus_queues = kwargs.get('service_bus_queues', None) + self.service_bus_topics = kwargs.get('service_bus_topics', None) + self.event_hubs = kwargs.get('event_hubs', None) + self.storage_containers = kwargs.get('storage_containers', None) + + +class RoutingEventHubProperties(msrest.serialization.Model): + """The properties related to an event hub endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the event hub endpoint. + :type id: str + :param connection_string: The connection string of the event hub endpoint. + :type connection_string: str + :param endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. + :type endpoint_uri: str + :param entity_path: Event hub name on the event hub namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the event hub endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of routing event hub endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the event hub endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the event hub endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingEventHubProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.entity_path = kwargs.get('entity_path', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingMessage(msrest.serialization.Model): + """Routing message. + + :param body: Body of routing message. + :type body: str + :param app_properties: App properties. + :type app_properties: dict[str, str] + :param system_properties: System properties. + :type system_properties: dict[str, str] + """ + + _attribute_map = { + 'body': {'key': 'body', 'type': 'str'}, + 'app_properties': {'key': 'appProperties', 'type': '{str}'}, + 'system_properties': {'key': 'systemProperties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingMessage, self).__init__(**kwargs) + self.body = kwargs.get('body', None) + self.app_properties = kwargs.get('app_properties', None) + self.system_properties = kwargs.get('system_properties', None) + + +class RoutingProperties(msrest.serialization.Model): + """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + + :param endpoints: The properties related to the custom endpoints to which your IoT hub routes + messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all + endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types + for free hubs. + :type endpoints: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingEndpoints + :param routes: The list of user-provided routing rules that the IoT hub uses to route messages + to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and + a maximum of 5 routing rules are allowed for free hubs. + :type routes: list[~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties] + :param fallback_route: The properties of the route that is used as a fall-back route when none + of the conditions specified in the 'routes' section are met. This is an optional parameter. + When this property is not set, the messages which do not meet any of the conditions specified + in the 'routes' section get routed to the built-in eventhub endpoint. + :type fallback_route: ~azure.mgmt.iothub.v2021_03_03_preview.models.FallbackRouteProperties + :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages + to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. + :type enrichments: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EnrichmentProperties] + """ + + _attribute_map = { + 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, + 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, + 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, + 'enrichments': {'key': 'enrichments', 'type': '[EnrichmentProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingProperties, self).__init__(**kwargs) + self.endpoints = kwargs.get('endpoints', None) + self.routes = kwargs.get('routes', None) + self.fallback_route = kwargs.get('fallback_route', None) + self.enrichments = kwargs.get('enrichments', None) + + +class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): + """The properties related to service bus queue endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus queue endpoint. + :type id: str + :param connection_string: The connection string of the service bus queue endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus queue endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus queue endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of routing service bus queue endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual queue + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus queue endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus queue endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingServiceBusQueueEndpointProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.entity_path = kwargs.get('entity_path', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): + """The properties related to service bus topic endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus topic endpoint. + :type id: str + :param connection_string: The connection string of the service bus topic endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus topic endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus topic. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus topic endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of routing service bus topic endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual topic + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus topic endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus topic endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingServiceBusTopicEndpointProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.entity_path = kwargs.get('entity_path', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingStorageContainerProperties(msrest.serialization.Model): + """The properties related to a storage container endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the storage container endpoint. + :type id: str + :param connection_string: The connection string of the storage account. + :type connection_string: str + :param endpoint_uri: The url of the storage endpoint. It must include the protocol https://. + :type endpoint_uri: str + :param authentication_type: Method used to authenticate against the storage endpoint. Possible + values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of routing storage endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the storage account. + :type subscription_id: str + :param resource_group: The name of the resource group of the storage account. + :type resource_group: str + :param container_name: Required. The name of storage container in the storage account. + :type container_name: str + :param file_name_format: File name format for the blob. Default format is + {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be + reordered. + :type file_name_format: str + :param batch_frequency_in_seconds: Time interval at which blobs are written to storage. Value + should be between 60 and 720 seconds. Default value is 300 seconds. + :type batch_frequency_in_seconds: int + :param max_chunk_size_in_bytes: Maximum number of bytes for each blob written to storage. Value + should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + :type max_chunk_size_in_bytes: int + :param encoding: Encoding that is used to serialize messages to blobs. Supported values are + 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", + "AvroDeflate", "JSON". + :type encoding: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingStorageContainerPropertiesEncoding + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'container_name': {'required': True}, + 'batch_frequency_in_seconds': {'maximum': 720, 'minimum': 60}, + 'max_chunk_size_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'file_name_format': {'key': 'fileNameFormat', 'type': 'str'}, + 'batch_frequency_in_seconds': {'key': 'batchFrequencyInSeconds', 'type': 'int'}, + 'max_chunk_size_in_bytes': {'key': 'maxChunkSizeInBytes', 'type': 'int'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingStorageContainerProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + self.container_name = kwargs['container_name'] + self.file_name_format = kwargs.get('file_name_format', None) + self.batch_frequency_in_seconds = kwargs.get('batch_frequency_in_seconds', None) + self.max_chunk_size_in_bytes = kwargs.get('max_chunk_size_in_bytes', None) + self.encoding = kwargs.get('encoding', None) + + +class RoutingTwin(msrest.serialization.Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: A set of tags. Twin Tags. + :type tags: str + :param properties: + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingTwin, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class RoutingTwinProperties(msrest.serialization.Model): + """RoutingTwinProperties. + + :param desired: Twin desired properties. + :type desired: str + :param reported: Twin desired properties. + :type reported: str + """ + + _attribute_map = { + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired = kwargs.get('desired', None) + self.reported = kwargs.get('reported', None) + + +class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): + """The properties of an IoT hub shared access policy. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the shared access policy. + :type key_name: str + :param primary_key: The primary key. + :type primary_key: str + :param secondary_key: The secondary key. + :type secondary_key: str + :param rights: Required. The permissions assigned to the shared access policy. Possible values + include: "RegistryRead", "RegistryWrite", "ServiceConnect", "DeviceConnect", "RegistryRead, + RegistryWrite", "RegistryRead, ServiceConnect", "RegistryRead, DeviceConnect", "RegistryWrite, + ServiceConnect", "RegistryWrite, DeviceConnect", "ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", + "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". + :type rights: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.AccessRights + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRule, self).__init__(**kwargs) + self.key_name = kwargs['key_name'] + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.rights = kwargs['rights'] + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """The list of shared access policies with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class StorageEndpointProperties(msrest.serialization.Model): + """The properties of the Azure Storage endpoint for file upload. + + All required parameters must be populated in order to send to Azure. + + :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + :type sas_ttl_as_iso8601: ~datetime.timedelta + :param connection_string: Required. The connection string for the Azure Storage account to + which files are uploaded. + :type connection_string: str + :param container_name: Required. The name of the root container where you upload files. The + container need not exist but should be creatable using the connectionString specified. + :type container_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for file upload. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + """ + + _validation = { + 'connection_string': {'required': True}, + 'container_name': {'required': True}, + } + + _attribute_map = { + 'sas_ttl_as_iso8601': {'key': 'sasTtlAsIso8601', 'type': 'duration'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(StorageEndpointProperties, self).__init__(**kwargs) + self.sas_ttl_as_iso8601 = kwargs.get('sas_ttl_as_iso8601', None) + self.connection_string = kwargs['connection_string'] + self.container_name = kwargs['container_name'] + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class TestAllRoutesInput(msrest.serialization.Model): + """Input for testing all routes. + + :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", + "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", + "DigitalTwinChangeEvents", "DeviceConnectionStateEvents". + :type routing_source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingMessage + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwin + """ + + _attribute_map = { + 'routing_source': {'key': 'routingSource', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + **kwargs + ): + super(TestAllRoutesInput, self).__init__(**kwargs) + self.routing_source = kwargs.get('routing_source', None) + self.message = kwargs.get('message', None) + self.twin = kwargs.get('twin', None) + + +class TestAllRoutesResult(msrest.serialization.Model): + """Result of testing all routes. + + :param routes: JSON-serialized array of matched routes. + :type routes: list[~azure.mgmt.iothub.v2021_03_03_preview.models.MatchedRoute] + """ + + _attribute_map = { + 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestAllRoutesResult, self).__init__(**kwargs) + self.routes = kwargs.get('routes', None) + + +class TestRouteInput(msrest.serialization.Model): + """Input for testing route. + + All required parameters must be populated in order to send to Azure. + + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingMessage + :param route: Required. Route properties. + :type route: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwin + """ + + _validation = { + 'route': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteInput, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.route = kwargs['route'] + self.twin = kwargs.get('twin', None) + + +class TestRouteResult(msrest.serialization.Model): + """Result of testing one route. + + :param result: Result of testing route. Possible values include: "undefined", "false", "true". + :type result: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.TestResultStatus + :param details: Detailed result of testing route. + :type details: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteResultDetails + """ + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'TestRouteResultDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteResult, self).__init__(**kwargs) + self.result = kwargs.get('result', None) + self.details = kwargs.get('details', None) + + +class TestRouteResultDetails(msrest.serialization.Model): + """Detailed result of testing a route. + + :param compilation_errors: JSON-serialized list of route compilation errors. + :type compilation_errors: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.RouteCompilationError] + """ + + _attribute_map = { + 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteResultDetails, self).__init__(**kwargs) + self.compilation_errors = kwargs.get('compilation_errors', None) + + +class UserSubscriptionQuota(msrest.serialization.Model): + """User subscription quota response. + + :param id: IotHub type id. + :type id: str + :param type: Response type. + :type type: str + :param unit: Unit of IotHub type. + :type unit: str + :param current_value: Current number of IotHub type. + :type current_value: int + :param limit: Numerical limit on IotHub type. + :type limit: int + :param name: IotHub type. + :type name: ~azure.mgmt.iothub.v2021_03_03_preview.models.Name + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'Name'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSubscriptionQuota, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.unit = kwargs.get('unit', None) + self.current_value = kwargs.get('current_value', None) + self.limit = kwargs.get('limit', None) + self.name = kwargs.get('name', None) + + +class UserSubscriptionQuotaListResult(msrest.serialization.Model): + """Json-serialized array of User subscription quota response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.UserSubscriptionQuota] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSubscriptionQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py new file mode 100644 index 000000000000..a48155474741 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py @@ -0,0 +1,3349 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._iot_hub_client_enums import * + + +class ArmIdentity(msrest.serialization.Model): + """ArmIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. The type + 'None' will remove any identities from the service. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.ResourceIdentityType + :param user_assigned_identities: Dictionary of :code:``. + :type user_assigned_identities: dict[str, + ~azure.mgmt.iothub.v2021_03_03_preview.models.ArmUserIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ArmUserIdentity}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ArmUserIdentity"]] = None, + **kwargs + ): + super(ArmIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ArmUserIdentity(msrest.serialization.Model): + """ArmUserIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: + :vartype principal_id: str + :ivar client_id: + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmUserIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = certificate + + +class CertificateDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): + super(CertificateDescription, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateDescription]'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateDescription"]] = None, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = value + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :param certificate: The certificate content. + :type certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.certificate = certificate + + +class CertificatePropertiesWithNonce(msrest.serialization.Model): + """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :ivar verification_code: The certificate's verification code that will be used for proof of + possession. + :vartype verification_code: str + :ivar certificate: The certificate content. + :vartype certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'verification_code': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificatePropertiesWithNonce, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.verification_code = None + self.certificate = None + + +class CertificateVerificationDescription(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateVerificationDescription, self).__init__(**kwargs) + self.certificate = certificate + + +class CertificateWithNonceDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate including the challenge nonce + issued for the Proof-Of-Possession flow. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificatePropertiesWithNonce + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificatePropertiesWithNonce'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["CertificatePropertiesWithNonce"] = None, + **kwargs + ): + super(CertificateWithNonceDescription, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CloudToDeviceProperties(msrest.serialization.Model): + """The IoT hub cloud-to-device messaging properties. + + :param max_delivery_count: The max delivery count for cloud-to-device messages in the device + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type default_ttl_as_iso8601: ~datetime.timedelta + :param feedback: The properties of the feedback queue for cloud-to-device messages. + :type feedback: ~azure.mgmt.iothub.v2021_03_03_preview.models.FeedbackProperties + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + 'default_ttl_as_iso8601': {'key': 'defaultTtlAsIso8601', 'type': 'duration'}, + 'feedback': {'key': 'feedback', 'type': 'FeedbackProperties'}, + } + + def __init__( + self, + *, + max_delivery_count: Optional[int] = None, + default_ttl_as_iso8601: Optional[datetime.timedelta] = None, + feedback: Optional["FeedbackProperties"] = None, + **kwargs + ): + super(CloudToDeviceProperties, self).__init__(**kwargs) + self.max_delivery_count = max_delivery_count + self.default_ttl_as_iso8601 = default_ttl_as_iso8601 + self.feedback = feedback + + +class EncryptionPropertiesDescription(msrest.serialization.Model): + """The encryption properties for the IoT hub. + + :param key_source: The source of the key. + :type key_source: str + :param key_vault_properties: The properties of the KeyVault key. + :type key_vault_properties: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.KeyVaultKeyProperties] + """ + + _attribute_map = { + 'key_source': {'key': 'keySource', 'type': 'str'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultKeyProperties]'}, + } + + def __init__( + self, + *, + key_source: Optional[str] = None, + key_vault_properties: Optional[List["KeyVaultKeyProperties"]] = None, + **kwargs + ): + super(EncryptionPropertiesDescription, self).__init__(**kwargs) + self.key_source = key_source + self.key_vault_properties = key_vault_properties + + +class EndpointHealthData(msrest.serialization.Model): + """The health data for an endpoint. + + :param endpoint_id: Id of the endpoint. + :type endpoint_id: str + :param health_status: Health statuses have following meanings. The 'healthy' status shows that + the endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint + is not accepting messages as expected and IoT Hub is retrying to send data to this endpoint. + The status of an unhealthy endpoint will be updated to healthy when IoT Hub has established an + eventually consistent state of health. The 'dead' status shows that the endpoint is not + accepting messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub + metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + the IoT Hub has not established a connection with the endpoint. No messages have been delivered + to or rejected from this endpoint. Possible values include: "unknown", "healthy", "degraded", + "unhealthy", "dead". + :type health_status: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthStatus + :param last_known_error: Last error obtained when a message failed to be delivered to iot hub. + :type last_known_error: str + :param last_known_error_time: Time at which the last known error occurred. + :type last_known_error_time: ~datetime.datetime + :param last_successful_send_attempt_time: Last time iot hub successfully sent a message to the + endpoint. + :type last_successful_send_attempt_time: ~datetime.datetime + :param last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. + :type last_send_attempt_time: ~datetime.datetime + """ + + _attribute_map = { + 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, + 'health_status': {'key': 'healthStatus', 'type': 'str'}, + 'last_known_error': {'key': 'lastKnownError', 'type': 'str'}, + 'last_known_error_time': {'key': 'lastKnownErrorTime', 'type': 'rfc-1123'}, + 'last_successful_send_attempt_time': {'key': 'lastSuccessfulSendAttemptTime', 'type': 'rfc-1123'}, + 'last_send_attempt_time': {'key': 'lastSendAttemptTime', 'type': 'rfc-1123'}, + } + + def __init__( + self, + *, + endpoint_id: Optional[str] = None, + health_status: Optional[Union[str, "EndpointHealthStatus"]] = None, + last_known_error: Optional[str] = None, + last_known_error_time: Optional[datetime.datetime] = None, + last_successful_send_attempt_time: Optional[datetime.datetime] = None, + last_send_attempt_time: Optional[datetime.datetime] = None, + **kwargs + ): + super(EndpointHealthData, self).__init__(**kwargs) + self.endpoint_id = endpoint_id + self.health_status = health_status + self.last_known_error = last_known_error + self.last_known_error_time = last_known_error_time + self.last_successful_send_attempt_time = last_successful_send_attempt_time + self.last_send_attempt_time = last_send_attempt_time + + +class EndpointHealthDataListResult(msrest.serialization.Model): + """The JSON-serialized array of EndpointHealthData objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: JSON-serialized array of Endpoint health data. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthData] + :ivar next_link: Link to more results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EndpointHealthData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EndpointHealthData"]] = None, + **kwargs + ): + super(EndpointHealthDataListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class EnrichmentProperties(msrest.serialization.Model): + """The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key or name for the enrichment property. + :type key: str + :param value: Required. The value for the enrichment property. + :type value: str + :param endpoint_names: Required. The list of endpoints for which the enrichment is applied to + the message. + :type endpoint_names: list[str] + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'endpoint_names': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + key: str, + value: str, + endpoint_names: List[str], + **kwargs + ): + super(EnrichmentProperties, self).__init__(**kwargs) + self.key = key + self.value = value + self.endpoint_names = endpoint_names + + +class ErrorDetails(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class EventHubConsumerGroupBodyDescription(msrest.serialization.Model): + """The EventHub consumer group. + + :param properties: The EventHub consumer group name. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupName + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'EventHubConsumerGroupName'}, + } + + def __init__( + self, + *, + properties: Optional["EventHubConsumerGroupName"] = None, + **kwargs + ): + super(EventHubConsumerGroupBodyDescription, self).__init__(**kwargs) + self.properties = properties + + +class EventHubConsumerGroupInfo(msrest.serialization.Model): + """The properties of the EventHubConsumerGroupInfo object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The tags. + :type properties: dict[str, str] + :ivar id: The Event Hub-compatible consumer group identifier. + :vartype id: str + :ivar name: The Event Hub-compatible consumer group name. + :vartype name: str + :ivar type: the resource type. + :vartype type: str + :ivar etag: The etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(EventHubConsumerGroupInfo, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.type = None + self.etag = None + + +class EventHubConsumerGroupName(msrest.serialization.Model): + """The EventHub consumer group name. + + :param name: EventHub consumer group name. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + super(EventHubConsumerGroupName, self).__init__(**kwargs) + self.name = name + + +class EventHubConsumerGroupsListResult(msrest.serialization.Model): + """The JSON-serialized array of Event Hub-compatible consumer group names with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of consumer groups objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventHubConsumerGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EventHubConsumerGroupInfo"]] = None, + **kwargs + ): + super(EventHubConsumerGroupsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class EventHubProperties(msrest.serialization.Model): + """The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param retention_time_in_days: The retention time for device-to-cloud messages in days. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type retention_time_in_days: long + :param partition_count: The number of partitions for receiving device-to-cloud messages in the + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type partition_count: int + :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. + :vartype partition_ids: list[str] + :ivar path: The Event Hub-compatible name. + :vartype path: str + :ivar endpoint: The Event Hub-compatible endpoint. + :vartype endpoint: str + """ + + _validation = { + 'partition_ids': {'readonly': True}, + 'path': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'retention_time_in_days': {'key': 'retentionTimeInDays', 'type': 'long'}, + 'partition_count': {'key': 'partitionCount', 'type': 'int'}, + 'partition_ids': {'key': 'partitionIds', 'type': '[str]'}, + 'path': {'key': 'path', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + *, + retention_time_in_days: Optional[int] = None, + partition_count: Optional[int] = None, + **kwargs + ): + super(EventHubProperties, self).__init__(**kwargs) + self.retention_time_in_days = retention_time_in_days + self.partition_count = partition_count + self.partition_ids = None + self.path = None + self.endpoint = None + + +class ExportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an export of all devices in the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param export_blob_container_uri: Required. The export blob container URI. + :type export_blob_container_uri: str + :param exclude_keys: Required. The value indicating whether keys should be excluded during + export. + :type exclude_keys: bool + :param export_blob_name: The name of the blob that will be created in the provided output blob + container. This blob will contain the exported device registry information for the IoT Hub. + :type export_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for export devices. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + """ + + _validation = { + 'export_blob_container_uri': {'required': True}, + 'exclude_keys': {'required': True}, + } + + _attribute_map = { + 'export_blob_container_uri': {'key': 'exportBlobContainerUri', 'type': 'str'}, + 'exclude_keys': {'key': 'excludeKeys', 'type': 'bool'}, + 'export_blob_name': {'key': 'exportBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + *, + export_blob_container_uri: str, + exclude_keys: bool, + export_blob_name: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + **kwargs + ): + super(ExportDevicesRequest, self).__init__(**kwargs) + self.export_blob_container_uri = export_blob_container_uri + self.exclude_keys = exclude_keys + self.export_blob_name = export_blob_name + self.authentication_type = authentication_type + self.identity = identity + + +class FailoverInput(msrest.serialization.Model): + """Use to provide failover region when requesting manual Failover for a hub. + + All required parameters must be populated in order to send to Azure. + + :param failover_region: Required. Region the hub will be failed over to. + :type failover_region: str + """ + + _validation = { + 'failover_region': {'required': True}, + } + + _attribute_map = { + 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, + } + + def __init__( + self, + *, + failover_region: str, + **kwargs + ): + super(FailoverInput, self).__init__(**kwargs) + self.failover_region = failover_region + + +class FallbackRouteProperties(msrest.serialization.Model): + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the route. The name can only include alphanumeric characters, periods, + underscores, hyphens, has a maximum length of 64 characters, and must be unique. + :type name: str + :param source: Required. The source to which the routing rule is to be applied to. For example, + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DigitalTwinChangeEvents", + "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource + :param condition: The condition which is evaluated in order to apply the fallback route. If the + condition is not provided it will evaluate to true by default. For grammar, See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which the messages that satisfy the + condition are routed to. Currently only 1 endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether the fallback route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + source: Union[str, "RoutingSource"], + endpoint_names: List[str], + is_enabled: bool, + name: Optional[str] = None, + condition: Optional[str] = None, + **kwargs + ): + super(FallbackRouteProperties, self).__init__(**kwargs) + self.name = name + self.source = source + self.condition = condition + self.endpoint_names = endpoint_names + self.is_enabled = is_enabled + + +class FeedbackProperties(msrest.serialization.Model): + """The properties of the feedback queue for cloud-to-device messages. + + :param lock_duration_as_iso8601: The lock duration for the feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + *, + lock_duration_as_iso8601: Optional[datetime.timedelta] = None, + ttl_as_iso8601: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + **kwargs + ): + super(FeedbackProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = lock_duration_as_iso8601 + self.ttl_as_iso8601 = ttl_as_iso8601 + self.max_delivery_count = max_delivery_count + + +class GroupIdInformation(msrest.serialization.Model): + """The group information for creating a private endpoint on an IotHub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties for a group information object. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'GroupIdInformationProperties'}, + } + + def __init__( + self, + *, + properties: "GroupIdInformationProperties", + **kwargs + ): + super(GroupIdInformation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class GroupIdInformationProperties(msrest.serialization.Model): + """The properties for a group information object. + + :param group_id: The group id. + :type group_id: str + :param required_members: The required members for a specific group id. + :type required_members: list[str] + :param required_zone_names: The required DNS zones for a specific group id. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(GroupIdInformationProperties, self).__init__(**kwargs) + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + + +class ImportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an import of all devices in the hub. + + All required parameters must be populated in order to send to Azure. + + :param input_blob_container_uri: Required. The input blob container URI. + :type input_blob_container_uri: str + :param output_blob_container_uri: Required. The output blob container URI. + :type output_blob_container_uri: str + :param input_blob_name: The blob name to be used when importing from the provided input blob + container. + :type input_blob_name: str + :param output_blob_name: The blob name to use for storing the status of the import job. + :type output_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for import devices. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + """ + + _validation = { + 'input_blob_container_uri': {'required': True}, + 'output_blob_container_uri': {'required': True}, + } + + _attribute_map = { + 'input_blob_container_uri': {'key': 'inputBlobContainerUri', 'type': 'str'}, + 'output_blob_container_uri': {'key': 'outputBlobContainerUri', 'type': 'str'}, + 'input_blob_name': {'key': 'inputBlobName', 'type': 'str'}, + 'output_blob_name': {'key': 'outputBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + *, + input_blob_container_uri: str, + output_blob_container_uri: str, + input_blob_name: Optional[str] = None, + output_blob_name: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + **kwargs + ): + super(ImportDevicesRequest, self).__init__(**kwargs) + self.input_blob_container_uri = input_blob_container_uri + self.output_blob_container_uri = output_blob_container_uri + self.input_blob_name = input_blob_name + self.output_blob_name = output_blob_name + self.authentication_type = authentication_type + self.identity = identity + + +class IotHubCapacity(msrest.serialization.Model): + """IoT Hub capacity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum number of units. + :vartype minimum: long + :ivar maximum: The maximum number of units. + :vartype maximum: long + :ivar default: The default number of units. + :vartype default: long + :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", + "Manual", "None". + :vartype scale_type: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubScaleType + """ + + _validation = { + 'minimum': {'readonly': True, 'maximum': 1, 'minimum': 1}, + 'maximum': {'readonly': True}, + 'default': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default': {'key': 'default', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default = None + self.scale_type = None + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class IotHubDescription(Resource): + """The description of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: IotHub properties. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubProperties + :param sku: Required. IotHub SKU info. + :type sku: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuInfo + :param identity: The managed identities for the IotHub. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ArmIdentity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotHubProperties'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'identity': {'key': 'identity', 'type': 'ArmIdentity'}, + } + + def __init__( + self, + *, + location: str, + sku: "IotHubSkuInfo", + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + properties: Optional["IotHubProperties"] = None, + identity: Optional["ArmIdentity"] = None, + **kwargs + ): + super(IotHubDescription, self).__init__(location=location, tags=tags, **kwargs) + self.etag = etag + self.properties = properties + self.sku = sku + self.identity = identity + + +class IotHubDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubDescription objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubDescription"]] = None, + **kwargs + ): + super(IotHubDescriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubLocationDescription(msrest.serialization.Model): + """Public representation of one of the locations where a resource is provisioned. + + :param location: The name of the Azure region. + :type location: str + :param role: The role of the region, can be either primary or secondary. The primary region is + where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery + (DR) paired region and also the region where the IoT hub can failover to. Possible values + include: "primary", "secondary". + :type role: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubReplicaRoleType + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + role: Optional[Union[str, "IotHubReplicaRoleType"]] = None, + **kwargs + ): + super(IotHubLocationDescription, self).__init__(**kwargs) + self.location = location + self.role = role + + +class IotHubNameAvailabilityInfo(msrest.serialization.Model): + """The properties indicating whether a given IoT hub name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: The value which indicates whether the provided name is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + **kwargs + ): + super(IotHubNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = message + + +class IotHubProperties(msrest.serialization.Model): + """The properties of an IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param authorization_policies: The shared access policies you can use to secure a connection to + the IoT hub. + :type authorization_policies: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule] + :param public_network_access: Whether requests from Public Network are allowed. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.PublicNetworkAccess + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IpFilterRule] + :param network_rule_sets: Network Rule Set Properties of IotHub. + :type network_rule_sets: ~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleSetProperties + :param min_tls_version: Specifies the minimum TLS version to support for this hub. Can be set + to "1.2" to have clients that use a TLS version below 1.2 to be rejected. + :type min_tls_version: str + :param private_endpoint_connections: Private endpoint connections created on this IotHub. + :type private_endpoint_connections: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :ivar state: The hub state. + :vartype state: str + :ivar host_name: The name of the host. + :vartype host_name: str + :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible + keys to this dictionary is events. This key has to be present in the dictionary while making + create or update calls for the IoT hub. + :type event_hub_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubProperties] + :param routing: The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + :type routing: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingProperties + :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. + Currently you can configure only one Azure Storage account and that MUST have its key as + $default. Specifying more than one storage account causes an error to be thrown. Not specifying + a value for this property when the enableFileUploadNotifications property is set to True, + causes an error to be thrown. + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_03_preview.models.StorageEndpointProperties] + :param messaging_endpoints: The messaging endpoint properties for the file upload notification + queue. + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_03_preview.models.MessagingEndpointProperties] + :param enable_file_upload_notifications: If True, file upload notifications are enabled. + :type enable_file_upload_notifications: bool + :param cloud_to_device: The IoT hub cloud-to-device messaging properties. + :type cloud_to_device: ~azure.mgmt.iothub.v2021_03_03_preview.models.CloudToDeviceProperties + :param comments: IoT hub comments. + :type comments: str + :param device_streams: The device streams properties of iothub. + :type device_streams: + ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubPropertiesDeviceStreams + :param features: The capabilities and features enabled for the IoT hub. Possible values + include: "None", "DeviceManagement". + :type features: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.Capabilities + :param encryption: The encryption properties for the IoT hub. + :type encryption: ~azure.mgmt.iothub.v2021_03_03_preview.models.EncryptionPropertiesDescription + :ivar locations: Primary and secondary location for iot hub. + :vartype locations: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubLocationDescription] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'host_name': {'readonly': True}, + 'locations': {'readonly': True}, + } + + _attribute_map = { + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'network_rule_sets': {'key': 'networkRuleSets', 'type': 'NetworkRuleSetProperties'}, + 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'event_hub_endpoints': {'key': 'eventHubEndpoints', 'type': '{EventHubProperties}'}, + 'routing': {'key': 'routing', 'type': 'RoutingProperties'}, + 'storage_endpoints': {'key': 'storageEndpoints', 'type': '{StorageEndpointProperties}'}, + 'messaging_endpoints': {'key': 'messagingEndpoints', 'type': '{MessagingEndpointProperties}'}, + 'enable_file_upload_notifications': {'key': 'enableFileUploadNotifications', 'type': 'bool'}, + 'cloud_to_device': {'key': 'cloudToDevice', 'type': 'CloudToDeviceProperties'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'device_streams': {'key': 'deviceStreams', 'type': 'IotHubPropertiesDeviceStreams'}, + 'features': {'key': 'features', 'type': 'str'}, + 'encryption': {'key': 'encryption', 'type': 'EncryptionPropertiesDescription'}, + 'locations': {'key': 'locations', 'type': '[IotHubLocationDescription]'}, + } + + def __init__( + self, + *, + authorization_policies: Optional[List["SharedAccessSignatureAuthorizationRule"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + ip_filter_rules: Optional[List["IpFilterRule"]] = None, + network_rule_sets: Optional["NetworkRuleSetProperties"] = None, + min_tls_version: Optional[str] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + event_hub_endpoints: Optional[Dict[str, "EventHubProperties"]] = None, + routing: Optional["RoutingProperties"] = None, + storage_endpoints: Optional[Dict[str, "StorageEndpointProperties"]] = None, + messaging_endpoints: Optional[Dict[str, "MessagingEndpointProperties"]] = None, + enable_file_upload_notifications: Optional[bool] = None, + cloud_to_device: Optional["CloudToDeviceProperties"] = None, + comments: Optional[str] = None, + device_streams: Optional["IotHubPropertiesDeviceStreams"] = None, + features: Optional[Union[str, "Capabilities"]] = None, + encryption: Optional["EncryptionPropertiesDescription"] = None, + **kwargs + ): + super(IotHubProperties, self).__init__(**kwargs) + self.authorization_policies = authorization_policies + self.public_network_access = public_network_access + self.ip_filter_rules = ip_filter_rules + self.network_rule_sets = network_rule_sets + self.min_tls_version = min_tls_version + self.private_endpoint_connections = private_endpoint_connections + self.provisioning_state = None + self.state = None + self.host_name = None + self.event_hub_endpoints = event_hub_endpoints + self.routing = routing + self.storage_endpoints = storage_endpoints + self.messaging_endpoints = messaging_endpoints + self.enable_file_upload_notifications = enable_file_upload_notifications + self.cloud_to_device = cloud_to_device + self.comments = comments + self.device_streams = device_streams + self.features = features + self.encryption = encryption + self.locations = None + + +class IotHubPropertiesDeviceStreams(msrest.serialization.Model): + """The device streams properties of iothub. + + :param streaming_endpoints: List of Device Streams Endpoints. + :type streaming_endpoints: list[str] + """ + + _attribute_map = { + 'streaming_endpoints': {'key': 'streamingEndpoints', 'type': '[str]'}, + } + + def __init__( + self, + *, + streaming_endpoints: Optional[List[str]] = None, + **kwargs + ): + super(IotHubPropertiesDeviceStreams, self).__init__(**kwargs) + self.streaming_endpoints = streaming_endpoints + + +class IotHubQuotaMetricInfo(msrest.serialization.Model): + """Quota metrics properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the quota metric. + :vartype name: str + :ivar current_value: The current value for the quota metric. + :vartype current_value: long + :ivar max_value: The maximum value of the quota metric. + :vartype max_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'current_value': {'readonly': True}, + 'max_value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'max_value': {'key': 'maxValue', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfo, self).__init__(**kwargs) + self.name = None + self.current_value = None + self.max_value = None + + +class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of quota metrics objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubQuotaMetricInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubQuotaMetricInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubQuotaMetricInfo"]] = None, + **kwargs + ): + super(IotHubQuotaMetricInfoListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubSkuDescription(msrest.serialization.Model): + """SKU properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :param sku: Required. The type of the resource. + :type sku: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuInfo + :param capacity: Required. IotHub capacity. + :type capacity: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'required': True}, + 'capacity': {'required': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'capacity': {'key': 'capacity', 'type': 'IotHubCapacity'}, + } + + def __init__( + self, + *, + sku: "IotHubSkuInfo", + capacity: "IotHubCapacity", + **kwargs + ): + super(IotHubSkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.sku = sku + self.capacity = capacity + + +class IotHubSkuDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubSkuDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubSkuDescription. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubSkuDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubSkuDescription"]] = None, + **kwargs + ): + super(IotHubSkuDescriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubSkuInfo(msrest.serialization.Model): + """Information about the SKU of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", + "B1", "B2", "B3". + :type name: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSku + :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", + "Basic". + :vartype tier: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuTier + :param capacity: The number of provisioned IoT Hub units. See: + https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + :type capacity: long + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + *, + name: Union[str, "IotHubSku"], + capacity: Optional[int] = None, + **kwargs + ): + super(IotHubSkuInfo, self).__init__(**kwargs) + self.name = name + self.tier = None + self.capacity = capacity + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + *, + filter_name: str, + action: Union[str, "IpFilterActionType"], + ip_mask: str, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = filter_name + self.action = action + self.ip_mask = ip_mask + + +class JobResponse(msrest.serialization.Model): + """The properties of the Job Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_id: The job identifier. + :vartype job_id: str + :ivar start_time_utc: The start time of the job. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: The time the job stopped processing. + :vartype end_time_utc: ~datetime.datetime + :ivar type: The type of the job. Possible values include: "unknown", "export", "import", + "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", + "rebootDevice", "factoryResetDevice", "firmwareUpdate". + :vartype type: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.JobType + :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", + "completed", "failed", "cancelled". + :vartype status: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.JobStatus + :ivar failure_reason: If status == failed, this string containing the reason for the failure. + :vartype failure_reason: str + :ivar status_message: The status message for the job. + :vartype status_message: str + :ivar parent_job_id: The job identifier of the parent job, if any. + :vartype parent_job_id: str + """ + + _validation = { + 'job_id': {'readonly': True}, + 'start_time_utc': {'readonly': True}, + 'end_time_utc': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'status_message': {'readonly': True}, + 'parent_job_id': {'readonly': True}, + } + + _attribute_map = { + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'rfc-1123'}, + 'end_time_utc': {'key': 'endTimeUtc', 'type': 'rfc-1123'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'parent_job_id': {'key': 'parentJobId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.job_id = None + self.start_time_utc = None + self.end_time_utc = None + self.type = None + self.status = None + self.failure_reason = None + self.status_message = None + self.parent_job_id = None + + +class JobResponseListResult(msrest.serialization.Model): + """The JSON-serialized array of JobResponse objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of JobResponse objects. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JobResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["JobResponse"]] = None, + **kwargs + ): + super(JobResponseListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class KeyVaultKeyProperties(msrest.serialization.Model): + """The properties of the KeyVault key. + + :param key_identifier: The identifier of the key. + :type key_identifier: str + :param identity: Managed identity properties of KeyVault Key. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + """ + + _attribute_map = { + 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + *, + key_identifier: Optional[str] = None, + identity: Optional["ManagedIdentity"] = None, + **kwargs + ): + super(KeyVaultKeyProperties, self).__init__(**kwargs) + self.key_identifier = key_identifier + self.identity = identity + + +class ManagedIdentity(msrest.serialization.Model): + """The properties of the Managed identity. + + :param user_assigned_identity: The user assigned identity. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + *, + user_assigned_identity: Optional[str] = None, + **kwargs + ): + super(ManagedIdentity, self).__init__(**kwargs) + self.user_assigned_identity = user_assigned_identity + + +class MatchedRoute(msrest.serialization.Model): + """Routes that matched. + + :param properties: Properties of routes that matched. + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RouteProperties'}, + } + + def __init__( + self, + *, + properties: Optional["RouteProperties"] = None, + **kwargs + ): + super(MatchedRoute, self).__init__(**kwargs) + self.properties = properties + + +class MessagingEndpointProperties(msrest.serialization.Model): + """The properties of the messaging endpoints used by this IoT hub. + + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + *, + lock_duration_as_iso8601: Optional[datetime.timedelta] = None, + ttl_as_iso8601: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + **kwargs + ): + super(MessagingEndpointProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = lock_duration_as_iso8601 + self.ttl_as_iso8601 = ttl_as_iso8601 + self.max_delivery_count = max_delivery_count + + +class Name(msrest.serialization.Model): + """Name of Iot Hub type. + + :param value: IotHub type. + :type value: str + :param localized_value: Localized value of name. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): + super(Name, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class NetworkRuleSetIpRule(msrest.serialization.Model): + """IP Rule to be applied as part of Network Rule Set. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. Name of the IP filter rule. + :type filter_name: str + :param action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleIPAction + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + *, + filter_name: str, + ip_mask: str, + action: Optional[Union[str, "NetworkRuleIPAction"]] = "Allow", + **kwargs + ): + super(NetworkRuleSetIpRule, self).__init__(**kwargs) + self.filter_name = filter_name + self.action = action + self.ip_mask = ip_mask + + +class NetworkRuleSetProperties(msrest.serialization.Model): + """Network Rule Set Properties of IotHub. + + All required parameters must be populated in order to send to Azure. + + :param default_action: Default Action for Network Rule Set. Possible values include: "Deny", + "Allow". Default value: "Deny". + :type default_action: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.DefaultAction + :param apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also + applied to BuiltIn EventHub EndPoint of IotHub. + :type apply_to_built_in_event_hub_endpoint: bool + :param ip_rules: Required. List of IP Rules. + :type ip_rules: list[~azure.mgmt.iothub.v2021_03_03_preview.models.NetworkRuleSetIpRule] + """ + + _validation = { + 'apply_to_built_in_event_hub_endpoint': {'required': True}, + 'ip_rules': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'apply_to_built_in_event_hub_endpoint': {'key': 'applyToBuiltInEventHubEndpoint', 'type': 'bool'}, + 'ip_rules': {'key': 'ipRules', 'type': '[NetworkRuleSetIpRule]'}, + } + + def __init__( + self, + *, + apply_to_built_in_event_hub_endpoint: bool, + ip_rules: List["NetworkRuleSetIpRule"], + default_action: Optional[Union[str, "DefaultAction"]] = "Deny", + **kwargs + ): + super(NetworkRuleSetProperties, self).__init__(**kwargs) + self.default_action = default_action + self.apply_to_built_in_event_hub_endpoint = apply_to_built_in_event_hub_endpoint + self.ip_rules = ip_rules + + +class Operation(msrest.serialization.Model): + """IoT Hub REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothub.v2021_03_03_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: IotHubs. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationInputs(msrest.serialization.Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the IoT hub to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = name + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. + :vartype value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """The private endpoint property of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(msrest.serialization.Model): + """The private endpoint connection of an IotHub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties of a private endpoint connection. + :type properties: + ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + *, + properties: "PrivateEndpointConnectionProperties", + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """The properties of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param private_endpoint: The private endpoint property of a private endpoint connection. + :type private_endpoint: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Required. The current state of a private endpoint + connection. + :type private_link_service_connection_state: + ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'private_link_service_connection_state': {'required': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + *, + private_link_service_connection_state: "PrivateLinkServiceConnectionState", + private_endpoint: Optional["PrivateEndpoint"] = None, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateLinkResources(msrest.serialization.Model): + """The available private link resources for an IotHub. + + :param value: The list of available private link resources for an IotHub. + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, + } + + def __init__( + self, + *, + value: Optional[List["GroupIdInformation"]] = None, + **kwargs + ): + super(PrivateLinkResources, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The current state of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of a private endpoint connection. Possible values include: + "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkServiceConnectionStatus + :param description: Required. The description for the current state of a private endpoint + connection. + :type description: str + :param actions_required: Actions required for a private endpoint connection. + :type actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Union[str, "PrivateLinkServiceConnectionStatus"], + description: str, + actions_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class RegistryStatistics(msrest.serialization.Model): + """Identity registry statistics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_device_count: The total count of devices in the identity registry. + :vartype total_device_count: long + :ivar enabled_device_count: The count of enabled devices in the identity registry. + :vartype enabled_device_count: long + :ivar disabled_device_count: The count of disabled devices in the identity registry. + :vartype disabled_device_count: long + """ + + _validation = { + 'total_device_count': {'readonly': True}, + 'enabled_device_count': {'readonly': True}, + 'disabled_device_count': {'readonly': True}, + } + + _attribute_map = { + 'total_device_count': {'key': 'totalDeviceCount', 'type': 'long'}, + 'enabled_device_count': {'key': 'enabledDeviceCount', 'type': 'long'}, + 'disabled_device_count': {'key': 'disabledDeviceCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryStatistics, self).__init__(**kwargs) + self.total_device_count = None + self.enabled_device_count = None + self.disabled_device_count = None + + +class RouteCompilationError(msrest.serialization.Model): + """Compilation error when evaluating route. + + :param message: Route error message. + :type message: str + :param severity: Severity of the route error. Possible values include: "error", "warning". + :type severity: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorSeverity + :param location: Location where the route error happened. + :type location: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorRange + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'RouteErrorRange'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + severity: Optional[Union[str, "RouteErrorSeverity"]] = None, + location: Optional["RouteErrorRange"] = None, + **kwargs + ): + super(RouteCompilationError, self).__init__(**kwargs) + self.message = message + self.severity = severity + self.location = location + + +class RouteErrorPosition(msrest.serialization.Model): + """Position where the route error happened. + + :param line: Line where the route error happened. + :type line: int + :param column: Column where the route error happened. + :type column: int + """ + + _attribute_map = { + 'line': {'key': 'line', 'type': 'int'}, + 'column': {'key': 'column', 'type': 'int'}, + } + + def __init__( + self, + *, + line: Optional[int] = None, + column: Optional[int] = None, + **kwargs + ): + super(RouteErrorPosition, self).__init__(**kwargs) + self.line = line + self.column = column + + +class RouteErrorRange(msrest.serialization.Model): + """Range of route errors. + + :param start: Start where the route error happened. + :type start: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorPosition + :param end: End where the route error happened. + :type end: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteErrorPosition + """ + + _attribute_map = { + 'start': {'key': 'start', 'type': 'RouteErrorPosition'}, + 'end': {'key': 'end', 'type': 'RouteErrorPosition'}, + } + + def __init__( + self, + *, + start: Optional["RouteErrorPosition"] = None, + end: Optional["RouteErrorPosition"] = None, + **kwargs + ): + super(RouteErrorRange, self).__init__(**kwargs) + self.start = start + self.end = end + + +class RouteProperties(msrest.serialization.Model): + """The properties of a routing rule that your IoT hub uses to route messages to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route. The name can only include alphanumeric + characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be + unique. + :type name: str + :param source: Required. The source that the routing rule is to be applied to, such as + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DigitalTwinChangeEvents", + "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource + :param condition: The condition that is evaluated to apply the routing rule. If no condition is + provided, it evaluates to true by default. For grammar, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which messages that satisfy the + condition are routed. Currently only one endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether a route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + source: Union[str, "RoutingSource"], + endpoint_names: List[str], + is_enabled: bool, + condition: Optional[str] = None, + **kwargs + ): + super(RouteProperties, self).__init__(**kwargs) + self.name = name + self.source = source + self.condition = condition + self.endpoint_names = endpoint_names + self.is_enabled = is_enabled + + +class RoutingEndpoints(msrest.serialization.Model): + """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + + :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the + messages to, based on the routing rules. + :type service_bus_queues: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingServiceBusQueueEndpointProperties] + :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the + messages to, based on the routing rules. + :type service_bus_topics: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingServiceBusTopicEndpointProperties] + :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on + the routing rules. This list does not include the built-in Event Hubs endpoint. + :type event_hubs: list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingEventHubProperties] + :param storage_containers: The list of storage container endpoints that IoT hub routes messages + to, based on the routing rules. + :type storage_containers: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingStorageContainerProperties] + """ + + _attribute_map = { + 'service_bus_queues': {'key': 'serviceBusQueues', 'type': '[RoutingServiceBusQueueEndpointProperties]'}, + 'service_bus_topics': {'key': 'serviceBusTopics', 'type': '[RoutingServiceBusTopicEndpointProperties]'}, + 'event_hubs': {'key': 'eventHubs', 'type': '[RoutingEventHubProperties]'}, + 'storage_containers': {'key': 'storageContainers', 'type': '[RoutingStorageContainerProperties]'}, + } + + def __init__( + self, + *, + service_bus_queues: Optional[List["RoutingServiceBusQueueEndpointProperties"]] = None, + service_bus_topics: Optional[List["RoutingServiceBusTopicEndpointProperties"]] = None, + event_hubs: Optional[List["RoutingEventHubProperties"]] = None, + storage_containers: Optional[List["RoutingStorageContainerProperties"]] = None, + **kwargs + ): + super(RoutingEndpoints, self).__init__(**kwargs) + self.service_bus_queues = service_bus_queues + self.service_bus_topics = service_bus_topics + self.event_hubs = event_hubs + self.storage_containers = storage_containers + + +class RoutingEventHubProperties(msrest.serialization.Model): + """The properties related to an event hub endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the event hub endpoint. + :type id: str + :param connection_string: The connection string of the event hub endpoint. + :type connection_string: str + :param endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. + :type endpoint_uri: str + :param entity_path: Event hub name on the event hub namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the event hub endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of routing event hub endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the event hub endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the event hub endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + entity_path: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingEventHubProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.entity_path = entity_path + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingMessage(msrest.serialization.Model): + """Routing message. + + :param body: Body of routing message. + :type body: str + :param app_properties: App properties. + :type app_properties: dict[str, str] + :param system_properties: System properties. + :type system_properties: dict[str, str] + """ + + _attribute_map = { + 'body': {'key': 'body', 'type': 'str'}, + 'app_properties': {'key': 'appProperties', 'type': '{str}'}, + 'system_properties': {'key': 'systemProperties', 'type': '{str}'}, + } + + def __init__( + self, + *, + body: Optional[str] = None, + app_properties: Optional[Dict[str, str]] = None, + system_properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(RoutingMessage, self).__init__(**kwargs) + self.body = body + self.app_properties = app_properties + self.system_properties = system_properties + + +class RoutingProperties(msrest.serialization.Model): + """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + + :param endpoints: The properties related to the custom endpoints to which your IoT hub routes + messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all + endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types + for free hubs. + :type endpoints: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingEndpoints + :param routes: The list of user-provided routing rules that the IoT hub uses to route messages + to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and + a maximum of 5 routing rules are allowed for free hubs. + :type routes: list[~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties] + :param fallback_route: The properties of the route that is used as a fall-back route when none + of the conditions specified in the 'routes' section are met. This is an optional parameter. + When this property is not set, the messages which do not meet any of the conditions specified + in the 'routes' section get routed to the built-in eventhub endpoint. + :type fallback_route: ~azure.mgmt.iothub.v2021_03_03_preview.models.FallbackRouteProperties + :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages + to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. + :type enrichments: list[~azure.mgmt.iothub.v2021_03_03_preview.models.EnrichmentProperties] + """ + + _attribute_map = { + 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, + 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, + 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, + 'enrichments': {'key': 'enrichments', 'type': '[EnrichmentProperties]'}, + } + + def __init__( + self, + *, + endpoints: Optional["RoutingEndpoints"] = None, + routes: Optional[List["RouteProperties"]] = None, + fallback_route: Optional["FallbackRouteProperties"] = None, + enrichments: Optional[List["EnrichmentProperties"]] = None, + **kwargs + ): + super(RoutingProperties, self).__init__(**kwargs) + self.endpoints = endpoints + self.routes = routes + self.fallback_route = fallback_route + self.enrichments = enrichments + + +class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): + """The properties related to service bus queue endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus queue endpoint. + :type id: str + :param connection_string: The connection string of the service bus queue endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus queue endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus queue endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of routing service bus queue endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual queue + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus queue endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus queue endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + entity_path: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingServiceBusQueueEndpointProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.entity_path = entity_path + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): + """The properties related to service bus topic endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus topic endpoint. + :type id: str + :param connection_string: The connection string of the service bus topic endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus topic endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus topic. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus topic endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of routing service bus topic endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual topic + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus topic endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus topic endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + entity_path: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingServiceBusTopicEndpointProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.entity_path = entity_path + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingStorageContainerProperties(msrest.serialization.Model): + """The properties related to a storage container endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the storage container endpoint. + :type id: str + :param connection_string: The connection string of the storage account. + :type connection_string: str + :param endpoint_uri: The url of the storage endpoint. It must include the protocol https://. + :type endpoint_uri: str + :param authentication_type: Method used to authenticate against the storage endpoint. Possible + values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of routing storage endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the storage account. + :type subscription_id: str + :param resource_group: The name of the resource group of the storage account. + :type resource_group: str + :param container_name: Required. The name of storage container in the storage account. + :type container_name: str + :param file_name_format: File name format for the blob. Default format is + {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be + reordered. + :type file_name_format: str + :param batch_frequency_in_seconds: Time interval at which blobs are written to storage. Value + should be between 60 and 720 seconds. Default value is 300 seconds. + :type batch_frequency_in_seconds: int + :param max_chunk_size_in_bytes: Maximum number of bytes for each blob written to storage. Value + should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + :type max_chunk_size_in_bytes: int + :param encoding: Encoding that is used to serialize messages to blobs. Supported values are + 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", + "AvroDeflate", "JSON". + :type encoding: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingStorageContainerPropertiesEncoding + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'container_name': {'required': True}, + 'batch_frequency_in_seconds': {'maximum': 720, 'minimum': 60}, + 'max_chunk_size_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'file_name_format': {'key': 'fileNameFormat', 'type': 'str'}, + 'batch_frequency_in_seconds': {'key': 'batchFrequencyInSeconds', 'type': 'int'}, + 'max_chunk_size_in_bytes': {'key': 'maxChunkSizeInBytes', 'type': 'int'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + container_name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + file_name_format: Optional[str] = None, + batch_frequency_in_seconds: Optional[int] = None, + max_chunk_size_in_bytes: Optional[int] = None, + encoding: Optional[Union[str, "RoutingStorageContainerPropertiesEncoding"]] = None, + **kwargs + ): + super(RoutingStorageContainerProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + self.container_name = container_name + self.file_name_format = file_name_format + self.batch_frequency_in_seconds = batch_frequency_in_seconds + self.max_chunk_size_in_bytes = max_chunk_size_in_bytes + self.encoding = encoding + + +class RoutingTwin(msrest.serialization.Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: A set of tags. Twin Tags. + :type tags: str + :param properties: + :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__( + self, + *, + tags: Optional[str] = None, + properties: Optional["RoutingTwinProperties"] = None, + **kwargs + ): + super(RoutingTwin, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class RoutingTwinProperties(msrest.serialization.Model): + """RoutingTwinProperties. + + :param desired: Twin desired properties. + :type desired: str + :param reported: Twin desired properties. + :type reported: str + """ + + _attribute_map = { + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, + } + + def __init__( + self, + *, + desired: Optional[str] = None, + reported: Optional[str] = None, + **kwargs + ): + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired = desired + self.reported = reported + + +class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): + """The properties of an IoT hub shared access policy. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the shared access policy. + :type key_name: str + :param primary_key: The primary key. + :type primary_key: str + :param secondary_key: The secondary key. + :type secondary_key: str + :param rights: Required. The permissions assigned to the shared access policy. Possible values + include: "RegistryRead", "RegistryWrite", "ServiceConnect", "DeviceConnect", "RegistryRead, + RegistryWrite", "RegistryRead, ServiceConnect", "RegistryRead, DeviceConnect", "RegistryWrite, + ServiceConnect", "RegistryWrite, DeviceConnect", "ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", + "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". + :type rights: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.AccessRights + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: str, + rights: Union[str, "AccessRights"], + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRule, self).__init__(**kwargs) + self.key_name = key_name + self.primary_key = primary_key + self.secondary_key = secondary_key + self.rights = rights + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """The list of shared access policies with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SharedAccessSignatureAuthorizationRule"]] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StorageEndpointProperties(msrest.serialization.Model): + """The properties of the Azure Storage endpoint for file upload. + + All required parameters must be populated in order to send to Azure. + + :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + :type sas_ttl_as_iso8601: ~datetime.timedelta + :param connection_string: Required. The connection string for the Azure Storage account to + which files are uploaded. + :type connection_string: str + :param container_name: Required. The name of the root container where you upload files. The + container need not exist but should be creatable using the connectionString specified. + :type container_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or + ~azure.mgmt.iothub.v2021_03_03_preview.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for file upload. + :type identity: ~azure.mgmt.iothub.v2021_03_03_preview.models.ManagedIdentity + """ + + _validation = { + 'connection_string': {'required': True}, + 'container_name': {'required': True}, + } + + _attribute_map = { + 'sas_ttl_as_iso8601': {'key': 'sasTtlAsIso8601', 'type': 'duration'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + *, + connection_string: str, + container_name: str, + sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + **kwargs + ): + super(StorageEndpointProperties, self).__init__(**kwargs) + self.sas_ttl_as_iso8601 = sas_ttl_as_iso8601 + self.connection_string = connection_string + self.container_name = container_name + self.authentication_type = authentication_type + self.identity = identity + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.tags = tags + + +class TestAllRoutesInput(msrest.serialization.Model): + """Input for testing all routes. + + :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", + "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", + "DigitalTwinChangeEvents", "DeviceConnectionStateEvents". + :type routing_source: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingSource + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingMessage + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwin + """ + + _attribute_map = { + 'routing_source': {'key': 'routingSource', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + *, + routing_source: Optional[Union[str, "RoutingSource"]] = None, + message: Optional["RoutingMessage"] = None, + twin: Optional["RoutingTwin"] = None, + **kwargs + ): + super(TestAllRoutesInput, self).__init__(**kwargs) + self.routing_source = routing_source + self.message = message + self.twin = twin + + +class TestAllRoutesResult(msrest.serialization.Model): + """Result of testing all routes. + + :param routes: JSON-serialized array of matched routes. + :type routes: list[~azure.mgmt.iothub.v2021_03_03_preview.models.MatchedRoute] + """ + + _attribute_map = { + 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, + } + + def __init__( + self, + *, + routes: Optional[List["MatchedRoute"]] = None, + **kwargs + ): + super(TestAllRoutesResult, self).__init__(**kwargs) + self.routes = routes + + +class TestRouteInput(msrest.serialization.Model): + """Input for testing route. + + All required parameters must be populated in order to send to Azure. + + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingMessage + :param route: Required. Route properties. + :type route: ~azure.mgmt.iothub.v2021_03_03_preview.models.RouteProperties + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwin + """ + + _validation = { + 'route': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + *, + route: "RouteProperties", + message: Optional["RoutingMessage"] = None, + twin: Optional["RoutingTwin"] = None, + **kwargs + ): + super(TestRouteInput, self).__init__(**kwargs) + self.message = message + self.route = route + self.twin = twin + + +class TestRouteResult(msrest.serialization.Model): + """Result of testing one route. + + :param result: Result of testing route. Possible values include: "undefined", "false", "true". + :type result: str or ~azure.mgmt.iothub.v2021_03_03_preview.models.TestResultStatus + :param details: Detailed result of testing route. + :type details: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteResultDetails + """ + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'TestRouteResultDetails'}, + } + + def __init__( + self, + *, + result: Optional[Union[str, "TestResultStatus"]] = None, + details: Optional["TestRouteResultDetails"] = None, + **kwargs + ): + super(TestRouteResult, self).__init__(**kwargs) + self.result = result + self.details = details + + +class TestRouteResultDetails(msrest.serialization.Model): + """Detailed result of testing a route. + + :param compilation_errors: JSON-serialized list of route compilation errors. + :type compilation_errors: + list[~azure.mgmt.iothub.v2021_03_03_preview.models.RouteCompilationError] + """ + + _attribute_map = { + 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, + } + + def __init__( + self, + *, + compilation_errors: Optional[List["RouteCompilationError"]] = None, + **kwargs + ): + super(TestRouteResultDetails, self).__init__(**kwargs) + self.compilation_errors = compilation_errors + + +class UserSubscriptionQuota(msrest.serialization.Model): + """User subscription quota response. + + :param id: IotHub type id. + :type id: str + :param type: Response type. + :type type: str + :param unit: Unit of IotHub type. + :type unit: str + :param current_value: Current number of IotHub type. + :type current_value: int + :param limit: Numerical limit on IotHub type. + :type limit: int + :param name: IotHub type. + :type name: ~azure.mgmt.iothub.v2021_03_03_preview.models.Name + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'Name'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + type: Optional[str] = None, + unit: Optional[str] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["Name"] = None, + **kwargs + ): + super(UserSubscriptionQuota, self).__init__(**kwargs) + self.id = id + self.type = type + self.unit = unit + self.current_value = current_value + self.limit = limit + self.name = name + + +class UserSubscriptionQuotaListResult(msrest.serialization.Model): + """Json-serialized array of User subscription quota response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: + :type value: list[~azure.mgmt.iothub.v2021_03_03_preview.models.UserSubscriptionQuota] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSubscriptionQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["UserSubscriptionQuota"]] = None, + **kwargs + ): + super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py new file mode 100644 index 000000000000..3930a2f261c8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._operations import Operations +from ._iot_hub_resource_operations import IotHubResourceOperations +from ._resource_provider_common_operations import ResourceProviderCommonOperations +from ._certificates_operations import CertificatesOperations +from ._iot_hub_operations import IotHubOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations + +__all__ = [ + 'Operations', + 'IotHubResourceOperations', + 'ResourceProviderCommonOperations', + 'CertificatesOperations', + 'IotHubOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py new file mode 100644 index 000000000000..fdec24959167 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_certificates_operations.py @@ -0,0 +1,474 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations(object): + """CertificatesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_iot_hub( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateListDescription" + """Get the certificate list. + + Returns the list of certificates. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_iot_hub.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_iot_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Get the certificate. + + Returns the certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + certificate_description, # type: "_models.CertificateDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Upload the certificate to the IoT hub. + + Adds new or replaces existing certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription + :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. + Required to update an existing certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_description, 'CertificateDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete an X509 certificate. + + Deletes an existing X509 certificate or does nothing if it does not exist. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def generate_verification_code( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateWithNonceDescription" + """Generate verification code for proof of possession flow. + + Generates verification code for proof of possession flow. The verification code will be used to + generate a leaf certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateWithNonceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateWithNonceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + def verify( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + certificate_verification_body, # type: "_models.CertificateVerificationDescription" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :param certificate_verification_body: The name of the certificate. + :type certificate_verification_body: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateVerificationDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py new file mode 100644 index 000000000000..ba2885a44b52 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IotHubOperations(object): + """IotHubOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _manual_failover_initial( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + failover_input, # type: "_models.FailoverInput" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._manual_failover_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(failover_input, 'FailoverInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + 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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _manual_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore + + def begin_manual_failover( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + failover_input, # type: "_models.FailoverInput" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Manually initiate a failover for the IoT Hub to its secondary region. + + Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + https://aka.ms/manualfailover. + + :param iot_hub_name: Name of the IoT hub to failover. + :type iot_hub_name: str + :param resource_group_name: Name of the resource group containing the IoT hub resource. + :type resource_group_name: str + :param failover_input: Region to failover to. Must be the Azure paired region. Get the value + from the secondary location in the locations property. To learn more, see + https://aka.ms/manualfailover/region. + :type failover_input: ~azure.mgmt.iothub.v2021_03_03_preview.models.FailoverInput + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._manual_failover_initial( + iot_hub_name=iot_hub_name, + resource_group_name=resource_group_name, + failover_input=failover_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_manual_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py new file mode 100644 index 000000000000..1ed38763255a --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py @@ -0,0 +1,1885 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IotHubResourceOperations(object): + """IotHubResourceOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + """Get the non-security related metadata of an IoT hub. + + Get the non-security related metadata of an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_description, # type: "_models.IotHubDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_description, 'IotHubDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_description, # type: "_models.IotHubDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IotHubDescription"] + """Create or update the metadata of an IoT hub. + + Create or update the metadata of an Iot hub. The usual pattern to modify a property is to + retrieve the IoT hub metadata and security metadata, and then combine them with the modified + values in a new body to update the IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param iot_hub_description: The IoT hub metadata and security metadata. + :type iot_hub_description: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription + :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required + to update an existing IoT Hub. + :type if_match: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_description=iot_hub_description, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IotHubDescription"] + """Update an existing IoT Hubs tags. + + Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param resource_name: Name of iot hub to update. + :type resource_name: str + :param iot_hub_tags: Updated tag information to set into the iot hub instance. + :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_03_preview.models.TagsResource + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_tags=iot_hub_tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + """Delete an IoT hub. + + Delete an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + 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_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubDescriptionListResult"] + """Get all the IoT hubs in a subscription. + + Get all the IoT hubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubDescriptionListResult"] + """Get all the IoT hubs in a resource group. + + Get all the IoT hubs in a resource group. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + def get_stats( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RegistryStatistics" + """Get the statistics from an IoT hub. + + Get the statistics from an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryStatistics, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.RegistryStatistics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_stats.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryStatistics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + + def get_valid_skus( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubSkuDescriptionListResult"] + """Get the list of valid SKUs for an IoT hub. + + Get the list of valid SKUs for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubSkuDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_valid_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubSkuDescriptionListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + + def list_event_hub_consumer_groups( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EventHubConsumerGroupsListResult"] + """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + + Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an + IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint. + :type event_hub_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_event_hub_consumer_groups.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubConsumerGroupsListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_event_hub_consumer_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'} # type: ignore + + def get_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EventHubConsumerGroupInfo" + """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to retrieve. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def create_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + consumer_group_body, # type: "_models.EventHubConsumerGroupBodyDescription" + **kwargs # type: Any + ): + # type: (...) -> "_models.EventHubConsumerGroupInfo" + """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to add. + :type name: str + :param consumer_group_body: The consumer group to add. + :type consumer_group_body: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupBodyDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def delete_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to delete. + :type name: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def list_jobs( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.JobResponseListResult"] + """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get a list of all the jobs in an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResponseListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('JobResponseListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + + def get_job( + self, + resource_group_name, # type: str + resource_name, # type: str + job_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get the details of a job from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param job_id: The job identifier. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_job.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + + def get_quota_metrics( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubQuotaMetricInfoListResult"] + """Get the quota metrics for an IoT hub. + + Get the quota metrics for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubQuotaMetricInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_quota_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubQuotaMetricInfoListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + + def get_endpoint_health( + self, + resource_group_name, # type: str + iot_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointHealthDataListResult"] + """Get the health for routing endpoints. + + Get the health for routing endpoints. + + :param resource_group_name: + :type resource_group_name: str + :param iot_hub_name: + :type iot_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.EndpointHealthDataListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_endpoint_health.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EndpointHealthDataListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_endpoint_health.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth'} # type: ignore + + def check_name_availability( + self, + operation_inputs, # type: "_models.OperationInputs" + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubNameAvailabilityInfo" + """Check if an IoT hub name is available. + + Check if an IoT hub name is available. + + :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of + the IoT hub to check. + :type operation_inputs: ~azure.mgmt.iothub.v2021_03_03_preview.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubNameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.IotHubNameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(operation_inputs, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + + def test_all_routes( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + input, # type: "_models.TestAllRoutesInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestAllRoutesResult" + """Test all routes. + + Test all routes configured in this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Input for testing all routes. + :type input: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestAllRoutesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestAllRoutesResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestAllRoutesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_all_routes.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestAllRoutesInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_all_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'} # type: ignore + + def test_route( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + input, # type: "_models.TestRouteInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestRouteResult" + """Test the new route. + + Test the new route for this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Route that needs to be tested. + :type input: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestRouteResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.TestRouteResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_route.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestRouteInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestRouteResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessSignatureAuthorizationRuleListResult"] + """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get the security metadata for an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + + def get_keys_for_key_name( + self, + resource_group_name, # type: str + resource_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessSignatureAuthorizationRule" + """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get a shared access policy by name from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param key_name: The name of the shared access policy. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.SharedAccessSignatureAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_keys_for_key_name.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + + def export_devices( + self, + resource_group_name, # type: str + resource_name, # type: str + export_devices_parameters, # type: "_models.ExportDevicesRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Exports all the device identities in the IoT hub identity registry to an Azure Storage blob + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param export_devices_parameters: The parameters that specify the export devices operation. + :type export_devices_parameters: ~azure.mgmt.iothub.v2021_03_03_preview.models.ExportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.export_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + + def import_devices( + self, + resource_group_name, # type: str + resource_name, # type: str + import_devices_parameters, # type: "_models.ImportDevicesRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Import, update, or delete device identities in the IoT hub identity registry from a blob. For + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param import_devices_parameters: The parameters that specify the import devices operation. + :type import_devices_parameters: ~azure.mgmt.iothub.v2021_03_03_preview.models.ImportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py new file mode 100644 index 000000000000..81a564b3d1ef --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available IoT Hub REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_03_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..37e894ac4915 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,446 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.PrivateEndpointConnection"] + """List private endpoint connections. + + List private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of PrivateEndpointConnection, or the result of cls(response) + :rtype: list[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[PrivateEndpointConnection]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Get private endpoint connection. + + Get private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Update private endpoint connection. + + Update the status of a private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection with updated properties. + :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Delete private endpoint connection. + + Delete private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..c9505ea2c3fe --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResources" + """List private link resources. + + List private link resources for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResources, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.PrivateLinkResources + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResources', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GroupIdInformation" + """Get the specified private link resource. + + Get the specified private link resource for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param group_id: The name of the private link resource. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupIdInformation, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.GroupIdInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GroupIdInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py new file mode 100644 index 000000000000..dfaa4e5fb346 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_resource_provider_common_operations.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourceProviderCommonOperations(object): + """ResourceProviderCommonOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_03_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_subscription_quota( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.UserSubscriptionQuotaListResult" + """Get the number of iot hubs in the subscription. + + Get the number of free and paid iot hubs in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSubscriptionQuotaListResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_03_preview.models.UserSubscriptionQuotaListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_subscription_quota.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_quota.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py new file mode 100644 index 000000000000..8883d8041fab --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._iot_hub_client import IotHubClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['IotHubClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py new file mode 100644 index 000000000000..dfcdb45a5fd2 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class IotHubClientConfiguration(Configuration): + """Configuration for IotHubClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotHubClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-03-31" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py new file mode 100644 index 000000000000..f238b0202dea --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_iot_hub_client.py @@ -0,0 +1,119 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import IotHubClientConfiguration +from .operations import Operations +from .operations import IotHubResourceOperations +from .operations import ResourceProviderCommonOperations +from .operations import CertificatesOperations +from .operations import IotHubOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from . import models + + +class IotHubClient(object): + """Use this API to manage the IoT hubs in your Azure subscription. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothub.v2021_03_31.operations.Operations + :ivar iot_hub_resource: IotHubResourceOperations operations + :vartype iot_hub_resource: azure.mgmt.iothub.v2021_03_31.operations.IotHubResourceOperations + :ivar resource_provider_common: ResourceProviderCommonOperations operations + :vartype resource_provider_common: azure.mgmt.iothub.v2021_03_31.operations.ResourceProviderCommonOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.iothub.v2021_03_31.operations.CertificatesOperations + :ivar iot_hub: IotHubOperations operations + :vartype iot_hub: azure.mgmt.iothub.v2021_03_31.operations.IotHubOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.iothub.v2021_03_31.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.iothub.v2021_03_31.operations.PrivateEndpointConnectionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, 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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub_resource = IotHubResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_provider_common = ResourceProviderCommonOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub = IotHubOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> IotHubClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json new file mode 100644 index 000000000000..8caa4bfcc7a5 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_metadata.json @@ -0,0 +1,109 @@ +{ + "chosen_version": "2021-03-31", + "total_api_version_list": ["2021-03-31"], + "client": { + "name": "IotHubClient", + "filename": "_iot_hub_client", + "description": "Use this API to manage the IoT hubs in your Azure subscription.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "iot_hub_resource": "IotHubResourceOperations", + "resource_provider_common": "ResourceProviderCommonOperations", + "certificates": "CertificatesOperations", + "iot_hub": "IotHubOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations" + } +} \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py new file mode 100644 index 000000000000..ba617b3fa777 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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.8.2" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py new file mode 100644 index 000000000000..a84cf700a930 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._iot_hub_client import IotHubClient +__all__ = ['IotHubClient'] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py new file mode 100644 index 000000000000..8e0435535d03 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class IotHubClientConfiguration(Configuration): + """Configuration for IotHubClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotHubClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-03-31" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py new file mode 100644 index 000000000000..d852bb7dbc37 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/_iot_hub_client.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import IotHubClientConfiguration +from .operations import Operations +from .operations import IotHubResourceOperations +from .operations import ResourceProviderCommonOperations +from .operations import CertificatesOperations +from .operations import IotHubOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from .. import models + + +class IotHubClient(object): + """Use this API to manage the IoT hubs in your Azure subscription. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothub.v2021_03_31.aio.operations.Operations + :ivar iot_hub_resource: IotHubResourceOperations operations + :vartype iot_hub_resource: azure.mgmt.iothub.v2021_03_31.aio.operations.IotHubResourceOperations + :ivar resource_provider_common: ResourceProviderCommonOperations operations + :vartype resource_provider_common: azure.mgmt.iothub.v2021_03_31.aio.operations.ResourceProviderCommonOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.iothub.v2021_03_31.aio.operations.CertificatesOperations + :ivar iot_hub: IotHubOperations operations + :vartype iot_hub: azure.mgmt.iothub.v2021_03_31.aio.operations.IotHubOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.iothub.v2021_03_31.aio.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.iothub.v2021_03_31.aio.operations.PrivateEndpointConnectionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, 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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub_resource = IotHubResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_provider_common = ResourceProviderCommonOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub = IotHubOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "IotHubClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py new file mode 100644 index 000000000000..3930a2f261c8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._operations import Operations +from ._iot_hub_resource_operations import IotHubResourceOperations +from ._resource_provider_common_operations import ResourceProviderCommonOperations +from ._certificates_operations import CertificatesOperations +from ._iot_hub_operations import IotHubOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations + +__all__ = [ + 'Operations', + 'IotHubResourceOperations', + 'ResourceProviderCommonOperations', + 'CertificatesOperations', + 'IotHubOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py new file mode 100644 index 000000000000..2ab30b20626f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py @@ -0,0 +1,464 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_by_iot_hub( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.CertificateListDescription": + """Get the certificate list. + + Returns the list of certificates. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.list_by_iot_hub.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_iot_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + **kwargs + ) -> "_models.CertificateDescription": + """Get the certificate. + + Returns the certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + certificate_description: "_models.CertificateDescription", + if_match: Optional[str] = None, + **kwargs + ) -> "_models.CertificateDescription": + """Upload the certificate to the IoT hub. + + Adds new or replaces existing certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription + :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. + Required to update an existing certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_description, 'CertificateDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + **kwargs + ) -> None: + """Delete an X509 certificate. + + Deletes an existing X509 certificate or does nothing if it does not exist. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def generate_verification_code( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + **kwargs + ) -> "_models.CertificateWithNonceDescription": + """Generate verification code for proof of possession flow. + + Generates verification code for proof of possession flow. The verification code will be used to + generate a leaf certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateWithNonceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateWithNonceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + async def verify( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + certificate_verification_body: "_models.CertificateVerificationDescription", + **kwargs + ) -> "_models.CertificateDescription": + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :param certificate_verification_body: The name of the certificate. + :type certificate_verification_body: ~azure.mgmt.iothub.v2021_03_31.models.CertificateVerificationDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py new file mode 100644 index 000000000000..ae761208f89d --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IotHubOperations: + """IotHubOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _manual_failover_initial( + self, + iot_hub_name: str, + resource_group_name: str, + failover_input: "_models.FailoverInput", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._manual_failover_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(failover_input, 'FailoverInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + 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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _manual_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore + + async def begin_manual_failover( + self, + iot_hub_name: str, + resource_group_name: str, + failover_input: "_models.FailoverInput", + **kwargs + ) -> AsyncLROPoller[None]: + """Manually initiate a failover for the IoT Hub to its secondary region. + + Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + https://aka.ms/manualfailover. + + :param iot_hub_name: Name of the IoT hub to failover. + :type iot_hub_name: str + :param resource_group_name: Name of the resource group containing the IoT hub resource. + :type resource_group_name: str + :param failover_input: Region to failover to. Must be the Azure paired region. Get the value + from the secondary location in the locations property. To learn more, see + https://aka.ms/manualfailover/region. + :type failover_input: ~azure.mgmt.iothub.v2021_03_31.models.FailoverInput + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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 = await self._manual_failover_initial( + iot_hub_name=iot_hub_name, + resource_group_name=resource_group_name, + failover_input=failover_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_manual_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py new file mode 100644 index 000000000000..ea79ff1a8b9f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py @@ -0,0 +1,1857 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IotHubResourceOperations: + """IotHubResourceOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.IotHubDescription": + """Get the non-security related metadata of an IoT hub. + + Get the non-security related metadata of an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + iot_hub_description: "_models.IotHubDescription", + if_match: Optional[str] = None, + **kwargs + ) -> "_models.IotHubDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_description, 'IotHubDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + iot_hub_description: "_models.IotHubDescription", + if_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["_models.IotHubDescription"]: + """Create or update the metadata of an IoT hub. + + Create or update the metadata of an Iot hub. The usual pattern to modify a property is to + retrieve the IoT hub metadata and security metadata, and then combine them with the modified + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param iot_hub_description: The IoT hub metadata and security metadata. + :type iot_hub_description: ~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription + :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required + to update an existing IoT Hub. + :type if_match: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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 = await self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_description=iot_hub_description, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + iot_hub_tags: "_models.TagsResource", + **kwargs + ) -> "_models.IotHubDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + iot_hub_tags: "_models.TagsResource", + **kwargs + ) -> AsyncLROPoller["_models.IotHubDescription"]: + """Update an existing IoT Hubs tags. + + Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param resource_name: Name of iot hub to update. + :type resource_name: str + :param iot_hub_tags: Updated tag information to set into the iot hub instance. + :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_31.models.TagsResource + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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 = await self._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_tags=iot_hub_tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + """Delete an IoT hub. + + Delete an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + 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 = await self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: + """Get all the IoT hubs in a subscription. + + Get all the IoT hubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: + """Get all the IoT hubs in a resource group. + + Get all the IoT hubs in a resource group. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + async def get_stats( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.RegistryStatistics": + """Get the statistics from an IoT hub. + + Get the statistics from an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryStatistics, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.RegistryStatistics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_stats.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryStatistics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + + def get_valid_skus( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: + """Get the list of valid SKUs for an IoT hub. + + Get the list of valid SKUs for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_valid_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubSkuDescriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + + def list_event_hub_consumer_groups( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + **kwargs + ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: + """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + + Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an + IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint. + :type event_hub_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_event_hub_consumer_groups.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubConsumerGroupsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_event_hub_consumer_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'} # type: ignore + + async def get_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + **kwargs + ) -> "_models.EventHubConsumerGroupInfo": + """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to retrieve. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + async def create_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + consumer_group_body: "_models.EventHubConsumerGroupBodyDescription", + **kwargs + ) -> "_models.EventHubConsumerGroupInfo": + """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to add. + :type name: str + :param consumer_group_body: The consumer group to add. + :type consumer_group_body: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupBodyDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + async def delete_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + **kwargs + ) -> None: + """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to delete. + :type name: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.delete_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def list_jobs( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.JobResponseListResult"]: + """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get a list of all the jobs in an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResponseListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_31.models.JobResponseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('JobResponseListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + + async def get_job( + self, + resource_group_name: str, + resource_name: str, + job_id: str, + **kwargs + ) -> "_models.JobResponse": + """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get the details of a job from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param job_id: The job identifier. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_job.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + + def get_quota_metrics( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: + """Get the quota metrics for an IoT hub. + + Get the quota metrics for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_31.models.IotHubQuotaMetricInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_quota_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubQuotaMetricInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + + def get_endpoint_health( + self, + resource_group_name: str, + iot_hub_name: str, + **kwargs + ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: + """Get the health for routing endpoints. + + Get the health for routing endpoints. + + :param resource_group_name: + :type resource_group_name: str + :param iot_hub_name: + :type iot_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthDataListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_endpoint_health.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EndpointHealthDataListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_endpoint_health.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth'} # type: ignore + + async def check_name_availability( + self, + operation_inputs: "_models.OperationInputs", + **kwargs + ) -> "_models.IotHubNameAvailabilityInfo": + """Check if an IoT hub name is available. + + Check if an IoT hub name is available. + + :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of + the IoT hub to check. + :type operation_inputs: ~azure.mgmt.iothub.v2021_03_31.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubNameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.IotHubNameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(operation_inputs, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + + async def test_all_routes( + self, + iot_hub_name: str, + resource_group_name: str, + input: "_models.TestAllRoutesInput", + **kwargs + ) -> "_models.TestAllRoutesResult": + """Test all routes. + + Test all routes configured in this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Input for testing all routes. + :type input: ~azure.mgmt.iothub.v2021_03_31.models.TestAllRoutesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestAllRoutesResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.TestAllRoutesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_all_routes.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestAllRoutesInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_all_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'} # type: ignore + + async def test_route( + self, + iot_hub_name: str, + resource_group_name: str, + input: "_models.TestRouteInput", + **kwargs + ) -> "_models.TestRouteResult": + """Test the new route. + + Test the new route for this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Route that needs to be tested. + :type input: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestRouteResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_route.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestRouteInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestRouteResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'} # type: ignore + + def list_keys( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: + """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get the security metadata for an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + + async def get_keys_for_key_name( + self, + resource_group_name: str, + resource_name: str, + key_name: str, + **kwargs + ) -> "_models.SharedAccessSignatureAuthorizationRule": + """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get a shared access policy by name from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param key_name: The name of the shared access policy. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_keys_for_key_name.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + + async def export_devices( + self, + resource_group_name: str, + resource_name: str, + export_devices_parameters: "_models.ExportDevicesRequest", + **kwargs + ) -> "_models.JobResponse": + """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Exports all the device identities in the IoT hub identity registry to an Azure Storage blob + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param export_devices_parameters: The parameters that specify the export devices operation. + :type export_devices_parameters: ~azure.mgmt.iothub.v2021_03_31.models.ExportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.export_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + + async def import_devices( + self, + resource_group_name: str, + resource_name: str, + import_devices_parameters: "_models.ImportDevicesRequest", + **kwargs + ) -> "_models.JobResponse": + """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Import, update, or delete device identities in the IoT hub identity registry from a blob. For + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param import_devices_parameters: The parameters that specify the import devices operation. + :type import_devices_parameters: ~azure.mgmt.iothub.v2021_03_31.models.ImportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py new file mode 100644 index 000000000000..2535b954f078 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available IoT Hub REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_03_31.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..132ab4e3daf2 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,436 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> List["_models.PrivateEndpointConnection"]: + """List private endpoint connections. + + List private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of PrivateEndpointConnection, or the result of cls(response) + :rtype: list[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[PrivateEndpointConnection]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "_models.PrivateEndpointConnection": + """Get private endpoint connection. + + Get private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs + ) -> "_models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Update private endpoint connection. + + Update the status of a private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection with updated properties. + :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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 = await self._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Delete private endpoint connection. + + Delete private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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 = await self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..9ae1ec6eab24 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs + ) -> "_models.PrivateLinkResources": + """List private link resources. + + List private link resources for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResources, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkResources + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResources', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + group_id: str, + **kwargs + ) -> "_models.GroupIdInformation": + """Get the specified private link resource. + + Get the specified private link resource for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param group_id: The name of the private link resource. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupIdInformation, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GroupIdInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py new file mode 100644 index 000000000000..529f55e9fcf8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceProviderCommonOperations: + """ResourceProviderCommonOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_subscription_quota( + self, + **kwargs + ) -> "_models.UserSubscriptionQuotaListResult": + """Get the number of iot hubs in the subscription. + + Get the number of free and paid iot hubs in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSubscriptionQuotaListResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.UserSubscriptionQuotaListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_subscription_quota.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_quota.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py new file mode 100644 index 000000000000..1491e763a154 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/__init__.py @@ -0,0 +1,301 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ArmIdentity + from ._models_py3 import ArmUserIdentity + from ._models_py3 import CertificateBodyDescription + from ._models_py3 import CertificateDescription + from ._models_py3 import CertificateListDescription + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificatePropertiesWithNonce + from ._models_py3 import CertificateVerificationDescription + from ._models_py3 import CertificateWithNonceDescription + from ._models_py3 import CloudToDeviceProperties + from ._models_py3 import EndpointHealthData + from ._models_py3 import EndpointHealthDataListResult + from ._models_py3 import EnrichmentProperties + from ._models_py3 import ErrorDetails + from ._models_py3 import EventHubConsumerGroupBodyDescription + from ._models_py3 import EventHubConsumerGroupInfo + from ._models_py3 import EventHubConsumerGroupName + from ._models_py3 import EventHubConsumerGroupsListResult + from ._models_py3 import EventHubProperties + from ._models_py3 import ExportDevicesRequest + from ._models_py3 import FailoverInput + from ._models_py3 import FallbackRouteProperties + from ._models_py3 import FeedbackProperties + from ._models_py3 import GroupIdInformation + from ._models_py3 import GroupIdInformationProperties + from ._models_py3 import ImportDevicesRequest + from ._models_py3 import IotHubCapacity + from ._models_py3 import IotHubDescription + from ._models_py3 import IotHubDescriptionListResult + from ._models_py3 import IotHubLocationDescription + from ._models_py3 import IotHubNameAvailabilityInfo + from ._models_py3 import IotHubProperties + from ._models_py3 import IotHubQuotaMetricInfo + from ._models_py3 import IotHubQuotaMetricInfoListResult + from ._models_py3 import IotHubSkuDescription + from ._models_py3 import IotHubSkuDescriptionListResult + from ._models_py3 import IotHubSkuInfo + from ._models_py3 import IpFilterRule + from ._models_py3 import JobResponse + from ._models_py3 import JobResponseListResult + from ._models_py3 import ManagedIdentity + from ._models_py3 import MatchedRoute + from ._models_py3 import MessagingEndpointProperties + from ._models_py3 import Name + from ._models_py3 import NetworkRuleSetIpRule + from ._models_py3 import NetworkRuleSetProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationInputs + from ._models_py3 import OperationListResult + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionProperties + from ._models_py3 import PrivateLinkResources + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import RegistryStatistics + from ._models_py3 import Resource + from ._models_py3 import RouteCompilationError + from ._models_py3 import RouteErrorPosition + from ._models_py3 import RouteErrorRange + from ._models_py3 import RouteProperties + from ._models_py3 import RoutingEndpoints + from ._models_py3 import RoutingEventHubProperties + from ._models_py3 import RoutingMessage + from ._models_py3 import RoutingProperties + from ._models_py3 import RoutingServiceBusQueueEndpointProperties + from ._models_py3 import RoutingServiceBusTopicEndpointProperties + from ._models_py3 import RoutingStorageContainerProperties + from ._models_py3 import RoutingTwin + from ._models_py3 import RoutingTwinProperties + from ._models_py3 import SharedAccessSignatureAuthorizationRule + from ._models_py3 import SharedAccessSignatureAuthorizationRuleListResult + from ._models_py3 import StorageEndpointProperties + from ._models_py3 import TagsResource + from ._models_py3 import TestAllRoutesInput + from ._models_py3 import TestAllRoutesResult + from ._models_py3 import TestRouteInput + from ._models_py3 import TestRouteResult + from ._models_py3 import TestRouteResultDetails + from ._models_py3 import UserSubscriptionQuota + from ._models_py3 import UserSubscriptionQuotaListResult +except (SyntaxError, ImportError): + from ._models import ArmIdentity # type: ignore + from ._models import ArmUserIdentity # type: ignore + from ._models import CertificateBodyDescription # type: ignore + from ._models import CertificateDescription # type: ignore + from ._models import CertificateListDescription # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificatePropertiesWithNonce # type: ignore + from ._models import CertificateVerificationDescription # type: ignore + from ._models import CertificateWithNonceDescription # type: ignore + from ._models import CloudToDeviceProperties # type: ignore + from ._models import EndpointHealthData # type: ignore + from ._models import EndpointHealthDataListResult # type: ignore + from ._models import EnrichmentProperties # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import EventHubConsumerGroupBodyDescription # type: ignore + from ._models import EventHubConsumerGroupInfo # type: ignore + from ._models import EventHubConsumerGroupName # type: ignore + from ._models import EventHubConsumerGroupsListResult # type: ignore + from ._models import EventHubProperties # type: ignore + from ._models import ExportDevicesRequest # type: ignore + from ._models import FailoverInput # type: ignore + from ._models import FallbackRouteProperties # type: ignore + from ._models import FeedbackProperties # type: ignore + from ._models import GroupIdInformation # type: ignore + from ._models import GroupIdInformationProperties # type: ignore + from ._models import ImportDevicesRequest # type: ignore + from ._models import IotHubCapacity # type: ignore + from ._models import IotHubDescription # type: ignore + from ._models import IotHubDescriptionListResult # type: ignore + from ._models import IotHubLocationDescription # type: ignore + from ._models import IotHubNameAvailabilityInfo # type: ignore + from ._models import IotHubProperties # type: ignore + from ._models import IotHubQuotaMetricInfo # type: ignore + from ._models import IotHubQuotaMetricInfoListResult # type: ignore + from ._models import IotHubSkuDescription # type: ignore + from ._models import IotHubSkuDescriptionListResult # type: ignore + from ._models import IotHubSkuInfo # type: ignore + from ._models import IpFilterRule # type: ignore + from ._models import JobResponse # type: ignore + from ._models import JobResponseListResult # type: ignore + from ._models import ManagedIdentity # type: ignore + from ._models import MatchedRoute # type: ignore + from ._models import MessagingEndpointProperties # type: ignore + from ._models import Name # type: ignore + from ._models import NetworkRuleSetIpRule # type: ignore + from ._models import NetworkRuleSetProperties # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationInputs # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionProperties # type: ignore + from ._models import PrivateLinkResources # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import RegistryStatistics # type: ignore + from ._models import Resource # type: ignore + from ._models import RouteCompilationError # type: ignore + from ._models import RouteErrorPosition # type: ignore + from ._models import RouteErrorRange # type: ignore + from ._models import RouteProperties # type: ignore + from ._models import RoutingEndpoints # type: ignore + from ._models import RoutingEventHubProperties # type: ignore + from ._models import RoutingMessage # type: ignore + from ._models import RoutingProperties # type: ignore + from ._models import RoutingServiceBusQueueEndpointProperties # type: ignore + from ._models import RoutingServiceBusTopicEndpointProperties # type: ignore + from ._models import RoutingStorageContainerProperties # type: ignore + from ._models import RoutingTwin # type: ignore + from ._models import RoutingTwinProperties # type: ignore + from ._models import SharedAccessSignatureAuthorizationRule # type: ignore + from ._models import SharedAccessSignatureAuthorizationRuleListResult # type: ignore + from ._models import StorageEndpointProperties # type: ignore + from ._models import TagsResource # type: ignore + from ._models import TestAllRoutesInput # type: ignore + from ._models import TestAllRoutesResult # type: ignore + from ._models import TestRouteInput # type: ignore + from ._models import TestRouteResult # type: ignore + from ._models import TestRouteResultDetails # type: ignore + from ._models import UserSubscriptionQuota # type: ignore + from ._models import UserSubscriptionQuotaListResult # type: ignore + +from ._iot_hub_client_enums import ( + AccessRights, + AuthenticationType, + Capabilities, + DefaultAction, + EndpointHealthStatus, + IotHubNameUnavailabilityReason, + IotHubReplicaRoleType, + IotHubScaleType, + IotHubSku, + IotHubSkuTier, + IpFilterActionType, + JobStatus, + JobType, + NetworkRuleIPAction, + PrivateLinkServiceConnectionStatus, + PublicNetworkAccess, + ResourceIdentityType, + RouteErrorSeverity, + RoutingSource, + RoutingStorageContainerPropertiesEncoding, + TestResultStatus, +) + +__all__ = [ + 'ArmIdentity', + 'ArmUserIdentity', + 'CertificateBodyDescription', + 'CertificateDescription', + 'CertificateListDescription', + 'CertificateProperties', + 'CertificatePropertiesWithNonce', + 'CertificateVerificationDescription', + 'CertificateWithNonceDescription', + 'CloudToDeviceProperties', + 'EndpointHealthData', + 'EndpointHealthDataListResult', + 'EnrichmentProperties', + 'ErrorDetails', + 'EventHubConsumerGroupBodyDescription', + 'EventHubConsumerGroupInfo', + 'EventHubConsumerGroupName', + 'EventHubConsumerGroupsListResult', + 'EventHubProperties', + 'ExportDevicesRequest', + 'FailoverInput', + 'FallbackRouteProperties', + 'FeedbackProperties', + 'GroupIdInformation', + 'GroupIdInformationProperties', + 'ImportDevicesRequest', + 'IotHubCapacity', + 'IotHubDescription', + 'IotHubDescriptionListResult', + 'IotHubLocationDescription', + 'IotHubNameAvailabilityInfo', + 'IotHubProperties', + 'IotHubQuotaMetricInfo', + 'IotHubQuotaMetricInfoListResult', + 'IotHubSkuDescription', + 'IotHubSkuDescriptionListResult', + 'IotHubSkuInfo', + 'IpFilterRule', + 'JobResponse', + 'JobResponseListResult', + 'ManagedIdentity', + 'MatchedRoute', + 'MessagingEndpointProperties', + 'Name', + 'NetworkRuleSetIpRule', + 'NetworkRuleSetProperties', + 'Operation', + 'OperationDisplay', + 'OperationInputs', + 'OperationListResult', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionProperties', + 'PrivateLinkResources', + 'PrivateLinkServiceConnectionState', + 'RegistryStatistics', + 'Resource', + 'RouteCompilationError', + 'RouteErrorPosition', + 'RouteErrorRange', + 'RouteProperties', + 'RoutingEndpoints', + 'RoutingEventHubProperties', + 'RoutingMessage', + 'RoutingProperties', + 'RoutingServiceBusQueueEndpointProperties', + 'RoutingServiceBusTopicEndpointProperties', + 'RoutingStorageContainerProperties', + 'RoutingTwin', + 'RoutingTwinProperties', + 'SharedAccessSignatureAuthorizationRule', + 'SharedAccessSignatureAuthorizationRuleListResult', + 'StorageEndpointProperties', + 'TagsResource', + 'TestAllRoutesInput', + 'TestAllRoutesResult', + 'TestRouteInput', + 'TestRouteResult', + 'TestRouteResultDetails', + 'UserSubscriptionQuota', + 'UserSubscriptionQuotaListResult', + 'AccessRights', + 'AuthenticationType', + 'Capabilities', + 'DefaultAction', + 'EndpointHealthStatus', + 'IotHubNameUnavailabilityReason', + 'IotHubReplicaRoleType', + 'IotHubScaleType', + 'IotHubSku', + 'IotHubSkuTier', + 'IpFilterActionType', + 'JobStatus', + 'JobType', + 'NetworkRuleIPAction', + 'PrivateLinkServiceConnectionStatus', + 'PublicNetworkAccess', + 'ResourceIdentityType', + 'RouteErrorSeverity', + 'RoutingSource', + 'RoutingStorageContainerPropertiesEncoding', + 'TestResultStatus', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_iot_hub_client_enums.py new file mode 100644 index 000000000000..77789fe60025 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_iot_hub_client_enums.py @@ -0,0 +1,231 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The permissions assigned to the shared access policy. + """ + + REGISTRY_READ = "RegistryRead" + REGISTRY_WRITE = "RegistryWrite" + SERVICE_CONNECT = "ServiceConnect" + DEVICE_CONNECT = "DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE = "RegistryRead, RegistryWrite" + REGISTRY_READ_SERVICE_CONNECT = "RegistryRead, ServiceConnect" + REGISTRY_READ_DEVICE_CONNECT = "RegistryRead, DeviceConnect" + REGISTRY_WRITE_SERVICE_CONNECT = "RegistryWrite, ServiceConnect" + REGISTRY_WRITE_DEVICE_CONNECT = "RegistryWrite, DeviceConnect" + SERVICE_CONNECT_DEVICE_CONNECT = "ServiceConnect, DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT = "RegistryRead, RegistryWrite, ServiceConnect" + REGISTRY_READ_REGISTRY_WRITE_DEVICE_CONNECT = "RegistryRead, RegistryWrite, DeviceConnect" + REGISTRY_READ_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryRead, ServiceConnect, DeviceConnect" + REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryWrite, ServiceConnect, DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" + +class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies authentication type being used for connecting to the storage account. + """ + + KEY_BASED = "keyBased" + IDENTITY_BASED = "identityBased" + +class Capabilities(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The capabilities and features enabled for the IoT hub. + """ + + NONE = "None" + DEVICE_MANAGEMENT = "DeviceManagement" + +class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Default Action for Network Rule Set + """ + + DENY = "Deny" + ALLOW = "Allow" + +class EndpointHealthStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Health statuses have following meanings. The 'healthy' status shows that the endpoint is + accepting messages as expected. The 'unhealthy' status shows that the endpoint is not accepting + messages as expected and IoT Hub is retrying to send data to this endpoint. The status of an + unhealthy endpoint will be updated to healthy when IoT Hub has established an eventually + consistent state of health. The 'dead' status shows that the endpoint is not accepting + messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub metrics to + identify errors and monitor issues with endpoints. The 'unknown' status shows that the IoT Hub + has not established a connection with the endpoint. No messages have been delivered to or + rejected from this endpoint + """ + + UNKNOWN = "unknown" + HEALTHY = "healthy" + DEGRADED = "degraded" + UNHEALTHY = "unhealthy" + DEAD = "dead" + +class IotHubNameUnavailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The reason for unavailability. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class IotHubReplicaRoleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The role of the region, can be either primary or secondary. The primary region is where the IoT + hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired + region and also the region where the IoT hub can failover to. + """ + + PRIMARY = "primary" + SECONDARY = "secondary" + +class IotHubScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the scaling enabled. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + NONE = "None" + +class IotHubSku(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the SKU. + """ + + F1 = "F1" + S1 = "S1" + S2 = "S2" + S3 = "S3" + B1 = "B1" + B2 = "B2" + B3 = "B3" + +class IotHubSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier for the IoT hub. + """ + + FREE = "Free" + STANDARD = "Standard" + BASIC = "Basic" + +class IpFilterActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The desired action for requests captured by this rule. + """ + + ACCEPT = "Accept" + REJECT = "Reject" + +class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the job. + """ + + UNKNOWN = "unknown" + ENQUEUED = "enqueued" + RUNNING = "running" + COMPLETED = "completed" + FAILED = "failed" + CANCELLED = "cancelled" + +class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the job. + """ + + UNKNOWN = "unknown" + EXPORT = "export" + IMPORT_ENUM = "import" + BACKUP = "backup" + READ_DEVICE_PROPERTIES = "readDeviceProperties" + WRITE_DEVICE_PROPERTIES = "writeDeviceProperties" + UPDATE_DEVICE_CONFIGURATION = "updateDeviceConfiguration" + REBOOT_DEVICE = "rebootDevice" + FACTORY_RESET_DEVICE = "factoryResetDevice" + FIRMWARE_UPDATE = "firmwareUpdate" + +class NetworkRuleIPAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """IP Filter Action + """ + + ALLOW = "Allow" + +class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of a private endpoint connection + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether requests from Public Network are allowed + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user assigned identities. The type 'None' will + remove any identities from the service. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class RouteErrorSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Severity of the route error + """ + + ERROR = "error" + WARNING = "warning" + +class RoutingSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The source that the routing rule is to be applied to, such as DeviceMessages. + """ + + INVALID = "Invalid" + DEVICE_MESSAGES = "DeviceMessages" + TWIN_CHANGE_EVENTS = "TwinChangeEvents" + DEVICE_LIFECYCLE_EVENTS = "DeviceLifecycleEvents" + DEVICE_JOB_LIFECYCLE_EVENTS = "DeviceJobLifecycleEvents" + DEVICE_CONNECTION_STATE_EVENTS = "DeviceConnectionStateEvents" + +class RoutingStorageContainerPropertiesEncoding(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Encoding that is used to serialize messages to blobs. Supported values are 'avro', + 'avrodeflate', and 'JSON'. Default value is 'avro'. + """ + + AVRO = "Avro" + AVRO_DEFLATE = "AvroDeflate" + JSON = "JSON" + +class TestResultStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Result of testing route + """ + + UNDEFINED = "undefined" + FALSE = "false" + TRUE = "true" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models.py new file mode 100644 index 000000000000..d91f42533c72 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models.py @@ -0,0 +1,2997 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ArmIdentity(msrest.serialization.Model): + """ArmIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the service. Possible values + include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.iothub.v2021_03_31.models.ResourceIdentityType + :param user_assigned_identities: Dictionary of :code:``. + :type user_assigned_identities: dict[str, + ~azure.mgmt.iothub.v2021_03_31.models.ArmUserIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ArmUserIdentity}'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ArmUserIdentity(msrest.serialization.Model): + """ArmUserIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: + :vartype principal_id: str + :ivar client_id: + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmUserIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + + +class CertificateDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateDescription, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :param certificate: The certificate content. + :type certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.certificate = kwargs.get('certificate', None) + + +class CertificatePropertiesWithNonce(msrest.serialization.Model): + """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :ivar verification_code: The certificate's verification code that will be used for proof of + possession. + :vartype verification_code: str + :ivar certificate: The certificate content. + :vartype certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'verification_code': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificatePropertiesWithNonce, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.verification_code = None + self.certificate = None + + +class CertificateVerificationDescription(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateVerificationDescription, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + + +class CertificateWithNonceDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate including the challenge nonce + issued for the Proof-Of-Possession flow. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.CertificatePropertiesWithNonce + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificatePropertiesWithNonce'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateWithNonceDescription, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CloudToDeviceProperties(msrest.serialization.Model): + """The IoT hub cloud-to-device messaging properties. + + :param max_delivery_count: The max delivery count for cloud-to-device messages in the device + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type default_ttl_as_iso8601: ~datetime.timedelta + :param feedback: The properties of the feedback queue for cloud-to-device messages. + :type feedback: ~azure.mgmt.iothub.v2021_03_31.models.FeedbackProperties + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + 'default_ttl_as_iso8601': {'key': 'defaultTtlAsIso8601', 'type': 'duration'}, + 'feedback': {'key': 'feedback', 'type': 'FeedbackProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudToDeviceProperties, self).__init__(**kwargs) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.default_ttl_as_iso8601 = kwargs.get('default_ttl_as_iso8601', None) + self.feedback = kwargs.get('feedback', None) + + +class EndpointHealthData(msrest.serialization.Model): + """The health data for an endpoint. + + :param endpoint_id: Id of the endpoint. + :type endpoint_id: str + :param health_status: Health statuses have following meanings. The 'healthy' status shows that + the endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint + is not accepting messages as expected and IoT Hub is retrying to send data to this endpoint. + The status of an unhealthy endpoint will be updated to healthy when IoT Hub has established an + eventually consistent state of health. The 'dead' status shows that the endpoint is not + accepting messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub + metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + the IoT Hub has not established a connection with the endpoint. No messages have been delivered + to or rejected from this endpoint. Possible values include: "unknown", "healthy", "degraded", + "unhealthy", "dead". + :type health_status: str or ~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthStatus + :param last_known_error: Last error obtained when a message failed to be delivered to iot hub. + :type last_known_error: str + :param last_known_error_time: Time at which the last known error occurred. + :type last_known_error_time: ~datetime.datetime + :param last_successful_send_attempt_time: Last time iot hub successfully sent a message to the + endpoint. + :type last_successful_send_attempt_time: ~datetime.datetime + :param last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. + :type last_send_attempt_time: ~datetime.datetime + """ + + _attribute_map = { + 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, + 'health_status': {'key': 'healthStatus', 'type': 'str'}, + 'last_known_error': {'key': 'lastKnownError', 'type': 'str'}, + 'last_known_error_time': {'key': 'lastKnownErrorTime', 'type': 'rfc-1123'}, + 'last_successful_send_attempt_time': {'key': 'lastSuccessfulSendAttemptTime', 'type': 'rfc-1123'}, + 'last_send_attempt_time': {'key': 'lastSendAttemptTime', 'type': 'rfc-1123'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointHealthData, self).__init__(**kwargs) + self.endpoint_id = kwargs.get('endpoint_id', None) + self.health_status = kwargs.get('health_status', None) + self.last_known_error = kwargs.get('last_known_error', None) + self.last_known_error_time = kwargs.get('last_known_error_time', None) + self.last_successful_send_attempt_time = kwargs.get('last_successful_send_attempt_time', None) + self.last_send_attempt_time = kwargs.get('last_send_attempt_time', None) + + +class EndpointHealthDataListResult(msrest.serialization.Model): + """The JSON-serialized array of EndpointHealthData objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: JSON-serialized array of Endpoint health data. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthData] + :ivar next_link: Link to more results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EndpointHealthData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointHealthDataListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class EnrichmentProperties(msrest.serialization.Model): + """The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key or name for the enrichment property. + :type key: str + :param value: Required. The value for the enrichment property. + :type value: str + :param endpoint_names: Required. The list of endpoints for which the enrichment is applied to + the message. + :type endpoint_names: list[str] + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'endpoint_names': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(EnrichmentProperties, self).__init__(**kwargs) + self.key = kwargs['key'] + self.value = kwargs['value'] + self.endpoint_names = kwargs['endpoint_names'] + + +class ErrorDetails(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class EventHubConsumerGroupBodyDescription(msrest.serialization.Model): + """The EventHub consumer group. + + All required parameters must be populated in order to send to Azure. + + :param properties: Required. The EventHub consumer group name. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupName + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'EventHubConsumerGroupName'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupBodyDescription, self).__init__(**kwargs) + self.properties = kwargs['properties'] + + +class EventHubConsumerGroupInfo(msrest.serialization.Model): + """The properties of the EventHubConsumerGroupInfo object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The tags. + :type properties: dict[str, object] + :ivar id: The Event Hub-compatible consumer group identifier. + :vartype id: str + :ivar name: The Event Hub-compatible consumer group name. + :vartype name: str + :ivar type: the resource type. + :vartype type: str + :ivar etag: The etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupInfo, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.type = None + self.etag = None + + +class EventHubConsumerGroupName(msrest.serialization.Model): + """The EventHub consumer group name. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. EventHub consumer group name. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupName, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class EventHubConsumerGroupsListResult(msrest.serialization.Model): + """The JSON-serialized array of Event Hub-compatible consumer group names with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of consumer groups objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventHubConsumerGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class EventHubProperties(msrest.serialization.Model): + """The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param retention_time_in_days: The retention time for device-to-cloud messages in days. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type retention_time_in_days: long + :param partition_count: The number of partitions for receiving device-to-cloud messages in the + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type partition_count: int + :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. + :vartype partition_ids: list[str] + :ivar path: The Event Hub-compatible name. + :vartype path: str + :ivar endpoint: The Event Hub-compatible endpoint. + :vartype endpoint: str + """ + + _validation = { + 'partition_ids': {'readonly': True}, + 'path': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'retention_time_in_days': {'key': 'retentionTimeInDays', 'type': 'long'}, + 'partition_count': {'key': 'partitionCount', 'type': 'int'}, + 'partition_ids': {'key': 'partitionIds', 'type': '[str]'}, + 'path': {'key': 'path', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubProperties, self).__init__(**kwargs) + self.retention_time_in_days = kwargs.get('retention_time_in_days', None) + self.partition_count = kwargs.get('partition_count', None) + self.partition_ids = None + self.path = None + self.endpoint = None + + +class ExportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an export of all devices in the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param export_blob_container_uri: Required. The export blob container URI. + :type export_blob_container_uri: str + :param exclude_keys: Required. The value indicating whether keys should be excluded during + export. + :type exclude_keys: bool + :param export_blob_name: The name of the blob that will be created in the provided output blob + container. This blob will contain the exported device registry information for the IoT Hub. + :type export_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for export devices. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param include_configurations: The value indicating whether configurations should be exported. + :type include_configurations: bool + :param configurations_blob_name: The name of the blob that will be created in the provided + output blob container. This blob will contain the exported configurations for the Iot Hub. + :type configurations_blob_name: str + """ + + _validation = { + 'export_blob_container_uri': {'required': True}, + 'exclude_keys': {'required': True}, + } + + _attribute_map = { + 'export_blob_container_uri': {'key': 'exportBlobContainerUri', 'type': 'str'}, + 'exclude_keys': {'key': 'excludeKeys', 'type': 'bool'}, + 'export_blob_name': {'key': 'exportBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'include_configurations': {'key': 'includeConfigurations', 'type': 'bool'}, + 'configurations_blob_name': {'key': 'configurationsBlobName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportDevicesRequest, self).__init__(**kwargs) + self.export_blob_container_uri = kwargs['export_blob_container_uri'] + self.exclude_keys = kwargs['exclude_keys'] + self.export_blob_name = kwargs.get('export_blob_name', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.include_configurations = kwargs.get('include_configurations', None) + self.configurations_blob_name = kwargs.get('configurations_blob_name', None) + + +class FailoverInput(msrest.serialization.Model): + """Use to provide failover region when requesting manual Failover for a hub. + + All required parameters must be populated in order to send to Azure. + + :param failover_region: Required. Region the hub will be failed over to. + :type failover_region: str + """ + + _validation = { + 'failover_region': {'required': True}, + } + + _attribute_map = { + 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FailoverInput, self).__init__(**kwargs) + self.failover_region = kwargs['failover_region'] + + +class FallbackRouteProperties(msrest.serialization.Model): + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the route. The name can only include alphanumeric characters, periods, + underscores, hyphens, has a maximum length of 64 characters, and must be unique. + :type name: str + :param source: Required. The source to which the routing rule is to be applied to. For example, + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource + :param condition: The condition which is evaluated in order to apply the fallback route. If the + condition is not provided it will evaluate to true by default. For grammar, See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which the messages that satisfy the + condition are routed to. Currently only 1 endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether the fallback route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(FallbackRouteProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.source = kwargs['source'] + self.condition = kwargs.get('condition', None) + self.endpoint_names = kwargs['endpoint_names'] + self.is_enabled = kwargs['is_enabled'] + + +class FeedbackProperties(msrest.serialization.Model): + """The properties of the feedback queue for cloud-to-device messages. + + :param lock_duration_as_iso8601: The lock duration for the feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(FeedbackProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = kwargs.get('lock_duration_as_iso8601', None) + self.ttl_as_iso8601 = kwargs.get('ttl_as_iso8601', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + + +class GroupIdInformation(msrest.serialization.Model): + """The group information for creating a private endpoint on an IotHub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties for a group information object. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'GroupIdInformationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupIdInformation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class GroupIdInformationProperties(msrest.serialization.Model): + """The properties for a group information object. + + :param group_id: The group id. + :type group_id: str + :param required_members: The required members for a specific group id. + :type required_members: list[str] + :param required_zone_names: The required DNS zones for a specific group id. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupIdInformationProperties, self).__init__(**kwargs) + self.group_id = kwargs.get('group_id', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class ImportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an import of all devices in the hub. + + All required parameters must be populated in order to send to Azure. + + :param input_blob_container_uri: Required. The input blob container URI. + :type input_blob_container_uri: str + :param output_blob_container_uri: Required. The output blob container URI. + :type output_blob_container_uri: str + :param input_blob_name: The blob name to be used when importing from the provided input blob + container. + :type input_blob_name: str + :param output_blob_name: The blob name to use for storing the status of the import job. + :type output_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for import devices. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param include_configurations: The value indicating whether configurations should be imported. + :type include_configurations: bool + :param configurations_blob_name: The blob name to be used when importing configurations from + the provided input blob container. + :type configurations_blob_name: str + """ + + _validation = { + 'input_blob_container_uri': {'required': True}, + 'output_blob_container_uri': {'required': True}, + } + + _attribute_map = { + 'input_blob_container_uri': {'key': 'inputBlobContainerUri', 'type': 'str'}, + 'output_blob_container_uri': {'key': 'outputBlobContainerUri', 'type': 'str'}, + 'input_blob_name': {'key': 'inputBlobName', 'type': 'str'}, + 'output_blob_name': {'key': 'outputBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'include_configurations': {'key': 'includeConfigurations', 'type': 'bool'}, + 'configurations_blob_name': {'key': 'configurationsBlobName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportDevicesRequest, self).__init__(**kwargs) + self.input_blob_container_uri = kwargs['input_blob_container_uri'] + self.output_blob_container_uri = kwargs['output_blob_container_uri'] + self.input_blob_name = kwargs.get('input_blob_name', None) + self.output_blob_name = kwargs.get('output_blob_name', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.include_configurations = kwargs.get('include_configurations', None) + self.configurations_blob_name = kwargs.get('configurations_blob_name', None) + + +class IotHubCapacity(msrest.serialization.Model): + """IoT Hub capacity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum number of units. + :vartype minimum: long + :ivar maximum: The maximum number of units. + :vartype maximum: long + :ivar default: The default number of units. + :vartype default: long + :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", + "Manual", "None". + :vartype scale_type: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubScaleType + """ + + _validation = { + 'minimum': {'readonly': True, 'maximum': 1, 'minimum': 1}, + 'maximum': {'readonly': True}, + 'default': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default': {'key': 'default', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default = None + self.scale_type = None + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class IotHubDescription(Resource): + """The description of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: IotHub properties. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.IotHubProperties + :param sku: Required. IotHub SKU info. + :type sku: ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuInfo + :param identity: The managed identities for the IotHub. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ArmIdentity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotHubProperties'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'identity': {'key': 'identity', 'type': 'ArmIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDescription, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.properties = kwargs.get('properties', None) + self.sku = kwargs['sku'] + self.identity = kwargs.get('identity', None) + + +class IotHubDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubDescription objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDescriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubLocationDescription(msrest.serialization.Model): + """Public representation of one of the locations where a resource is provisioned. + + :param location: The name of the Azure region. + :type location: str + :param role: The role of the region, can be either primary or secondary. The primary region is + where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery + (DR) paired region and also the region where the IoT hub can failover to. Possible values + include: "primary", "secondary". + :type role: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubReplicaRoleType + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubLocationDescription, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.role = kwargs.get('role', None) + + +class IotHubNameAvailabilityInfo(msrest.serialization.Model): + """The properties indicating whether a given IoT hub name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: The value which indicates whether the provided name is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = kwargs.get('message', None) + + +class IotHubProperties(msrest.serialization.Model): + """The properties of an IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param authorization_policies: The shared access policies you can use to secure a connection to + the IoT hub. + :type authorization_policies: + list[~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule] + :param public_network_access: Whether requests from Public Network are allowed. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.iothub.v2021_03_31.models.PublicNetworkAccess + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothub.v2021_03_31.models.IpFilterRule] + :param network_rule_sets: Network Rule Set Properties of IotHub. + :type network_rule_sets: ~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleSetProperties + :param min_tls_version: Specifies the minimum TLS version to support for this hub. Can be set + to "1.2" to have clients that use a TLS version below 1.2 to be rejected. + :type min_tls_version: str + :param private_endpoint_connections: Private endpoint connections created on this IotHub. + :type private_endpoint_connections: + list[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :ivar state: The hub state. + :vartype state: str + :ivar host_name: The name of the host. + :vartype host_name: str + :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible + keys to this dictionary is events. This key has to be present in the dictionary while making + create or update calls for the IoT hub. + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2021_03_31.models.EventHubProperties] + :param routing: The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + :type routing: ~azure.mgmt.iothub.v2021_03_31.models.RoutingProperties + :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. + Currently you can configure only one Azure Storage account and that MUST have its key as + $default. Specifying more than one storage account causes an error to be thrown. Not specifying + a value for this property when the enableFileUploadNotifications property is set to True, + causes an error to be thrown. + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_31.models.StorageEndpointProperties] + :param messaging_endpoints: The messaging endpoint properties for the file upload notification + queue. + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_31.models.MessagingEndpointProperties] + :param enable_file_upload_notifications: If True, file upload notifications are enabled. + :type enable_file_upload_notifications: bool + :param cloud_to_device: The IoT hub cloud-to-device messaging properties. + :type cloud_to_device: ~azure.mgmt.iothub.v2021_03_31.models.CloudToDeviceProperties + :param comments: IoT hub comments. + :type comments: str + :param features: The capabilities and features enabled for the IoT hub. Possible values + include: "None", "DeviceManagement". + :type features: str or ~azure.mgmt.iothub.v2021_03_31.models.Capabilities + :ivar locations: Primary and secondary location for iot hub. + :vartype locations: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubLocationDescription] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'host_name': {'readonly': True}, + 'locations': {'readonly': True}, + } + + _attribute_map = { + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'network_rule_sets': {'key': 'networkRuleSets', 'type': 'NetworkRuleSetProperties'}, + 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'event_hub_endpoints': {'key': 'eventHubEndpoints', 'type': '{EventHubProperties}'}, + 'routing': {'key': 'routing', 'type': 'RoutingProperties'}, + 'storage_endpoints': {'key': 'storageEndpoints', 'type': '{StorageEndpointProperties}'}, + 'messaging_endpoints': {'key': 'messagingEndpoints', 'type': '{MessagingEndpointProperties}'}, + 'enable_file_upload_notifications': {'key': 'enableFileUploadNotifications', 'type': 'bool'}, + 'cloud_to_device': {'key': 'cloudToDevice', 'type': 'CloudToDeviceProperties'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'features': {'key': 'features', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[IotHubLocationDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubProperties, self).__init__(**kwargs) + self.authorization_policies = kwargs.get('authorization_policies', None) + self.public_network_access = kwargs.get('public_network_access', None) + self.ip_filter_rules = kwargs.get('ip_filter_rules', None) + self.network_rule_sets = kwargs.get('network_rule_sets', None) + self.min_tls_version = kwargs.get('min_tls_version', None) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + self.provisioning_state = None + self.state = None + self.host_name = None + self.event_hub_endpoints = kwargs.get('event_hub_endpoints', None) + self.routing = kwargs.get('routing', None) + self.storage_endpoints = kwargs.get('storage_endpoints', None) + self.messaging_endpoints = kwargs.get('messaging_endpoints', None) + self.enable_file_upload_notifications = kwargs.get('enable_file_upload_notifications', None) + self.cloud_to_device = kwargs.get('cloud_to_device', None) + self.comments = kwargs.get('comments', None) + self.features = kwargs.get('features', None) + self.locations = None + + +class IotHubQuotaMetricInfo(msrest.serialization.Model): + """Quota metrics properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the quota metric. + :vartype name: str + :ivar current_value: The current value for the quota metric. + :vartype current_value: long + :ivar max_value: The maximum value of the quota metric. + :vartype max_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'current_value': {'readonly': True}, + 'max_value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'max_value': {'key': 'maxValue', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfo, self).__init__(**kwargs) + self.name = None + self.current_value = None + self.max_value = None + + +class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of quota metrics objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubQuotaMetricInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubQuotaMetricInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfoListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubSkuDescription(msrest.serialization.Model): + """SKU properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :param sku: Required. The type of the resource. + :type sku: ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuInfo + :param capacity: Required. IotHub capacity. + :type capacity: ~azure.mgmt.iothub.v2021_03_31.models.IotHubCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'required': True}, + 'capacity': {'required': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'capacity': {'key': 'capacity', 'type': 'IotHubCapacity'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.sku = kwargs['sku'] + self.capacity = kwargs['capacity'] + + +class IotHubSkuDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubSkuDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubSkuDescription. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubSkuDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuDescriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubSkuInfo(msrest.serialization.Model): + """Information about the SKU of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", + "B1", "B2", "B3". + :type name: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubSku + :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", + "Basic". + :vartype tier: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuTier + :param capacity: The number of provisioned IoT Hub units. See: + https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + :type capacity: long + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuInfo, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = None + self.capacity = kwargs.get('capacity', None) + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothub.v2021_03_31.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = kwargs['filter_name'] + self.action = kwargs['action'] + self.ip_mask = kwargs['ip_mask'] + + +class JobResponse(msrest.serialization.Model): + """The properties of the Job Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_id: The job identifier. + :vartype job_id: str + :ivar start_time_utc: The start time of the job. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: The time the job stopped processing. + :vartype end_time_utc: ~datetime.datetime + :ivar type: The type of the job. Possible values include: "unknown", "export", "import", + "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", + "rebootDevice", "factoryResetDevice", "firmwareUpdate". + :vartype type: str or ~azure.mgmt.iothub.v2021_03_31.models.JobType + :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", + "completed", "failed", "cancelled". + :vartype status: str or ~azure.mgmt.iothub.v2021_03_31.models.JobStatus + :ivar failure_reason: If status == failed, this string containing the reason for the failure. + :vartype failure_reason: str + :ivar status_message: The status message for the job. + :vartype status_message: str + :ivar parent_job_id: The job identifier of the parent job, if any. + :vartype parent_job_id: str + """ + + _validation = { + 'job_id': {'readonly': True}, + 'start_time_utc': {'readonly': True}, + 'end_time_utc': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'status_message': {'readonly': True}, + 'parent_job_id': {'readonly': True}, + } + + _attribute_map = { + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'rfc-1123'}, + 'end_time_utc': {'key': 'endTimeUtc', 'type': 'rfc-1123'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'parent_job_id': {'key': 'parentJobId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.job_id = None + self.start_time_utc = None + self.end_time_utc = None + self.type = None + self.status = None + self.failure_reason = None + self.status_message = None + self.parent_job_id = None + + +class JobResponseListResult(msrest.serialization.Model): + """The JSON-serialized array of JobResponse objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of JobResponse objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.JobResponse] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JobResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponseListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ManagedIdentity(msrest.serialization.Model): + """The properties of the Managed identity. + + :param user_assigned_identity: The user assigned identity. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedIdentity, self).__init__(**kwargs) + self.user_assigned_identity = kwargs.get('user_assigned_identity', None) + + +class MatchedRoute(msrest.serialization.Model): + """Routes that matched. + + :param properties: Properties of routes that matched. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.RouteProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RouteProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(MatchedRoute, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class MessagingEndpointProperties(msrest.serialization.Model): + """The properties of the messaging endpoints used by this IoT hub. + + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(MessagingEndpointProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = kwargs.get('lock_duration_as_iso8601', None) + self.ttl_as_iso8601 = kwargs.get('ttl_as_iso8601', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + + +class Name(msrest.serialization.Model): + """Name of Iot Hub type. + + :param value: IotHub type. + :type value: str + :param localized_value: Localized value of name. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Name, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class NetworkRuleSetIpRule(msrest.serialization.Model): + """IP Rule to be applied as part of Network Rule Set. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. Name of the IP filter rule. + :type filter_name: str + :param action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleIPAction + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetIpRule, self).__init__(**kwargs) + self.filter_name = kwargs['filter_name'] + self.action = kwargs.get('action', "Allow") + self.ip_mask = kwargs['ip_mask'] + + +class NetworkRuleSetProperties(msrest.serialization.Model): + """Network Rule Set Properties of IotHub. + + All required parameters must be populated in order to send to Azure. + + :param default_action: Default Action for Network Rule Set. Possible values include: "Deny", + "Allow". Default value: "Deny". + :type default_action: str or ~azure.mgmt.iothub.v2021_03_31.models.DefaultAction + :param apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also + applied to BuiltIn EventHub EndPoint of IotHub. + :type apply_to_built_in_event_hub_endpoint: bool + :param ip_rules: Required. List of IP Rules. + :type ip_rules: list[~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleSetIpRule] + """ + + _validation = { + 'apply_to_built_in_event_hub_endpoint': {'required': True}, + 'ip_rules': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'apply_to_built_in_event_hub_endpoint': {'key': 'applyToBuiltInEventHubEndpoint', 'type': 'bool'}, + 'ip_rules': {'key': 'ipRules', 'type': '[NetworkRuleSetIpRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetProperties, self).__init__(**kwargs) + self.default_action = kwargs.get('default_action', "Deny") + self.apply_to_built_in_event_hub_endpoint = kwargs['apply_to_built_in_event_hub_endpoint'] + self.ip_rules = kwargs['ip_rules'] + + +class Operation(msrest.serialization.Model): + """IoT Hub REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothub.v2021_03_31.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: IotHubs. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationInputs(msrest.serialization.Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the IoT hub to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. + :vartype value: list[~azure.mgmt.iothub.v2021_03_31.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """The private endpoint property of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(msrest.serialization.Model): + """The private endpoint connection of an IotHub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties of a private endpoint connection. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """The properties of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param private_endpoint: The private endpoint property of a private endpoint connection. + :type private_endpoint: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpoint + :param private_link_service_connection_state: Required. The current state of a private endpoint + connection. + :type private_link_service_connection_state: + ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'private_link_service_connection_state': {'required': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs['private_link_service_connection_state'] + + +class PrivateLinkResources(msrest.serialization.Model): + """The available private link resources for an IotHub. + + :param value: The list of available private link resources for an IotHub. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResources, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The current state of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of a private endpoint connection. Possible values include: + "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkServiceConnectionStatus + :param description: Required. The description for the current state of a private endpoint + connection. + :type description: str + :param actions_required: Actions required for a private endpoint connection. + :type actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs['status'] + self.description = kwargs['description'] + self.actions_required = kwargs.get('actions_required', None) + + +class RegistryStatistics(msrest.serialization.Model): + """Identity registry statistics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_device_count: The total count of devices in the identity registry. + :vartype total_device_count: long + :ivar enabled_device_count: The count of enabled devices in the identity registry. + :vartype enabled_device_count: long + :ivar disabled_device_count: The count of disabled devices in the identity registry. + :vartype disabled_device_count: long + """ + + _validation = { + 'total_device_count': {'readonly': True}, + 'enabled_device_count': {'readonly': True}, + 'disabled_device_count': {'readonly': True}, + } + + _attribute_map = { + 'total_device_count': {'key': 'totalDeviceCount', 'type': 'long'}, + 'enabled_device_count': {'key': 'enabledDeviceCount', 'type': 'long'}, + 'disabled_device_count': {'key': 'disabledDeviceCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryStatistics, self).__init__(**kwargs) + self.total_device_count = None + self.enabled_device_count = None + self.disabled_device_count = None + + +class RouteCompilationError(msrest.serialization.Model): + """Compilation error when evaluating route. + + :param message: Route error message. + :type message: str + :param severity: Severity of the route error. Possible values include: "error", "warning". + :type severity: str or ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorSeverity + :param location: Location where the route error happened. + :type location: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorRange + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'RouteErrorRange'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteCompilationError, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.severity = kwargs.get('severity', None) + self.location = kwargs.get('location', None) + + +class RouteErrorPosition(msrest.serialization.Model): + """Position where the route error happened. + + :param line: Line where the route error happened. + :type line: int + :param column: Column where the route error happened. + :type column: int + """ + + _attribute_map = { + 'line': {'key': 'line', 'type': 'int'}, + 'column': {'key': 'column', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteErrorPosition, self).__init__(**kwargs) + self.line = kwargs.get('line', None) + self.column = kwargs.get('column', None) + + +class RouteErrorRange(msrest.serialization.Model): + """Range of route errors. + + :param start: Start where the route error happened. + :type start: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorPosition + :param end: End where the route error happened. + :type end: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorPosition + """ + + _attribute_map = { + 'start': {'key': 'start', 'type': 'RouteErrorPosition'}, + 'end': {'key': 'end', 'type': 'RouteErrorPosition'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteErrorRange, self).__init__(**kwargs) + self.start = kwargs.get('start', None) + self.end = kwargs.get('end', None) + + +class RouteProperties(msrest.serialization.Model): + """The properties of a routing rule that your IoT hub uses to route messages to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route. The name can only include alphanumeric + characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be + unique. + :type name: str + :param source: Required. The source that the routing rule is to be applied to, such as + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource + :param condition: The condition that is evaluated to apply the routing rule. If no condition is + provided, it evaluates to true by default. For grammar, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which messages that satisfy the + condition are routed. Currently only one endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether a route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteProperties, self).__init__(**kwargs) + self.name = kwargs['name'] + self.source = kwargs['source'] + self.condition = kwargs.get('condition', None) + self.endpoint_names = kwargs['endpoint_names'] + self.is_enabled = kwargs['is_enabled'] + + +class RoutingEndpoints(msrest.serialization.Model): + """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + + :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the + messages to, based on the routing rules. + :type service_bus_queues: + list[~azure.mgmt.iothub.v2021_03_31.models.RoutingServiceBusQueueEndpointProperties] + :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the + messages to, based on the routing rules. + :type service_bus_topics: + list[~azure.mgmt.iothub.v2021_03_31.models.RoutingServiceBusTopicEndpointProperties] + :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on + the routing rules. This list does not include the built-in Event Hubs endpoint. + :type event_hubs: list[~azure.mgmt.iothub.v2021_03_31.models.RoutingEventHubProperties] + :param storage_containers: The list of storage container endpoints that IoT hub routes messages + to, based on the routing rules. + :type storage_containers: + list[~azure.mgmt.iothub.v2021_03_31.models.RoutingStorageContainerProperties] + """ + + _attribute_map = { + 'service_bus_queues': {'key': 'serviceBusQueues', 'type': '[RoutingServiceBusQueueEndpointProperties]'}, + 'service_bus_topics': {'key': 'serviceBusTopics', 'type': '[RoutingServiceBusTopicEndpointProperties]'}, + 'event_hubs': {'key': 'eventHubs', 'type': '[RoutingEventHubProperties]'}, + 'storage_containers': {'key': 'storageContainers', 'type': '[RoutingStorageContainerProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingEndpoints, self).__init__(**kwargs) + self.service_bus_queues = kwargs.get('service_bus_queues', None) + self.service_bus_topics = kwargs.get('service_bus_topics', None) + self.event_hubs = kwargs.get('event_hubs', None) + self.storage_containers = kwargs.get('storage_containers', None) + + +class RoutingEventHubProperties(msrest.serialization.Model): + """The properties related to an event hub endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the event hub endpoint. + :type id: str + :param connection_string: The connection string of the event hub endpoint. + :type connection_string: str + :param endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. + :type endpoint_uri: str + :param entity_path: Event hub name on the event hub namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the event hub endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of routing event hub endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the event hub endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the event hub endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingEventHubProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.entity_path = kwargs.get('entity_path', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingMessage(msrest.serialization.Model): + """Routing message. + + :param body: Body of routing message. + :type body: str + :param app_properties: App properties. + :type app_properties: dict[str, str] + :param system_properties: System properties. + :type system_properties: dict[str, str] + """ + + _attribute_map = { + 'body': {'key': 'body', 'type': 'str'}, + 'app_properties': {'key': 'appProperties', 'type': '{str}'}, + 'system_properties': {'key': 'systemProperties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingMessage, self).__init__(**kwargs) + self.body = kwargs.get('body', None) + self.app_properties = kwargs.get('app_properties', None) + self.system_properties = kwargs.get('system_properties', None) + + +class RoutingProperties(msrest.serialization.Model): + """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + + :param endpoints: The properties related to the custom endpoints to which your IoT hub routes + messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all + endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types + for free hubs. + :type endpoints: ~azure.mgmt.iothub.v2021_03_31.models.RoutingEndpoints + :param routes: The list of user-provided routing rules that the IoT hub uses to route messages + to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and + a maximum of 5 routing rules are allowed for free hubs. + :type routes: list[~azure.mgmt.iothub.v2021_03_31.models.RouteProperties] + :param fallback_route: The properties of the route that is used as a fall-back route when none + of the conditions specified in the 'routes' section are met. This is an optional parameter. + When this property is not set, the messages which do not meet any of the conditions specified + in the 'routes' section get routed to the built-in eventhub endpoint. + :type fallback_route: ~azure.mgmt.iothub.v2021_03_31.models.FallbackRouteProperties + :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages + to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. + :type enrichments: list[~azure.mgmt.iothub.v2021_03_31.models.EnrichmentProperties] + """ + + _attribute_map = { + 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, + 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, + 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, + 'enrichments': {'key': 'enrichments', 'type': '[EnrichmentProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingProperties, self).__init__(**kwargs) + self.endpoints = kwargs.get('endpoints', None) + self.routes = kwargs.get('routes', None) + self.fallback_route = kwargs.get('fallback_route', None) + self.enrichments = kwargs.get('enrichments', None) + + +class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): + """The properties related to service bus queue endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus queue endpoint. + :type id: str + :param connection_string: The connection string of the service bus queue endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus queue endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus queue endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of routing service bus queue endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual queue + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus queue endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus queue endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingServiceBusQueueEndpointProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.entity_path = kwargs.get('entity_path', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): + """The properties related to service bus topic endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus topic endpoint. + :type id: str + :param connection_string: The connection string of the service bus topic endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus topic endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus topic. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus topic endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of routing service bus topic endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual topic + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus topic endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus topic endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingServiceBusTopicEndpointProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.entity_path = kwargs.get('entity_path', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingStorageContainerProperties(msrest.serialization.Model): + """The properties related to a storage container endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the storage container endpoint. + :type id: str + :param connection_string: The connection string of the storage account. + :type connection_string: str + :param endpoint_uri: The url of the storage endpoint. It must include the protocol https://. + :type endpoint_uri: str + :param authentication_type: Method used to authenticate against the storage endpoint. Possible + values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of routing storage endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the storage account. + :type subscription_id: str + :param resource_group: The name of the resource group of the storage account. + :type resource_group: str + :param container_name: Required. The name of storage container in the storage account. + :type container_name: str + :param file_name_format: File name format for the blob. Default format is + {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be + reordered. + :type file_name_format: str + :param batch_frequency_in_seconds: Time interval at which blobs are written to storage. Value + should be between 60 and 720 seconds. Default value is 300 seconds. + :type batch_frequency_in_seconds: int + :param max_chunk_size_in_bytes: Maximum number of bytes for each blob written to storage. Value + should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + :type max_chunk_size_in_bytes: int + :param encoding: Encoding that is used to serialize messages to blobs. Supported values are + 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", + "AvroDeflate", "JSON". + :type encoding: str or + ~azure.mgmt.iothub.v2021_03_31.models.RoutingStorageContainerPropertiesEncoding + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'container_name': {'required': True}, + 'batch_frequency_in_seconds': {'maximum': 720, 'minimum': 60}, + 'max_chunk_size_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'file_name_format': {'key': 'fileNameFormat', 'type': 'str'}, + 'batch_frequency_in_seconds': {'key': 'batchFrequencyInSeconds', 'type': 'int'}, + 'max_chunk_size_in_bytes': {'key': 'maxChunkSizeInBytes', 'type': 'int'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingStorageContainerProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + self.container_name = kwargs['container_name'] + self.file_name_format = kwargs.get('file_name_format', None) + self.batch_frequency_in_seconds = kwargs.get('batch_frequency_in_seconds', None) + self.max_chunk_size_in_bytes = kwargs.get('max_chunk_size_in_bytes', None) + self.encoding = kwargs.get('encoding', None) + + +class RoutingTwin(msrest.serialization.Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: A set of tags. Twin Tags. + :type tags: str + :param properties: + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingTwin, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class RoutingTwinProperties(msrest.serialization.Model): + """RoutingTwinProperties. + + :param desired: Twin desired properties. + :type desired: str + :param reported: Twin desired properties. + :type reported: str + """ + + _attribute_map = { + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired = kwargs.get('desired', None) + self.reported = kwargs.get('reported', None) + + +class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): + """The properties of an IoT hub shared access policy. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the shared access policy. + :type key_name: str + :param primary_key: The primary key. + :type primary_key: str + :param secondary_key: The secondary key. + :type secondary_key: str + :param rights: Required. The permissions assigned to the shared access policy. Possible values + include: "RegistryRead", "RegistryWrite", "ServiceConnect", "DeviceConnect", "RegistryRead, + RegistryWrite", "RegistryRead, ServiceConnect", "RegistryRead, DeviceConnect", "RegistryWrite, + ServiceConnect", "RegistryWrite, DeviceConnect", "ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", + "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". + :type rights: str or ~azure.mgmt.iothub.v2021_03_31.models.AccessRights + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRule, self).__init__(**kwargs) + self.key_name = kwargs['key_name'] + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.rights = kwargs['rights'] + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """The list of shared access policies with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class StorageEndpointProperties(msrest.serialization.Model): + """The properties of the Azure Storage endpoint for file upload. + + All required parameters must be populated in order to send to Azure. + + :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + :type sas_ttl_as_iso8601: ~datetime.timedelta + :param connection_string: Required. The connection string for the Azure Storage account to + which files are uploaded. + :type connection_string: str + :param container_name: Required. The name of the root container where you upload files. The + container need not exist but should be creatable using the connectionString specified. + :type container_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for file upload. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + """ + + _validation = { + 'connection_string': {'required': True}, + 'container_name': {'required': True}, + } + + _attribute_map = { + 'sas_ttl_as_iso8601': {'key': 'sasTtlAsIso8601', 'type': 'duration'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(StorageEndpointProperties, self).__init__(**kwargs) + self.sas_ttl_as_iso8601 = kwargs.get('sas_ttl_as_iso8601', None) + self.connection_string = kwargs['connection_string'] + self.container_name = kwargs['container_name'] + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class TestAllRoutesInput(msrest.serialization.Model): + """Input for testing all routes. + + :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", + "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", + "DeviceConnectionStateEvents". + :type routing_source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_03_31.models.RoutingMessage + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwin + """ + + _attribute_map = { + 'routing_source': {'key': 'routingSource', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + **kwargs + ): + super(TestAllRoutesInput, self).__init__(**kwargs) + self.routing_source = kwargs.get('routing_source', None) + self.message = kwargs.get('message', None) + self.twin = kwargs.get('twin', None) + + +class TestAllRoutesResult(msrest.serialization.Model): + """Result of testing all routes. + + :param routes: JSON-serialized array of matched routes. + :type routes: list[~azure.mgmt.iothub.v2021_03_31.models.MatchedRoute] + """ + + _attribute_map = { + 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestAllRoutesResult, self).__init__(**kwargs) + self.routes = kwargs.get('routes', None) + + +class TestRouteInput(msrest.serialization.Model): + """Input for testing route. + + All required parameters must be populated in order to send to Azure. + + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_03_31.models.RoutingMessage + :param route: Required. Route properties. + :type route: ~azure.mgmt.iothub.v2021_03_31.models.RouteProperties + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwin + """ + + _validation = { + 'route': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteInput, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.route = kwargs['route'] + self.twin = kwargs.get('twin', None) + + +class TestRouteResult(msrest.serialization.Model): + """Result of testing one route. + + :param result: Result of testing route. Possible values include: "undefined", "false", "true". + :type result: str or ~azure.mgmt.iothub.v2021_03_31.models.TestResultStatus + :param details: Detailed result of testing route. + :type details: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteResultDetails + """ + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'TestRouteResultDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteResult, self).__init__(**kwargs) + self.result = kwargs.get('result', None) + self.details = kwargs.get('details', None) + + +class TestRouteResultDetails(msrest.serialization.Model): + """Detailed result of testing a route. + + :param compilation_errors: JSON-serialized list of route compilation errors. + :type compilation_errors: list[~azure.mgmt.iothub.v2021_03_31.models.RouteCompilationError] + """ + + _attribute_map = { + 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteResultDetails, self).__init__(**kwargs) + self.compilation_errors = kwargs.get('compilation_errors', None) + + +class UserSubscriptionQuota(msrest.serialization.Model): + """User subscription quota response. + + :param id: IotHub type id. + :type id: str + :param type: Response type. + :type type: str + :param unit: Unit of IotHub type. + :type unit: str + :param current_value: Current number of IotHub type. + :type current_value: int + :param limit: Numerical limit on IotHub type. + :type limit: int + :param name: IotHub type. + :type name: ~azure.mgmt.iothub.v2021_03_31.models.Name + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'Name'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSubscriptionQuota, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.unit = kwargs.get('unit', None) + self.current_value = kwargs.get('current_value', None) + self.limit = kwargs.get('limit', None) + self.name = kwargs.get('name', None) + + +class UserSubscriptionQuotaListResult(msrest.serialization.Model): + """Json-serialized array of User subscription quota response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.UserSubscriptionQuota] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSubscriptionQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py new file mode 100644 index 000000000000..9b2483967fe3 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py @@ -0,0 +1,3281 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._iot_hub_client_enums import * + + +class ArmIdentity(msrest.serialization.Model): + """ArmIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the service. Possible values + include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.iothub.v2021_03_31.models.ResourceIdentityType + :param user_assigned_identities: Dictionary of :code:``. + :type user_assigned_identities: dict[str, + ~azure.mgmt.iothub.v2021_03_31.models.ArmUserIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ArmUserIdentity}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ArmUserIdentity"]] = None, + **kwargs + ): + super(ArmIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ArmUserIdentity(msrest.serialization.Model): + """ArmUserIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: + :vartype principal_id: str + :ivar client_id: + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmUserIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = certificate + + +class CertificateDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): + super(CertificateDescription, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateDescription]'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateDescription"]] = None, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = value + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :param certificate: The certificate content. + :type certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.certificate = certificate + + +class CertificatePropertiesWithNonce(msrest.serialization.Model): + """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :ivar verification_code: The certificate's verification code that will be used for proof of + possession. + :vartype verification_code: str + :ivar certificate: The certificate content. + :vartype certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'verification_code': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificatePropertiesWithNonce, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.verification_code = None + self.certificate = None + + +class CertificateVerificationDescription(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateVerificationDescription, self).__init__(**kwargs) + self.certificate = certificate + + +class CertificateWithNonceDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate including the challenge nonce + issued for the Proof-Of-Possession flow. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.CertificatePropertiesWithNonce + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificatePropertiesWithNonce'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["CertificatePropertiesWithNonce"] = None, + **kwargs + ): + super(CertificateWithNonceDescription, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CloudToDeviceProperties(msrest.serialization.Model): + """The IoT hub cloud-to-device messaging properties. + + :param max_delivery_count: The max delivery count for cloud-to-device messages in the device + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type default_ttl_as_iso8601: ~datetime.timedelta + :param feedback: The properties of the feedback queue for cloud-to-device messages. + :type feedback: ~azure.mgmt.iothub.v2021_03_31.models.FeedbackProperties + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + 'default_ttl_as_iso8601': {'key': 'defaultTtlAsIso8601', 'type': 'duration'}, + 'feedback': {'key': 'feedback', 'type': 'FeedbackProperties'}, + } + + def __init__( + self, + *, + max_delivery_count: Optional[int] = None, + default_ttl_as_iso8601: Optional[datetime.timedelta] = None, + feedback: Optional["FeedbackProperties"] = None, + **kwargs + ): + super(CloudToDeviceProperties, self).__init__(**kwargs) + self.max_delivery_count = max_delivery_count + self.default_ttl_as_iso8601 = default_ttl_as_iso8601 + self.feedback = feedback + + +class EndpointHealthData(msrest.serialization.Model): + """The health data for an endpoint. + + :param endpoint_id: Id of the endpoint. + :type endpoint_id: str + :param health_status: Health statuses have following meanings. The 'healthy' status shows that + the endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint + is not accepting messages as expected and IoT Hub is retrying to send data to this endpoint. + The status of an unhealthy endpoint will be updated to healthy when IoT Hub has established an + eventually consistent state of health. The 'dead' status shows that the endpoint is not + accepting messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub + metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + the IoT Hub has not established a connection with the endpoint. No messages have been delivered + to or rejected from this endpoint. Possible values include: "unknown", "healthy", "degraded", + "unhealthy", "dead". + :type health_status: str or ~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthStatus + :param last_known_error: Last error obtained when a message failed to be delivered to iot hub. + :type last_known_error: str + :param last_known_error_time: Time at which the last known error occurred. + :type last_known_error_time: ~datetime.datetime + :param last_successful_send_attempt_time: Last time iot hub successfully sent a message to the + endpoint. + :type last_successful_send_attempt_time: ~datetime.datetime + :param last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. + :type last_send_attempt_time: ~datetime.datetime + """ + + _attribute_map = { + 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, + 'health_status': {'key': 'healthStatus', 'type': 'str'}, + 'last_known_error': {'key': 'lastKnownError', 'type': 'str'}, + 'last_known_error_time': {'key': 'lastKnownErrorTime', 'type': 'rfc-1123'}, + 'last_successful_send_attempt_time': {'key': 'lastSuccessfulSendAttemptTime', 'type': 'rfc-1123'}, + 'last_send_attempt_time': {'key': 'lastSendAttemptTime', 'type': 'rfc-1123'}, + } + + def __init__( + self, + *, + endpoint_id: Optional[str] = None, + health_status: Optional[Union[str, "EndpointHealthStatus"]] = None, + last_known_error: Optional[str] = None, + last_known_error_time: Optional[datetime.datetime] = None, + last_successful_send_attempt_time: Optional[datetime.datetime] = None, + last_send_attempt_time: Optional[datetime.datetime] = None, + **kwargs + ): + super(EndpointHealthData, self).__init__(**kwargs) + self.endpoint_id = endpoint_id + self.health_status = health_status + self.last_known_error = last_known_error + self.last_known_error_time = last_known_error_time + self.last_successful_send_attempt_time = last_successful_send_attempt_time + self.last_send_attempt_time = last_send_attempt_time + + +class EndpointHealthDataListResult(msrest.serialization.Model): + """The JSON-serialized array of EndpointHealthData objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: JSON-serialized array of Endpoint health data. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthData] + :ivar next_link: Link to more results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EndpointHealthData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EndpointHealthData"]] = None, + **kwargs + ): + super(EndpointHealthDataListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class EnrichmentProperties(msrest.serialization.Model): + """The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key or name for the enrichment property. + :type key: str + :param value: Required. The value for the enrichment property. + :type value: str + :param endpoint_names: Required. The list of endpoints for which the enrichment is applied to + the message. + :type endpoint_names: list[str] + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'endpoint_names': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + key: str, + value: str, + endpoint_names: List[str], + **kwargs + ): + super(EnrichmentProperties, self).__init__(**kwargs) + self.key = key + self.value = value + self.endpoint_names = endpoint_names + + +class ErrorDetails(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class EventHubConsumerGroupBodyDescription(msrest.serialization.Model): + """The EventHub consumer group. + + All required parameters must be populated in order to send to Azure. + + :param properties: Required. The EventHub consumer group name. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupName + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'EventHubConsumerGroupName'}, + } + + def __init__( + self, + *, + properties: "EventHubConsumerGroupName", + **kwargs + ): + super(EventHubConsumerGroupBodyDescription, self).__init__(**kwargs) + self.properties = properties + + +class EventHubConsumerGroupInfo(msrest.serialization.Model): + """The properties of the EventHubConsumerGroupInfo object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The tags. + :type properties: dict[str, object] + :ivar id: The Event Hub-compatible consumer group identifier. + :vartype id: str + :ivar name: The Event Hub-compatible consumer group name. + :vartype name: str + :ivar type: the resource type. + :vartype type: str + :ivar etag: The etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, object]] = None, + **kwargs + ): + super(EventHubConsumerGroupInfo, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.type = None + self.etag = None + + +class EventHubConsumerGroupName(msrest.serialization.Model): + """The EventHub consumer group name. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. EventHub consumer group name. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(EventHubConsumerGroupName, self).__init__(**kwargs) + self.name = name + + +class EventHubConsumerGroupsListResult(msrest.serialization.Model): + """The JSON-serialized array of Event Hub-compatible consumer group names with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of consumer groups objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventHubConsumerGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EventHubConsumerGroupInfo"]] = None, + **kwargs + ): + super(EventHubConsumerGroupsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class EventHubProperties(msrest.serialization.Model): + """The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param retention_time_in_days: The retention time for device-to-cloud messages in days. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type retention_time_in_days: long + :param partition_count: The number of partitions for receiving device-to-cloud messages in the + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type partition_count: int + :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. + :vartype partition_ids: list[str] + :ivar path: The Event Hub-compatible name. + :vartype path: str + :ivar endpoint: The Event Hub-compatible endpoint. + :vartype endpoint: str + """ + + _validation = { + 'partition_ids': {'readonly': True}, + 'path': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'retention_time_in_days': {'key': 'retentionTimeInDays', 'type': 'long'}, + 'partition_count': {'key': 'partitionCount', 'type': 'int'}, + 'partition_ids': {'key': 'partitionIds', 'type': '[str]'}, + 'path': {'key': 'path', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + *, + retention_time_in_days: Optional[int] = None, + partition_count: Optional[int] = None, + **kwargs + ): + super(EventHubProperties, self).__init__(**kwargs) + self.retention_time_in_days = retention_time_in_days + self.partition_count = partition_count + self.partition_ids = None + self.path = None + self.endpoint = None + + +class ExportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an export of all devices in the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param export_blob_container_uri: Required. The export blob container URI. + :type export_blob_container_uri: str + :param exclude_keys: Required. The value indicating whether keys should be excluded during + export. + :type exclude_keys: bool + :param export_blob_name: The name of the blob that will be created in the provided output blob + container. This blob will contain the exported device registry information for the IoT Hub. + :type export_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for export devices. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param include_configurations: The value indicating whether configurations should be exported. + :type include_configurations: bool + :param configurations_blob_name: The name of the blob that will be created in the provided + output blob container. This blob will contain the exported configurations for the Iot Hub. + :type configurations_blob_name: str + """ + + _validation = { + 'export_blob_container_uri': {'required': True}, + 'exclude_keys': {'required': True}, + } + + _attribute_map = { + 'export_blob_container_uri': {'key': 'exportBlobContainerUri', 'type': 'str'}, + 'exclude_keys': {'key': 'excludeKeys', 'type': 'bool'}, + 'export_blob_name': {'key': 'exportBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'include_configurations': {'key': 'includeConfigurations', 'type': 'bool'}, + 'configurations_blob_name': {'key': 'configurationsBlobName', 'type': 'str'}, + } + + def __init__( + self, + *, + export_blob_container_uri: str, + exclude_keys: bool, + export_blob_name: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + include_configurations: Optional[bool] = None, + configurations_blob_name: Optional[str] = None, + **kwargs + ): + super(ExportDevicesRequest, self).__init__(**kwargs) + self.export_blob_container_uri = export_blob_container_uri + self.exclude_keys = exclude_keys + self.export_blob_name = export_blob_name + self.authentication_type = authentication_type + self.identity = identity + self.include_configurations = include_configurations + self.configurations_blob_name = configurations_blob_name + + +class FailoverInput(msrest.serialization.Model): + """Use to provide failover region when requesting manual Failover for a hub. + + All required parameters must be populated in order to send to Azure. + + :param failover_region: Required. Region the hub will be failed over to. + :type failover_region: str + """ + + _validation = { + 'failover_region': {'required': True}, + } + + _attribute_map = { + 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, + } + + def __init__( + self, + *, + failover_region: str, + **kwargs + ): + super(FailoverInput, self).__init__(**kwargs) + self.failover_region = failover_region + + +class FallbackRouteProperties(msrest.serialization.Model): + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the route. The name can only include alphanumeric characters, periods, + underscores, hyphens, has a maximum length of 64 characters, and must be unique. + :type name: str + :param source: Required. The source to which the routing rule is to be applied to. For example, + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource + :param condition: The condition which is evaluated in order to apply the fallback route. If the + condition is not provided it will evaluate to true by default. For grammar, See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which the messages that satisfy the + condition are routed to. Currently only 1 endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether the fallback route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + source: Union[str, "RoutingSource"], + endpoint_names: List[str], + is_enabled: bool, + name: Optional[str] = None, + condition: Optional[str] = None, + **kwargs + ): + super(FallbackRouteProperties, self).__init__(**kwargs) + self.name = name + self.source = source + self.condition = condition + self.endpoint_names = endpoint_names + self.is_enabled = is_enabled + + +class FeedbackProperties(msrest.serialization.Model): + """The properties of the feedback queue for cloud-to-device messages. + + :param lock_duration_as_iso8601: The lock duration for the feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + *, + lock_duration_as_iso8601: Optional[datetime.timedelta] = None, + ttl_as_iso8601: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + **kwargs + ): + super(FeedbackProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = lock_duration_as_iso8601 + self.ttl_as_iso8601 = ttl_as_iso8601 + self.max_delivery_count = max_delivery_count + + +class GroupIdInformation(msrest.serialization.Model): + """The group information for creating a private endpoint on an IotHub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties for a group information object. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'GroupIdInformationProperties'}, + } + + def __init__( + self, + *, + properties: "GroupIdInformationProperties", + **kwargs + ): + super(GroupIdInformation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class GroupIdInformationProperties(msrest.serialization.Model): + """The properties for a group information object. + + :param group_id: The group id. + :type group_id: str + :param required_members: The required members for a specific group id. + :type required_members: list[str] + :param required_zone_names: The required DNS zones for a specific group id. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(GroupIdInformationProperties, self).__init__(**kwargs) + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + + +class ImportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an import of all devices in the hub. + + All required parameters must be populated in order to send to Azure. + + :param input_blob_container_uri: Required. The input blob container URI. + :type input_blob_container_uri: str + :param output_blob_container_uri: Required. The output blob container URI. + :type output_blob_container_uri: str + :param input_blob_name: The blob name to be used when importing from the provided input blob + container. + :type input_blob_name: str + :param output_blob_name: The blob name to use for storing the status of the import job. + :type output_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for import devices. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param include_configurations: The value indicating whether configurations should be imported. + :type include_configurations: bool + :param configurations_blob_name: The blob name to be used when importing configurations from + the provided input blob container. + :type configurations_blob_name: str + """ + + _validation = { + 'input_blob_container_uri': {'required': True}, + 'output_blob_container_uri': {'required': True}, + } + + _attribute_map = { + 'input_blob_container_uri': {'key': 'inputBlobContainerUri', 'type': 'str'}, + 'output_blob_container_uri': {'key': 'outputBlobContainerUri', 'type': 'str'}, + 'input_blob_name': {'key': 'inputBlobName', 'type': 'str'}, + 'output_blob_name': {'key': 'outputBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'include_configurations': {'key': 'includeConfigurations', 'type': 'bool'}, + 'configurations_blob_name': {'key': 'configurationsBlobName', 'type': 'str'}, + } + + def __init__( + self, + *, + input_blob_container_uri: str, + output_blob_container_uri: str, + input_blob_name: Optional[str] = None, + output_blob_name: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + include_configurations: Optional[bool] = None, + configurations_blob_name: Optional[str] = None, + **kwargs + ): + super(ImportDevicesRequest, self).__init__(**kwargs) + self.input_blob_container_uri = input_blob_container_uri + self.output_blob_container_uri = output_blob_container_uri + self.input_blob_name = input_blob_name + self.output_blob_name = output_blob_name + self.authentication_type = authentication_type + self.identity = identity + self.include_configurations = include_configurations + self.configurations_blob_name = configurations_blob_name + + +class IotHubCapacity(msrest.serialization.Model): + """IoT Hub capacity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum number of units. + :vartype minimum: long + :ivar maximum: The maximum number of units. + :vartype maximum: long + :ivar default: The default number of units. + :vartype default: long + :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", + "Manual", "None". + :vartype scale_type: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubScaleType + """ + + _validation = { + 'minimum': {'readonly': True, 'maximum': 1, 'minimum': 1}, + 'maximum': {'readonly': True}, + 'default': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default': {'key': 'default', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default = None + self.scale_type = None + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class IotHubDescription(Resource): + """The description of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: IotHub properties. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.IotHubProperties + :param sku: Required. IotHub SKU info. + :type sku: ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuInfo + :param identity: The managed identities for the IotHub. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ArmIdentity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotHubProperties'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'identity': {'key': 'identity', 'type': 'ArmIdentity'}, + } + + def __init__( + self, + *, + location: str, + sku: "IotHubSkuInfo", + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + properties: Optional["IotHubProperties"] = None, + identity: Optional["ArmIdentity"] = None, + **kwargs + ): + super(IotHubDescription, self).__init__(location=location, tags=tags, **kwargs) + self.etag = etag + self.properties = properties + self.sku = sku + self.identity = identity + + +class IotHubDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubDescription objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubDescription"]] = None, + **kwargs + ): + super(IotHubDescriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubLocationDescription(msrest.serialization.Model): + """Public representation of one of the locations where a resource is provisioned. + + :param location: The name of the Azure region. + :type location: str + :param role: The role of the region, can be either primary or secondary. The primary region is + where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery + (DR) paired region and also the region where the IoT hub can failover to. Possible values + include: "primary", "secondary". + :type role: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubReplicaRoleType + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + role: Optional[Union[str, "IotHubReplicaRoleType"]] = None, + **kwargs + ): + super(IotHubLocationDescription, self).__init__(**kwargs) + self.location = location + self.role = role + + +class IotHubNameAvailabilityInfo(msrest.serialization.Model): + """The properties indicating whether a given IoT hub name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: The value which indicates whether the provided name is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + **kwargs + ): + super(IotHubNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = message + + +class IotHubProperties(msrest.serialization.Model): + """The properties of an IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param authorization_policies: The shared access policies you can use to secure a connection to + the IoT hub. + :type authorization_policies: + list[~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule] + :param public_network_access: Whether requests from Public Network are allowed. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.iothub.v2021_03_31.models.PublicNetworkAccess + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothub.v2021_03_31.models.IpFilterRule] + :param network_rule_sets: Network Rule Set Properties of IotHub. + :type network_rule_sets: ~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleSetProperties + :param min_tls_version: Specifies the minimum TLS version to support for this hub. Can be set + to "1.2" to have clients that use a TLS version below 1.2 to be rejected. + :type min_tls_version: str + :param private_endpoint_connections: Private endpoint connections created on this IotHub. + :type private_endpoint_connections: + list[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :ivar state: The hub state. + :vartype state: str + :ivar host_name: The name of the host. + :vartype host_name: str + :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible + keys to this dictionary is events. This key has to be present in the dictionary while making + create or update calls for the IoT hub. + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2021_03_31.models.EventHubProperties] + :param routing: The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + :type routing: ~azure.mgmt.iothub.v2021_03_31.models.RoutingProperties + :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. + Currently you can configure only one Azure Storage account and that MUST have its key as + $default. Specifying more than one storage account causes an error to be thrown. Not specifying + a value for this property when the enableFileUploadNotifications property is set to True, + causes an error to be thrown. + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_31.models.StorageEndpointProperties] + :param messaging_endpoints: The messaging endpoint properties for the file upload notification + queue. + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_03_31.models.MessagingEndpointProperties] + :param enable_file_upload_notifications: If True, file upload notifications are enabled. + :type enable_file_upload_notifications: bool + :param cloud_to_device: The IoT hub cloud-to-device messaging properties. + :type cloud_to_device: ~azure.mgmt.iothub.v2021_03_31.models.CloudToDeviceProperties + :param comments: IoT hub comments. + :type comments: str + :param features: The capabilities and features enabled for the IoT hub. Possible values + include: "None", "DeviceManagement". + :type features: str or ~azure.mgmt.iothub.v2021_03_31.models.Capabilities + :ivar locations: Primary and secondary location for iot hub. + :vartype locations: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubLocationDescription] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'host_name': {'readonly': True}, + 'locations': {'readonly': True}, + } + + _attribute_map = { + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'network_rule_sets': {'key': 'networkRuleSets', 'type': 'NetworkRuleSetProperties'}, + 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'event_hub_endpoints': {'key': 'eventHubEndpoints', 'type': '{EventHubProperties}'}, + 'routing': {'key': 'routing', 'type': 'RoutingProperties'}, + 'storage_endpoints': {'key': 'storageEndpoints', 'type': '{StorageEndpointProperties}'}, + 'messaging_endpoints': {'key': 'messagingEndpoints', 'type': '{MessagingEndpointProperties}'}, + 'enable_file_upload_notifications': {'key': 'enableFileUploadNotifications', 'type': 'bool'}, + 'cloud_to_device': {'key': 'cloudToDevice', 'type': 'CloudToDeviceProperties'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'features': {'key': 'features', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[IotHubLocationDescription]'}, + } + + def __init__( + self, + *, + authorization_policies: Optional[List["SharedAccessSignatureAuthorizationRule"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + ip_filter_rules: Optional[List["IpFilterRule"]] = None, + network_rule_sets: Optional["NetworkRuleSetProperties"] = None, + min_tls_version: Optional[str] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + event_hub_endpoints: Optional[Dict[str, "EventHubProperties"]] = None, + routing: Optional["RoutingProperties"] = None, + storage_endpoints: Optional[Dict[str, "StorageEndpointProperties"]] = None, + messaging_endpoints: Optional[Dict[str, "MessagingEndpointProperties"]] = None, + enable_file_upload_notifications: Optional[bool] = None, + cloud_to_device: Optional["CloudToDeviceProperties"] = None, + comments: Optional[str] = None, + features: Optional[Union[str, "Capabilities"]] = None, + **kwargs + ): + super(IotHubProperties, self).__init__(**kwargs) + self.authorization_policies = authorization_policies + self.public_network_access = public_network_access + self.ip_filter_rules = ip_filter_rules + self.network_rule_sets = network_rule_sets + self.min_tls_version = min_tls_version + self.private_endpoint_connections = private_endpoint_connections + self.provisioning_state = None + self.state = None + self.host_name = None + self.event_hub_endpoints = event_hub_endpoints + self.routing = routing + self.storage_endpoints = storage_endpoints + self.messaging_endpoints = messaging_endpoints + self.enable_file_upload_notifications = enable_file_upload_notifications + self.cloud_to_device = cloud_to_device + self.comments = comments + self.features = features + self.locations = None + + +class IotHubQuotaMetricInfo(msrest.serialization.Model): + """Quota metrics properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the quota metric. + :vartype name: str + :ivar current_value: The current value for the quota metric. + :vartype current_value: long + :ivar max_value: The maximum value of the quota metric. + :vartype max_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'current_value': {'readonly': True}, + 'max_value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'max_value': {'key': 'maxValue', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfo, self).__init__(**kwargs) + self.name = None + self.current_value = None + self.max_value = None + + +class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of quota metrics objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubQuotaMetricInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubQuotaMetricInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubQuotaMetricInfo"]] = None, + **kwargs + ): + super(IotHubQuotaMetricInfoListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubSkuDescription(msrest.serialization.Model): + """SKU properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :param sku: Required. The type of the resource. + :type sku: ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuInfo + :param capacity: Required. IotHub capacity. + :type capacity: ~azure.mgmt.iothub.v2021_03_31.models.IotHubCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'required': True}, + 'capacity': {'required': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'capacity': {'key': 'capacity', 'type': 'IotHubCapacity'}, + } + + def __init__( + self, + *, + sku: "IotHubSkuInfo", + capacity: "IotHubCapacity", + **kwargs + ): + super(IotHubSkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.sku = sku + self.capacity = capacity + + +class IotHubSkuDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubSkuDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubSkuDescription. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubSkuDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubSkuDescription"]] = None, + **kwargs + ): + super(IotHubSkuDescriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubSkuInfo(msrest.serialization.Model): + """Information about the SKU of the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", + "B1", "B2", "B3". + :type name: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubSku + :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", + "Basic". + :vartype tier: str or ~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuTier + :param capacity: The number of provisioned IoT Hub units. See: + https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + :type capacity: long + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + *, + name: Union[str, "IotHubSku"], + capacity: Optional[int] = None, + **kwargs + ): + super(IotHubSkuInfo, self).__init__(**kwargs) + self.name = name + self.tier = None + self.capacity = capacity + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothub.v2021_03_31.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + *, + filter_name: str, + action: Union[str, "IpFilterActionType"], + ip_mask: str, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = filter_name + self.action = action + self.ip_mask = ip_mask + + +class JobResponse(msrest.serialization.Model): + """The properties of the Job Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_id: The job identifier. + :vartype job_id: str + :ivar start_time_utc: The start time of the job. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: The time the job stopped processing. + :vartype end_time_utc: ~datetime.datetime + :ivar type: The type of the job. Possible values include: "unknown", "export", "import", + "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", + "rebootDevice", "factoryResetDevice", "firmwareUpdate". + :vartype type: str or ~azure.mgmt.iothub.v2021_03_31.models.JobType + :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", + "completed", "failed", "cancelled". + :vartype status: str or ~azure.mgmt.iothub.v2021_03_31.models.JobStatus + :ivar failure_reason: If status == failed, this string containing the reason for the failure. + :vartype failure_reason: str + :ivar status_message: The status message for the job. + :vartype status_message: str + :ivar parent_job_id: The job identifier of the parent job, if any. + :vartype parent_job_id: str + """ + + _validation = { + 'job_id': {'readonly': True}, + 'start_time_utc': {'readonly': True}, + 'end_time_utc': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'status_message': {'readonly': True}, + 'parent_job_id': {'readonly': True}, + } + + _attribute_map = { + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'rfc-1123'}, + 'end_time_utc': {'key': 'endTimeUtc', 'type': 'rfc-1123'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'parent_job_id': {'key': 'parentJobId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.job_id = None + self.start_time_utc = None + self.end_time_utc = None + self.type = None + self.status = None + self.failure_reason = None + self.status_message = None + self.parent_job_id = None + + +class JobResponseListResult(msrest.serialization.Model): + """The JSON-serialized array of JobResponse objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of JobResponse objects. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.JobResponse] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JobResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["JobResponse"]] = None, + **kwargs + ): + super(JobResponseListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedIdentity(msrest.serialization.Model): + """The properties of the Managed identity. + + :param user_assigned_identity: The user assigned identity. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + *, + user_assigned_identity: Optional[str] = None, + **kwargs + ): + super(ManagedIdentity, self).__init__(**kwargs) + self.user_assigned_identity = user_assigned_identity + + +class MatchedRoute(msrest.serialization.Model): + """Routes that matched. + + :param properties: Properties of routes that matched. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.RouteProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RouteProperties'}, + } + + def __init__( + self, + *, + properties: Optional["RouteProperties"] = None, + **kwargs + ): + super(MatchedRoute, self).__init__(**kwargs) + self.properties = properties + + +class MessagingEndpointProperties(msrest.serialization.Model): + """The properties of the messaging endpoints used by this IoT hub. + + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + *, + lock_duration_as_iso8601: Optional[datetime.timedelta] = None, + ttl_as_iso8601: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + **kwargs + ): + super(MessagingEndpointProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = lock_duration_as_iso8601 + self.ttl_as_iso8601 = ttl_as_iso8601 + self.max_delivery_count = max_delivery_count + + +class Name(msrest.serialization.Model): + """Name of Iot Hub type. + + :param value: IotHub type. + :type value: str + :param localized_value: Localized value of name. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): + super(Name, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class NetworkRuleSetIpRule(msrest.serialization.Model): + """IP Rule to be applied as part of Network Rule Set. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. Name of the IP filter rule. + :type filter_name: str + :param action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleIPAction + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + *, + filter_name: str, + ip_mask: str, + action: Optional[Union[str, "NetworkRuleIPAction"]] = "Allow", + **kwargs + ): + super(NetworkRuleSetIpRule, self).__init__(**kwargs) + self.filter_name = filter_name + self.action = action + self.ip_mask = ip_mask + + +class NetworkRuleSetProperties(msrest.serialization.Model): + """Network Rule Set Properties of IotHub. + + All required parameters must be populated in order to send to Azure. + + :param default_action: Default Action for Network Rule Set. Possible values include: "Deny", + "Allow". Default value: "Deny". + :type default_action: str or ~azure.mgmt.iothub.v2021_03_31.models.DefaultAction + :param apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also + applied to BuiltIn EventHub EndPoint of IotHub. + :type apply_to_built_in_event_hub_endpoint: bool + :param ip_rules: Required. List of IP Rules. + :type ip_rules: list[~azure.mgmt.iothub.v2021_03_31.models.NetworkRuleSetIpRule] + """ + + _validation = { + 'apply_to_built_in_event_hub_endpoint': {'required': True}, + 'ip_rules': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'apply_to_built_in_event_hub_endpoint': {'key': 'applyToBuiltInEventHubEndpoint', 'type': 'bool'}, + 'ip_rules': {'key': 'ipRules', 'type': '[NetworkRuleSetIpRule]'}, + } + + def __init__( + self, + *, + apply_to_built_in_event_hub_endpoint: bool, + ip_rules: List["NetworkRuleSetIpRule"], + default_action: Optional[Union[str, "DefaultAction"]] = "Deny", + **kwargs + ): + super(NetworkRuleSetProperties, self).__init__(**kwargs) + self.default_action = default_action + self.apply_to_built_in_event_hub_endpoint = apply_to_built_in_event_hub_endpoint + self.ip_rules = ip_rules + + +class Operation(msrest.serialization.Model): + """IoT Hub REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{read | write | action | delete}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothub.v2021_03_31.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: IotHubs. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationInputs(msrest.serialization.Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the IoT hub to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = name + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list IoT Hub operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. + :vartype value: list[~azure.mgmt.iothub.v2021_03_31.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """The private endpoint property of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(msrest.serialization.Model): + """The private endpoint connection of an IotHub. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param properties: Required. The properties of a private endpoint connection. + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + *, + properties: "PrivateEndpointConnectionProperties", + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """The properties of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param private_endpoint: The private endpoint property of a private endpoint connection. + :type private_endpoint: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpoint + :param private_link_service_connection_state: Required. The current state of a private endpoint + connection. + :type private_link_service_connection_state: + ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'private_link_service_connection_state': {'required': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + *, + private_link_service_connection_state: "PrivateLinkServiceConnectionState", + private_endpoint: Optional["PrivateEndpoint"] = None, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateLinkResources(msrest.serialization.Model): + """The available private link resources for an IotHub. + + :param value: The list of available private link resources for an IotHub. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, + } + + def __init__( + self, + *, + value: Optional[List["GroupIdInformation"]] = None, + **kwargs + ): + super(PrivateLinkResources, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The current state of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of a private endpoint connection. Possible values include: + "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkServiceConnectionStatus + :param description: Required. The description for the current state of a private endpoint + connection. + :type description: str + :param actions_required: Actions required for a private endpoint connection. + :type actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Union[str, "PrivateLinkServiceConnectionStatus"], + description: str, + actions_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class RegistryStatistics(msrest.serialization.Model): + """Identity registry statistics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_device_count: The total count of devices in the identity registry. + :vartype total_device_count: long + :ivar enabled_device_count: The count of enabled devices in the identity registry. + :vartype enabled_device_count: long + :ivar disabled_device_count: The count of disabled devices in the identity registry. + :vartype disabled_device_count: long + """ + + _validation = { + 'total_device_count': {'readonly': True}, + 'enabled_device_count': {'readonly': True}, + 'disabled_device_count': {'readonly': True}, + } + + _attribute_map = { + 'total_device_count': {'key': 'totalDeviceCount', 'type': 'long'}, + 'enabled_device_count': {'key': 'enabledDeviceCount', 'type': 'long'}, + 'disabled_device_count': {'key': 'disabledDeviceCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryStatistics, self).__init__(**kwargs) + self.total_device_count = None + self.enabled_device_count = None + self.disabled_device_count = None + + +class RouteCompilationError(msrest.serialization.Model): + """Compilation error when evaluating route. + + :param message: Route error message. + :type message: str + :param severity: Severity of the route error. Possible values include: "error", "warning". + :type severity: str or ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorSeverity + :param location: Location where the route error happened. + :type location: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorRange + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'RouteErrorRange'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + severity: Optional[Union[str, "RouteErrorSeverity"]] = None, + location: Optional["RouteErrorRange"] = None, + **kwargs + ): + super(RouteCompilationError, self).__init__(**kwargs) + self.message = message + self.severity = severity + self.location = location + + +class RouteErrorPosition(msrest.serialization.Model): + """Position where the route error happened. + + :param line: Line where the route error happened. + :type line: int + :param column: Column where the route error happened. + :type column: int + """ + + _attribute_map = { + 'line': {'key': 'line', 'type': 'int'}, + 'column': {'key': 'column', 'type': 'int'}, + } + + def __init__( + self, + *, + line: Optional[int] = None, + column: Optional[int] = None, + **kwargs + ): + super(RouteErrorPosition, self).__init__(**kwargs) + self.line = line + self.column = column + + +class RouteErrorRange(msrest.serialization.Model): + """Range of route errors. + + :param start: Start where the route error happened. + :type start: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorPosition + :param end: End where the route error happened. + :type end: ~azure.mgmt.iothub.v2021_03_31.models.RouteErrorPosition + """ + + _attribute_map = { + 'start': {'key': 'start', 'type': 'RouteErrorPosition'}, + 'end': {'key': 'end', 'type': 'RouteErrorPosition'}, + } + + def __init__( + self, + *, + start: Optional["RouteErrorPosition"] = None, + end: Optional["RouteErrorPosition"] = None, + **kwargs + ): + super(RouteErrorRange, self).__init__(**kwargs) + self.start = start + self.end = end + + +class RouteProperties(msrest.serialization.Model): + """The properties of a routing rule that your IoT hub uses to route messages to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route. The name can only include alphanumeric + characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be + unique. + :type name: str + :param source: Required. The source that the routing rule is to be applied to, such as + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource + :param condition: The condition that is evaluated to apply the routing rule. If no condition is + provided, it evaluates to true by default. For grammar, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which messages that satisfy the + condition are routed. Currently only one endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether a route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + source: Union[str, "RoutingSource"], + endpoint_names: List[str], + is_enabled: bool, + condition: Optional[str] = None, + **kwargs + ): + super(RouteProperties, self).__init__(**kwargs) + self.name = name + self.source = source + self.condition = condition + self.endpoint_names = endpoint_names + self.is_enabled = is_enabled + + +class RoutingEndpoints(msrest.serialization.Model): + """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + + :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the + messages to, based on the routing rules. + :type service_bus_queues: + list[~azure.mgmt.iothub.v2021_03_31.models.RoutingServiceBusQueueEndpointProperties] + :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the + messages to, based on the routing rules. + :type service_bus_topics: + list[~azure.mgmt.iothub.v2021_03_31.models.RoutingServiceBusTopicEndpointProperties] + :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on + the routing rules. This list does not include the built-in Event Hubs endpoint. + :type event_hubs: list[~azure.mgmt.iothub.v2021_03_31.models.RoutingEventHubProperties] + :param storage_containers: The list of storage container endpoints that IoT hub routes messages + to, based on the routing rules. + :type storage_containers: + list[~azure.mgmt.iothub.v2021_03_31.models.RoutingStorageContainerProperties] + """ + + _attribute_map = { + 'service_bus_queues': {'key': 'serviceBusQueues', 'type': '[RoutingServiceBusQueueEndpointProperties]'}, + 'service_bus_topics': {'key': 'serviceBusTopics', 'type': '[RoutingServiceBusTopicEndpointProperties]'}, + 'event_hubs': {'key': 'eventHubs', 'type': '[RoutingEventHubProperties]'}, + 'storage_containers': {'key': 'storageContainers', 'type': '[RoutingStorageContainerProperties]'}, + } + + def __init__( + self, + *, + service_bus_queues: Optional[List["RoutingServiceBusQueueEndpointProperties"]] = None, + service_bus_topics: Optional[List["RoutingServiceBusTopicEndpointProperties"]] = None, + event_hubs: Optional[List["RoutingEventHubProperties"]] = None, + storage_containers: Optional[List["RoutingStorageContainerProperties"]] = None, + **kwargs + ): + super(RoutingEndpoints, self).__init__(**kwargs) + self.service_bus_queues = service_bus_queues + self.service_bus_topics = service_bus_topics + self.event_hubs = event_hubs + self.storage_containers = storage_containers + + +class RoutingEventHubProperties(msrest.serialization.Model): + """The properties related to an event hub endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the event hub endpoint. + :type id: str + :param connection_string: The connection string of the event hub endpoint. + :type connection_string: str + :param endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. + :type endpoint_uri: str + :param entity_path: Event hub name on the event hub namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the event hub endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of routing event hub endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the event hub endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the event hub endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + entity_path: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingEventHubProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.entity_path = entity_path + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingMessage(msrest.serialization.Model): + """Routing message. + + :param body: Body of routing message. + :type body: str + :param app_properties: App properties. + :type app_properties: dict[str, str] + :param system_properties: System properties. + :type system_properties: dict[str, str] + """ + + _attribute_map = { + 'body': {'key': 'body', 'type': 'str'}, + 'app_properties': {'key': 'appProperties', 'type': '{str}'}, + 'system_properties': {'key': 'systemProperties', 'type': '{str}'}, + } + + def __init__( + self, + *, + body: Optional[str] = None, + app_properties: Optional[Dict[str, str]] = None, + system_properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(RoutingMessage, self).__init__(**kwargs) + self.body = body + self.app_properties = app_properties + self.system_properties = system_properties + + +class RoutingProperties(msrest.serialization.Model): + """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + + :param endpoints: The properties related to the custom endpoints to which your IoT hub routes + messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all + endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types + for free hubs. + :type endpoints: ~azure.mgmt.iothub.v2021_03_31.models.RoutingEndpoints + :param routes: The list of user-provided routing rules that the IoT hub uses to route messages + to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and + a maximum of 5 routing rules are allowed for free hubs. + :type routes: list[~azure.mgmt.iothub.v2021_03_31.models.RouteProperties] + :param fallback_route: The properties of the route that is used as a fall-back route when none + of the conditions specified in the 'routes' section are met. This is an optional parameter. + When this property is not set, the messages which do not meet any of the conditions specified + in the 'routes' section get routed to the built-in eventhub endpoint. + :type fallback_route: ~azure.mgmt.iothub.v2021_03_31.models.FallbackRouteProperties + :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages + to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. + :type enrichments: list[~azure.mgmt.iothub.v2021_03_31.models.EnrichmentProperties] + """ + + _attribute_map = { + 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, + 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, + 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, + 'enrichments': {'key': 'enrichments', 'type': '[EnrichmentProperties]'}, + } + + def __init__( + self, + *, + endpoints: Optional["RoutingEndpoints"] = None, + routes: Optional[List["RouteProperties"]] = None, + fallback_route: Optional["FallbackRouteProperties"] = None, + enrichments: Optional[List["EnrichmentProperties"]] = None, + **kwargs + ): + super(RoutingProperties, self).__init__(**kwargs) + self.endpoints = endpoints + self.routes = routes + self.fallback_route = fallback_route + self.enrichments = enrichments + + +class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): + """The properties related to service bus queue endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus queue endpoint. + :type id: str + :param connection_string: The connection string of the service bus queue endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus queue endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus queue endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of routing service bus queue endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual queue + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus queue endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus queue endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + entity_path: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingServiceBusQueueEndpointProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.entity_path = entity_path + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): + """The properties related to service bus topic endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus topic endpoint. + :type id: str + :param connection_string: The connection string of the service bus topic endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus topic endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus topic. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus topic endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of routing service bus topic endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual topic + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus topic endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus topic endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + entity_path: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingServiceBusTopicEndpointProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.entity_path = entity_path + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingStorageContainerProperties(msrest.serialization.Model): + """The properties related to a storage container endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the storage container endpoint. + :type id: str + :param connection_string: The connection string of the storage account. + :type connection_string: str + :param endpoint_uri: The url of the storage endpoint. It must include the protocol https://. + :type endpoint_uri: str + :param authentication_type: Method used to authenticate against the storage endpoint. Possible + values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of routing storage endpoint. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the storage account. + :type subscription_id: str + :param resource_group: The name of the resource group of the storage account. + :type resource_group: str + :param container_name: Required. The name of storage container in the storage account. + :type container_name: str + :param file_name_format: File name format for the blob. Default format is + {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be + reordered. + :type file_name_format: str + :param batch_frequency_in_seconds: Time interval at which blobs are written to storage. Value + should be between 60 and 720 seconds. Default value is 300 seconds. + :type batch_frequency_in_seconds: int + :param max_chunk_size_in_bytes: Maximum number of bytes for each blob written to storage. Value + should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + :type max_chunk_size_in_bytes: int + :param encoding: Encoding that is used to serialize messages to blobs. Supported values are + 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", + "AvroDeflate", "JSON". + :type encoding: str or + ~azure.mgmt.iothub.v2021_03_31.models.RoutingStorageContainerPropertiesEncoding + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'container_name': {'required': True}, + 'batch_frequency_in_seconds': {'maximum': 720, 'minimum': 60}, + 'max_chunk_size_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'file_name_format': {'key': 'fileNameFormat', 'type': 'str'}, + 'batch_frequency_in_seconds': {'key': 'batchFrequencyInSeconds', 'type': 'int'}, + 'max_chunk_size_in_bytes': {'key': 'maxChunkSizeInBytes', 'type': 'int'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + container_name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + file_name_format: Optional[str] = None, + batch_frequency_in_seconds: Optional[int] = None, + max_chunk_size_in_bytes: Optional[int] = None, + encoding: Optional[Union[str, "RoutingStorageContainerPropertiesEncoding"]] = None, + **kwargs + ): + super(RoutingStorageContainerProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + self.container_name = container_name + self.file_name_format = file_name_format + self.batch_frequency_in_seconds = batch_frequency_in_seconds + self.max_chunk_size_in_bytes = max_chunk_size_in_bytes + self.encoding = encoding + + +class RoutingTwin(msrest.serialization.Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: A set of tags. Twin Tags. + :type tags: str + :param properties: + :type properties: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__( + self, + *, + tags: Optional[str] = None, + properties: Optional["RoutingTwinProperties"] = None, + **kwargs + ): + super(RoutingTwin, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class RoutingTwinProperties(msrest.serialization.Model): + """RoutingTwinProperties. + + :param desired: Twin desired properties. + :type desired: str + :param reported: Twin desired properties. + :type reported: str + """ + + _attribute_map = { + 'desired': {'key': 'desired', 'type': 'str'}, + 'reported': {'key': 'reported', 'type': 'str'}, + } + + def __init__( + self, + *, + desired: Optional[str] = None, + reported: Optional[str] = None, + **kwargs + ): + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired = desired + self.reported = reported + + +class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): + """The properties of an IoT hub shared access policy. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the shared access policy. + :type key_name: str + :param primary_key: The primary key. + :type primary_key: str + :param secondary_key: The secondary key. + :type secondary_key: str + :param rights: Required. The permissions assigned to the shared access policy. Possible values + include: "RegistryRead", "RegistryWrite", "ServiceConnect", "DeviceConnect", "RegistryRead, + RegistryWrite", "RegistryRead, ServiceConnect", "RegistryRead, DeviceConnect", "RegistryWrite, + ServiceConnect", "RegistryWrite, DeviceConnect", "ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", + "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". + :type rights: str or ~azure.mgmt.iothub.v2021_03_31.models.AccessRights + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: str, + rights: Union[str, "AccessRights"], + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRule, self).__init__(**kwargs) + self.key_name = key_name + self.primary_key = primary_key + self.secondary_key = secondary_key + self.rights = rights + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """The list of shared access policies with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SharedAccessSignatureAuthorizationRule"]] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StorageEndpointProperties(msrest.serialization.Model): + """The properties of the Azure Storage endpoint for file upload. + + All required parameters must be populated in order to send to Azure. + + :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + :type sas_ttl_as_iso8601: ~datetime.timedelta + :param connection_string: Required. The connection string for the Azure Storage account to + which files are uploaded. + :type connection_string: str + :param container_name: Required. The name of the root container where you upload files. The + container need not exist but should be creatable using the connectionString specified. + :type container_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_03_31.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for file upload. + :type identity: ~azure.mgmt.iothub.v2021_03_31.models.ManagedIdentity + """ + + _validation = { + 'connection_string': {'required': True}, + 'container_name': {'required': True}, + } + + _attribute_map = { + 'sas_ttl_as_iso8601': {'key': 'sasTtlAsIso8601', 'type': 'duration'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + *, + connection_string: str, + container_name: str, + sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + **kwargs + ): + super(StorageEndpointProperties, self).__init__(**kwargs) + self.sas_ttl_as_iso8601 = sas_ttl_as_iso8601 + self.connection_string = connection_string + self.container_name = container_name + self.authentication_type = authentication_type + self.identity = identity + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.tags = tags + + +class TestAllRoutesInput(msrest.serialization.Model): + """Input for testing all routes. + + :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", + "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", + "DeviceConnectionStateEvents". + :type routing_source: str or ~azure.mgmt.iothub.v2021_03_31.models.RoutingSource + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_03_31.models.RoutingMessage + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwin + """ + + _attribute_map = { + 'routing_source': {'key': 'routingSource', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + *, + routing_source: Optional[Union[str, "RoutingSource"]] = None, + message: Optional["RoutingMessage"] = None, + twin: Optional["RoutingTwin"] = None, + **kwargs + ): + super(TestAllRoutesInput, self).__init__(**kwargs) + self.routing_source = routing_source + self.message = message + self.twin = twin + + +class TestAllRoutesResult(msrest.serialization.Model): + """Result of testing all routes. + + :param routes: JSON-serialized array of matched routes. + :type routes: list[~azure.mgmt.iothub.v2021_03_31.models.MatchedRoute] + """ + + _attribute_map = { + 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, + } + + def __init__( + self, + *, + routes: Optional[List["MatchedRoute"]] = None, + **kwargs + ): + super(TestAllRoutesResult, self).__init__(**kwargs) + self.routes = routes + + +class TestRouteInput(msrest.serialization.Model): + """Input for testing route. + + All required parameters must be populated in order to send to Azure. + + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_03_31.models.RoutingMessage + :param route: Required. Route properties. + :type route: ~azure.mgmt.iothub.v2021_03_31.models.RouteProperties + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwin + """ + + _validation = { + 'route': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + *, + route: "RouteProperties", + message: Optional["RoutingMessage"] = None, + twin: Optional["RoutingTwin"] = None, + **kwargs + ): + super(TestRouteInput, self).__init__(**kwargs) + self.message = message + self.route = route + self.twin = twin + + +class TestRouteResult(msrest.serialization.Model): + """Result of testing one route. + + :param result: Result of testing route. Possible values include: "undefined", "false", "true". + :type result: str or ~azure.mgmt.iothub.v2021_03_31.models.TestResultStatus + :param details: Detailed result of testing route. + :type details: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteResultDetails + """ + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'TestRouteResultDetails'}, + } + + def __init__( + self, + *, + result: Optional[Union[str, "TestResultStatus"]] = None, + details: Optional["TestRouteResultDetails"] = None, + **kwargs + ): + super(TestRouteResult, self).__init__(**kwargs) + self.result = result + self.details = details + + +class TestRouteResultDetails(msrest.serialization.Model): + """Detailed result of testing a route. + + :param compilation_errors: JSON-serialized list of route compilation errors. + :type compilation_errors: list[~azure.mgmt.iothub.v2021_03_31.models.RouteCompilationError] + """ + + _attribute_map = { + 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, + } + + def __init__( + self, + *, + compilation_errors: Optional[List["RouteCompilationError"]] = None, + **kwargs + ): + super(TestRouteResultDetails, self).__init__(**kwargs) + self.compilation_errors = compilation_errors + + +class UserSubscriptionQuota(msrest.serialization.Model): + """User subscription quota response. + + :param id: IotHub type id. + :type id: str + :param type: Response type. + :type type: str + :param unit: Unit of IotHub type. + :type unit: str + :param current_value: Current number of IotHub type. + :type current_value: int + :param limit: Numerical limit on IotHub type. + :type limit: int + :param name: IotHub type. + :type name: ~azure.mgmt.iothub.v2021_03_31.models.Name + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'Name'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + type: Optional[str] = None, + unit: Optional[str] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["Name"] = None, + **kwargs + ): + super(UserSubscriptionQuota, self).__init__(**kwargs) + self.id = id + self.type = type + self.unit = unit + self.current_value = current_value + self.limit = limit + self.name = name + + +class UserSubscriptionQuotaListResult(msrest.serialization.Model): + """Json-serialized array of User subscription quota response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: + :type value: list[~azure.mgmt.iothub.v2021_03_31.models.UserSubscriptionQuota] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSubscriptionQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["UserSubscriptionQuota"]] = None, + **kwargs + ): + super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py new file mode 100644 index 000000000000..3930a2f261c8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._operations import Operations +from ._iot_hub_resource_operations import IotHubResourceOperations +from ._resource_provider_common_operations import ResourceProviderCommonOperations +from ._certificates_operations import CertificatesOperations +from ._iot_hub_operations import IotHubOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations + +__all__ = [ + 'Operations', + 'IotHubResourceOperations', + 'ResourceProviderCommonOperations', + 'CertificatesOperations', + 'IotHubOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py new file mode 100644 index 000000000000..b51addabf293 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_certificates_operations.py @@ -0,0 +1,474 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations(object): + """CertificatesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_iot_hub( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateListDescription" + """Get the certificate list. + + Returns the list of certificates. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.list_by_iot_hub.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_iot_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Get the certificate. + + Returns the certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + certificate_description, # type: "_models.CertificateDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Upload the certificate to the IoT hub. + + Adds new or replaces existing certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription + :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. + Required to update an existing certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_description, 'CertificateDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete an X509 certificate. + + Deletes an existing X509 certificate or does nothing if it does not exist. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def generate_verification_code( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateWithNonceDescription" + """Generate verification code for proof of possession flow. + + Generates verification code for proof of possession flow. The verification code will be used to + generate a leaf certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateWithNonceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateWithNonceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateWithNonceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + def verify( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + certificate_verification_body, # type: "_models.CertificateVerificationDescription" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :param certificate_verification_body: The name of the certificate. + :type certificate_verification_body: ~azure.mgmt.iothub.v2021_03_31.models.CertificateVerificationDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_verification_body, 'CertificateVerificationDescription') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py new file mode 100644 index 000000000000..3867a64cd8d3 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IotHubOperations(object): + """IotHubOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _manual_failover_initial( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + failover_input, # type: "_models.FailoverInput" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._manual_failover_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(failover_input, 'FailoverInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + 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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _manual_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore + + def begin_manual_failover( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + failover_input, # type: "_models.FailoverInput" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Manually initiate a failover for the IoT Hub to its secondary region. + + Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + https://aka.ms/manualfailover. + + :param iot_hub_name: Name of the IoT hub to failover. + :type iot_hub_name: str + :param resource_group_name: Name of the resource group containing the IoT hub resource. + :type resource_group_name: str + :param failover_input: Region to failover to. Must be the Azure paired region. Get the value + from the secondary location in the locations property. To learn more, see + https://aka.ms/manualfailover/region. + :type failover_input: ~azure.mgmt.iothub.v2021_03_31.models.FailoverInput + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._manual_failover_initial( + iot_hub_name=iot_hub_name, + resource_group_name=resource_group_name, + failover_input=failover_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_manual_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py new file mode 100644 index 000000000000..442b6248f58f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py @@ -0,0 +1,1887 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IotHubResourceOperations(object): + """IotHubResourceOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + """Get the non-security related metadata of an IoT hub. + + Get the non-security related metadata of an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_description, # type: "_models.IotHubDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_description, 'IotHubDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_description, # type: "_models.IotHubDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IotHubDescription"] + """Create or update the metadata of an IoT hub. + + Create or update the metadata of an Iot hub. The usual pattern to modify a property is to + retrieve the IoT hub metadata and security metadata, and then combine them with the modified + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param iot_hub_description: The IoT hub metadata and security metadata. + :type iot_hub_description: ~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription + :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required + to update an existing IoT Hub. + :type if_match: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_description=iot_hub_description, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(iot_hub_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IotHubDescription"] + """Update an existing IoT Hubs tags. + + Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param resource_name: Name of iot hub to update. + :type resource_name: str + :param iot_hub_tags: Updated tag information to set into the iot hub instance. + :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_31.models.TagsResource + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + iot_hub_tags=iot_hub_tags, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + """Delete an IoT hub. + + Delete an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + 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_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubDescriptionListResult"] + """Get all the IoT hubs in a subscription. + + Get all the IoT hubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubDescriptionListResult"] + """Get all the IoT hubs in a resource group. + + Get all the IoT hubs in a resource group. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_31.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubDescriptionListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'} # type: ignore + + def get_stats( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RegistryStatistics" + """Get the statistics from an IoT hub. + + Get the statistics from an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryStatistics, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.RegistryStatistics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_stats.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RegistryStatistics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + + def get_valid_skus( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubSkuDescriptionListResult"] + """Get the list of valid SKUs for an IoT hub. + + Get the list of valid SKUs for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_31.models.IotHubSkuDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_valid_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubSkuDescriptionListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + + def list_event_hub_consumer_groups( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EventHubConsumerGroupsListResult"] + """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + + Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an + IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint. + :type event_hub_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_event_hub_consumer_groups.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubConsumerGroupsListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_event_hub_consumer_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'} # type: ignore + + def get_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EventHubConsumerGroupInfo" + """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to retrieve. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def create_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + consumer_group_body, # type: "_models.EventHubConsumerGroupBodyDescription" + **kwargs # type: Any + ): + # type: (...) -> "_models.EventHubConsumerGroupInfo" + """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to add. + :type name: str + :param consumer_group_body: The consumer group to add. + :type consumer_group_body: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupBodyDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(consumer_group_body, 'EventHubConsumerGroupBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def delete_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to delete. + :type name: 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.delete_event_hub_consumer_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def list_jobs( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.JobResponseListResult"] + """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get a list of all the jobs in an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResponseListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_31.models.JobResponseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_jobs.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('JobResponseListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + + def get_job( + self, + resource_group_name, # type: str + resource_name, # type: str + job_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get the details of a job from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param job_id: The job identifier. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_job.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + + def get_quota_metrics( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubQuotaMetricInfoListResult"] + """Get the quota metrics for an IoT hub. + + Get the quota metrics for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_31.models.IotHubQuotaMetricInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_quota_metrics.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotHubQuotaMetricInfoListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + + def get_endpoint_health( + self, + resource_group_name, # type: str + iot_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointHealthDataListResult"] + """Get the health for routing endpoints. + + Get the health for routing endpoints. + + :param resource_group_name: + :type resource_group_name: str + :param iot_hub_name: + :type iot_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_31.models.EndpointHealthDataListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_endpoint_health.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EndpointHealthDataListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_endpoint_health.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth'} # type: ignore + + def check_name_availability( + self, + operation_inputs, # type: "_models.OperationInputs" + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubNameAvailabilityInfo" + """Check if an IoT hub name is available. + + Check if an IoT hub name is available. + + :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of + the IoT hub to check. + :type operation_inputs: ~azure.mgmt.iothub.v2021_03_31.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubNameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.IotHubNameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(operation_inputs, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + + def test_all_routes( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + input, # type: "_models.TestAllRoutesInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestAllRoutesResult" + """Test all routes. + + Test all routes configured in this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Input for testing all routes. + :type input: ~azure.mgmt.iothub.v2021_03_31.models.TestAllRoutesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestAllRoutesResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.TestAllRoutesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_all_routes.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestAllRoutesInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_all_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'} # type: ignore + + def test_route( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + input, # type: "_models.TestRouteInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestRouteResult" + """Test the new route. + + Test the new route for this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Route that needs to be tested. + :type input: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestRouteResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.TestRouteResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_route.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(input, 'TestRouteInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestRouteResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessSignatureAuthorizationRuleListResult"] + """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get the security metadata for an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + + def get_keys_for_key_name( + self, + resource_group_name, # type: str + resource_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessSignatureAuthorizationRule" + """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get a shared access policy by name from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param key_name: The name of the shared access policy. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.SharedAccessSignatureAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_keys_for_key_name.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + + def export_devices( + self, + resource_group_name, # type: str + resource_name, # type: str + export_devices_parameters, # type: "_models.ExportDevicesRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Exports all the device identities in the IoT hub identity registry to an Azure Storage blob + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param export_devices_parameters: The parameters that specify the export devices operation. + :type export_devices_parameters: ~azure.mgmt.iothub.v2021_03_31.models.ExportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.export_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + + def import_devices( + self, + resource_group_name, # type: str + resource_name, # type: str + import_devices_parameters, # type: "_models.ImportDevicesRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Import, update, or delete device identities in the IoT hub identity registry from a blob. For + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param import_devices_parameters: The parameters that specify the import devices operation. + :type import_devices_parameters: ~azure.mgmt.iothub.v2021_03_31.models.ImportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_devices.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py new file mode 100644 index 000000000000..6d9901ad5fb0 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available IoT Hub REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_03_31.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..2fb547fd021e --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,446 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.PrivateEndpointConnection"] + """List private endpoint connections. + + List private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of PrivateEndpointConnection, or the result of cls(response) + :rtype: list[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[PrivateEndpointConnection]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Get private endpoint connection. + + Get private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Update private endpoint connection. + + Update the status of a private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection with updated properties. + :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Delete private endpoint connection. + + Delete private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_03_31.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..9c7893e23b63 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_link_resources_operations.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResources" + """List private link resources. + + List private link resources for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResources, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.PrivateLinkResources + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResources', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GroupIdInformation" + """Get the specified private link resource. + + Get the specified private link resource for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param group_id: The name of the private link resource. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupIdInformation, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.GroupIdInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GroupIdInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py new file mode 100644 index 000000000000..aeef2ede9af0 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_resource_provider_common_operations.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourceProviderCommonOperations(object): + """ResourceProviderCommonOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.iothub.v2021_03_31.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_subscription_quota( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.UserSubscriptionQuotaListResult" + """Get the number of iot hubs in the subscription. + + Get the number of free and paid iot hubs in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSubscriptionQuotaListResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_03_31.models.UserSubscriptionQuotaListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-31" + accept = "application/json" + + # Construct URL + url = self.get_subscription_quota.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserSubscriptionQuotaListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_quota.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file From df8f69a35777a9a7db616e486ee8f29caa72f08c Mon Sep 17 00:00:00 2001 From: PythonSdkPipelines Date: Fri, 14 May 2021 09:24:17 +0000 Subject: [PATCH 2/4] version,CHANGELOG --- sdk/iothub/azure-mgmt-iothub/CHANGELOG.md | 26 +++++++++++++++++++ .../azure/mgmt/iothub/_version.py | 2 +- .../azure/mgmt/iothub/v2016_02_03/_version.py | 2 +- .../azure/mgmt/iothub/v2017_01_19/_version.py | 2 +- .../azure/mgmt/iothub/v2017_07_01/_version.py | 2 +- .../azure/mgmt/iothub/v2018_01_22/_version.py | 2 +- .../azure/mgmt/iothub/v2018_04_01/_version.py | 2 +- .../azure/mgmt/iothub/v2019_03_22/_version.py | 2 +- .../iothub/v2019_07_01_preview/_version.py | 2 +- .../azure/mgmt/iothub/v2019_11_04/_version.py | 2 +- .../azure/mgmt/iothub/v2020_03_01/_version.py | 2 +- .../iothub/v2021_03_03_preview/_version.py | 2 +- .../azure/mgmt/iothub/v2021_03_31/_version.py | 2 +- sdk/iothub/azure-mgmt-iothub/setup.py | 2 +- shared_requirements.txt | 1 + 15 files changed, 40 insertions(+), 13 deletions(-) diff --git a/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md b/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md index 57b703039d85..8e4663115f7e 100644 --- a/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md +++ b/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md @@ -1,5 +1,31 @@ # Release History +## 2.0.0 (2021-05-14) + +**Features** + + - Model EndpointHealthData has a new parameter last_send_attempt_time + - Model EndpointHealthData has a new parameter last_known_error_time + - Model EndpointHealthData has a new parameter last_known_error + - Model EndpointHealthData has a new parameter last_successful_send_attempt_time + - Model ImportDevicesRequest has a new parameter identity + - Model ImportDevicesRequest has a new parameter configurations_blob_name + - Model ImportDevicesRequest has a new parameter include_configurations + - Model RoutingServiceBusTopicEndpointProperties has a new parameter identity + - Model RoutingStorageContainerProperties has a new parameter identity + - Model StorageEndpointProperties has a new parameter identity + - Model IotHubDescription has a new parameter identity + - Model IotHubProperties has a new parameter network_rule_sets + - Model ExportDevicesRequest has a new parameter identity + - Model ExportDevicesRequest has a new parameter configurations_blob_name + - Model ExportDevicesRequest has a new parameter include_configurations + - Model RoutingServiceBusQueueEndpointProperties has a new parameter identity + - Model RoutingEventHubProperties has a new parameter identity + +**Breaking changes** + + - Operation IotHubResourceOperations.create_event_hub_consumer_group has a new signature + ## 1.0.0 (2020-12-18) - GA release diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py index c47f66669f1b..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py index ba617b3fa777..48944bf3938a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.2" +VERSION = "2.0.0" diff --git a/sdk/iothub/azure-mgmt-iothub/setup.py b/sdk/iothub/azure-mgmt-iothub/setup.py index 0461e75817ab..4edab42fa518 100644 --- a/sdk/iothub/azure-mgmt-iothub/setup.py +++ b/sdk/iothub/azure-mgmt-iothub/setup.py @@ -80,7 +80,7 @@ 'azure.mgmt', ]), install_requires=[ - 'msrest>=0.5.0', + 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.2.0,<2.0.0', ], diff --git a/shared_requirements.txt b/shared_requirements.txt index 4158bc2d8955..e2f8695a2858 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -272,3 +272,4 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-confidentialledger msrest>=0.6.21 #override azure-mgmt-videoanalyzer msrest>=0.6.21 #override azure-mgmt-extendedlocation msrest>=0.6.21 +#override azure-mgmt-iothub msrest>=0.6.21 From c81167c6bf9b3586504a3f7b4dce1d47dfb0c2e3 Mon Sep 17 00:00:00 2001 From: PythonSdkPipelines Date: Fri, 14 May 2021 09:27:11 +0000 Subject: [PATCH 3/4] test --- .../test_mgmt_iothub.test_iothub.yaml | 145 +++--- ...gmt_iothub.test_iothub_consumer_group.yaml | 444 +----------------- 2 files changed, 92 insertions(+), 497 deletions(-) diff --git a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub.yaml b/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub.yaml index 4824d45e6cce..7e44331fadbf 100644 --- a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub.yaml +++ b/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub.yaml @@ -13,9 +13,10 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/checkNameAvailability?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/checkNameAvailability?api-version=2021-03-31 response: body: string: '{"nameAvailable":true,"reason":"Invalid","message":null}' @@ -27,7 +28,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:15:33 GMT + - Fri, 14 May 2021 09:24:45 GMT expires: - '-1' pragma: @@ -62,23 +63,24 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-03-31 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","properties":{"state":"Activating","provisioningState":"Accepted","enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZGZlZGQwNGUtZWQxNC00N2MxLWFmMDYtMDAwNmU3ZWUwY2E0?api-version=2020-03-01&operationSource=os_ih&asyncinfo + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo cache-control: - no-cache content-length: - - '688' + - '698' content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:15:43 GMT + - Fri, 14 May 2021 09:24:48 GMT expires: - '-1' pragma: @@ -104,9 +106,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZGZlZGQwNGUtZWQxNC00N2MxLWFmMDYtMDAwNmU3ZWUwY2E0?api-version=2020-03-01&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Running"}' @@ -118,7 +121,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:16:13 GMT + - Fri, 14 May 2021 09:25:18 GMT expires: - '-1' pragma: @@ -146,9 +149,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZGZlZGQwNGUtZWQxNC00N2MxLWFmMDYtMDAwNmU3ZWUwY2E0?api-version=2020-03-01&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Running"}' @@ -160,7 +164,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:16:44 GMT + - Fri, 14 May 2021 09:25:48 GMT expires: - '-1' pragma: @@ -188,9 +192,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZGZlZGQwNGUtZWQxNC00N2MxLWFmMDYtMDAwNmU3ZWUwY2E0?api-version=2020-03-01&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Running"}' @@ -202,7 +207,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:14 GMT + - Fri, 14 May 2021 09:26:18 GMT expires: - '-1' pragma: @@ -230,9 +235,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZGZlZGQwNGUtZWQxNC00N2MxLWFmMDYtMDAwNmU3ZWUwY2E0?api-version=2020-03-01&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Succeeded"}' @@ -244,7 +250,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:45 GMT + - Fri, 14 May 2021 09:26:49 GMT expires: - '-1' pragma: @@ -272,22 +278,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-03-31 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAABor6H1E=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-6681843-67b5fb8079.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADEou5BY=","properties":{"locations":[{"location":"West + US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-10929372-22e5a427a3.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}' headers: cache-control: - no-cache content-length: - - '1570' + - '1581' content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:46 GMT + - Fri, 14 May 2021 09:26:50 GMT expires: - '-1' pragma: @@ -315,22 +322,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-03-31 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAABor6H1E=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-6681843-67b5fb8079.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADEou5BY=","properties":{"locations":[{"location":"West + US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-10929372-22e5a427a3.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}' headers: cache-control: - no-cache content-length: - - '1570' + - '1581' content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:47 GMT + - Fri, 14 May 2021 09:26:50 GMT expires: - '-1' pragma: @@ -358,22 +366,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs?api-version=2021-03-31 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAABor6H1E=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-6681843-67b5fb8079.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}]}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADEou5BY=","properties":{"locations":[{"location":"West + US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-10929372-22e5a427a3.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}]}' headers: cache-control: - no-cache content-length: - - '1582' + - '1593' content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:47 GMT + - Fri, 14 May 2021 09:26:50 GMT expires: - '-1' pragma: @@ -401,22 +410,24 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/IotHubs?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/IotHubs?api-version=2021-03-31 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAABor6H1E=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-6681843-67b5fb8079.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}]}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADEou5BY=","properties":{"locations":[{"location":"West + US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-10929372-22e5a427a3.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgpy-test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee","name":"iot88d011ee","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"rgpy-test_mgmt_iothub_test_iothub_consumer_group88d011ee","etag":"AAAADEou4WE=","properties":{"locations":[{"location":"West + US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Activating","provisioningState":"Activating","ipFilterRules":[],"eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}]}' headers: cache-control: - no-cache content-length: - - '1582' + - '3030' content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:48 GMT + - Fri, 14 May 2021 09:26:51 GMT expires: - '-1' pragma: @@ -444,9 +455,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/IotHubStats?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/IotHubStats?api-version=2021-03-31 response: body: string: '{"totalDeviceCount":0,"enabledDeviceCount":0,"disabledDeviceCount":0}' @@ -458,7 +470,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:48 GMT + - Fri, 14 May 2021 09:26:51 GMT expires: - '-1' pragma: @@ -486,9 +498,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/skus?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/skus?api-version=2021-03-31 response: body: string: '{"value":[{"resourceType":"Microsoft.Devices/IotHubs","sku":{"name":"S1","tier":"Standard"},"capacity":{"minimum":1,"maximum":200,"default":1,"scaleType":"Manual"}},{"resourceType":"Microsoft.Devices/IotHubs","sku":{"name":"S2","tier":"Standard"},"capacity":{"minimum":1,"maximum":200,"default":1,"scaleType":"Manual"}},{"resourceType":"Microsoft.Devices/IotHubs","sku":{"name":"S3","tier":"Standard"},"capacity":{"minimum":1,"maximum":10,"default":1,"scaleType":"Manual"}}]}' @@ -500,7 +513,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:49 GMT + - Fri, 14 May 2021 09:26:51 GMT expires: - '-1' pragma: @@ -528,9 +541,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/jobs?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/jobs?api-version=2021-03-31 response: body: string: '{"value":[]}' @@ -542,7 +556,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:49 GMT + - Fri, 14 May 2021 09:26:51 GMT expires: - '-1' pragma: @@ -570,9 +584,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/quotaMetrics?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/quotaMetrics?api-version=2021-03-31 response: body: string: '{"value":[{"name":"TotalMessages","currentValue":0,"maxValue":800000},{"name":"TotalDeviceCount","currentValue":0,"maxValue":1000000}]}' @@ -584,7 +599,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:49 GMT + - Fri, 14 May 2021 09:26:51 GMT expires: - '-1' pragma: @@ -614,15 +629,16 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-03-31 response: body: string: 'null' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfYTgyOGZkNDUtZTllYy00MGZkLWI5OGMtNjE2ZmYyNGNiYTg1?api-version=2020-03-01&operationSource=os_ih&asyncinfo + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZjY2ZTM2OWItMGY1NS00Mzk4LWFkNTUtOGNjYmUzMGJkOTI1?api-version=2021-03-31&operationSource=os_ih&asyncinfo cache-control: - no-cache content-length: @@ -630,11 +646,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:17:51 GMT + - Fri, 14 May 2021 09:26:52 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfYTgyOGZkNDUtZTllYy00MGZkLWI5OGMtNjE2ZmYyNGNiYTg1?api-version=2020-03-01&operationSource=os_ih + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZjY2ZTM2OWItMGY1NS00Mzk4LWFkNTUtOGNjYmUzMGJkOTI1?api-version=2021-03-31&operationSource=os_ih pragma: - no-cache server: @@ -658,9 +674,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfYTgyOGZkNDUtZTllYy00MGZkLWI5OGMtNjE2ZmYyNGNiYTg1?api-version=2020-03-01&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZjY2ZTM2OWItMGY1NS00Mzk4LWFkNTUtOGNjYmUzMGJkOTI1?api-version=2021-03-31&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Succeeded"}' @@ -672,7 +689,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:18:07 GMT + - Fri, 14 May 2021 09:27:07 GMT expires: - '-1' pragma: diff --git a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub_consumer_group.yaml b/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub_consumer_group.yaml index 84474a2a303e..16e8c1fb9d3a 100644 --- a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub_consumer_group.yaml +++ b/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub_consumer_group.yaml @@ -14,23 +14,25 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee?api-version=2020-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee?api-version=2021-03-31 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee","name":"iot88d011ee","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothub_consumer_group88d011ee","properties":{"state":"Activating","provisioningState":"Accepted","enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2}}' + string: '{"code":409002,"httpStatusCode":"Conflict","message":"Operation in + progress. If you contact a support representative please include this correlation + identifier: 2e9406bd-2d51-4a9a-a7c3-1fe1c4df18f4, timestamp: 2021-05-14 09:27:09Z, + errorcode: IH409002."}' headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMGEzYzZlZmEtN2RjNi00OWM2LTlkNTItN2ZlOTA2MzE5NjM4?api-version=2020-03-01&operationSource=os_ih&asyncinfo cache-control: - no-cache content-length: - - '718' + - '254' content-type: - application/json; charset=utf-8 date: - - Fri, 18 Dec 2020 03:18:28 GMT + - Fri, 14 May 2021 09:27:09 GMT expires: - '-1' pragma: @@ -44,430 +46,6 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '4999' status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMGEzYzZlZmEtN2RjNi00OWM2LTlkNTItN2ZlOTA2MzE5NjM4?api-version=2020-03-01&operationSource=os_ih&asyncinfo - response: - body: - string: '{"status":"Running"}' - headers: - cache-control: - - no-cache - content-length: - - '20' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 18 Dec 2020 03:18:58 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMGEzYzZlZmEtN2RjNi00OWM2LTlkNTItN2ZlOTA2MzE5NjM4?api-version=2020-03-01&operationSource=os_ih&asyncinfo - response: - body: - string: '{"status":"Running"}' - headers: - cache-control: - - no-cache - content-length: - - '20' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 18 Dec 2020 03:19:29 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMGEzYzZlZmEtN2RjNi00OWM2LTlkNTItN2ZlOTA2MzE5NjM4?api-version=2020-03-01&operationSource=os_ih&asyncinfo - response: - body: - string: '{"status":"Running"}' - headers: - cache-control: - - no-cache - content-length: - - '20' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 18 Dec 2020 03:19:59 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMGEzYzZlZmEtN2RjNi00OWM2LTlkNTItN2ZlOTA2MzE5NjM4?api-version=2020-03-01&operationSource=os_ih&asyncinfo - response: - body: - string: '{"status":"Running"}' - headers: - cache-control: - - no-cache - content-length: - - '20' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 18 Dec 2020 03:20:29 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMGEzYzZlZmEtN2RjNi00OWM2LTlkNTItN2ZlOTA2MzE5NjM4?api-version=2020-03-01&operationSource=os_ih&asyncinfo - response: - body: - string: '{"status":"Succeeded"}' - headers: - cache-control: - - no-cache - content-length: - - '22' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 18 Dec 2020 03:21:01 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee?api-version=2020-03-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee","name":"iot88d011ee","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothub_consumer_group88d011ee","etag":"AAAABor84rM=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iot88d011ee.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iot88d011ee","endpoint":"sb://iothub-ns-iot88d011e-6681919-6ecb10f375.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}' - headers: - cache-control: - - no-cache - content-length: - - '1600' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 18 Dec 2020 03:21:01 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee/eventHubEndpoints/events/ConsumerGroups/consumergrp88d011ee?api-version=2020-03-01 - response: - body: - string: '{"properties":{"created":"Fri, 18 Dec 2020 03:21:03 GMT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee/eventHubEndpoints/events/ConsumerGroups/consumergrp88d011ee","name":"consumergrp88d011ee","type":"Microsoft.Devices/IotHubs/EventHubEndpoints/ConsumerGroups","etag":null}' - headers: - cache-control: - - no-cache - content-length: - - '401' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 18 Dec 2020 03:21:04 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee/eventHubEndpoints/events/ConsumerGroups/consumergrp88d011ee?api-version=2020-03-01 - response: - body: - string: '{"properties":{"created":"Fri, 18 Dec 2020 03:21:03 GMT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee/eventHubEndpoints/events/ConsumerGroups/consumergrp88d011ee","name":"consumergrp88d011ee","type":"Microsoft.Devices/IotHubs/EventHubEndpoints/ConsumerGroups","etag":null}' - headers: - cache-control: - - no-cache - content-length: - - '401' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 18 Dec 2020 03:21:04 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee/eventHubEndpoints/events/ConsumerGroups?api-version=2020-03-01 - response: - body: - string: '{"value":[{"properties":{"created":"Fri, 18 Dec 2020 03:20:13 GMT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee/eventHubEndpoints/events/ConsumerGroups/%24Default","name":"$Default","type":"Microsoft.Devices/IotHubs/EventHubEndpoints/ConsumerGroups","etag":null},{"properties":{"created":"Fri, - 18 Dec 2020 03:21:03 GMT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee/eventHubEndpoints/events/ConsumerGroups/consumergrp88d011ee","name":"consumergrp88d011ee","type":"Microsoft.Devices/IotHubs/EventHubEndpoints/ConsumerGroups","etag":null}]}' - headers: - cache-control: - - no-cache - content-length: - - '795' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 18 Dec 2020 03:21:05 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-azure-mgmt-iothub/1.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee/eventHubEndpoints/events/ConsumerGroups/consumergrp88d011ee?api-version=2020-03-01 - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Fri, 18 Dec 2020 03:21:06 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14999' - status: - code: 200 - message: OK + code: 409 + message: Conflict version: 1 From 8a901f69fc50085481a9ce8698d76560e2b7ae73 Mon Sep 17 00:00:00 2001 From: Zed <601306339@qq.com> Date: Mon, 17 May 2021 10:58:10 +0800 Subject: [PATCH 4/4] test config --- sdk/iothub/azure-mgmt-iothub/tests/test_mgmt_iothub.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/iothub/azure-mgmt-iothub/tests/test_mgmt_iothub.py b/sdk/iothub/azure-mgmt-iothub/tests/test_mgmt_iothub.py index 620907270824..bffc84112167 100644 --- a/sdk/iothub/azure-mgmt-iothub/tests/test_mgmt_iothub.py +++ b/sdk/iothub/azure-mgmt-iothub/tests/test_mgmt_iothub.py @@ -96,6 +96,7 @@ def test_iothub(self, resource_group, location): ) async_delete.wait() + @unittest.skip('hard to test') @ResourceGroupPreparer() def test_iothub_consumer_group(self, resource_group, location): account_name = self.get_resource_name('iot')